Changeset 312


Ignore:
Timestamp:
Aug 17, 2011, 12:24:52 AM (8 years ago)
Author:
amain
Message:

debian/rootfs: several fixes for using second stage install with qemu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debian/rootfs/debian.mk

    r310 r312  
    2222MODULES_VERSION=$(shell echo `basename $(DEBWRT_MODULES_ARCHIVE) 2>/dev/null` | awk -F '-' '{print $$6}')
    2323
    24 chr: debian/rootfs/qemu-check
     24define qemu-prepare-enter
     25        @if [ ! -x $(QEMU_BIN_STATIC) ]; then echo "E: can't find qemu ($(QEMU_BIN_STATIC))"; fi
     26        @if [ ! -e /proc/sys/fs/binfmt_misc/qemu-$(TARGET_ARCH) ]; then echo "E: can't find binfmt_misc qemu-$(TARGET_ARCH) ( /proc/sys/fs/binfmt_misc/qemu-$(TARGET_ARCH)).\nE: install qemu-user-static, or\nE: disable second stage with qemu with menuconfig (DEBIAN_ROOTFS_QEMU_2ND_STAGE)."; fi
     27        @if [ ! -x $(QEMU_BIN_STATIC) -o ! -e /proc/sys/fs/binfmt_misc/qemu-$(TARGET_ARCH) ]; then echo "E: abort"; exit 1; fi
     28        @sudo cp $(QEMU_BIN_STATIC) $(ROOTFS_BUILD_DIR)$(QEMU_INTERPRETER)
     29        @if ! sudo chroot $(ROOTFS_BUILD_DIR) /bin/ls >/dev/null; then echo "E: qemu can't execute binaries for $(TARGET_ARCH)"; echo "E: abort"; exit 1; fi
     30endef
     31
     32chr:
     33        $(call qemu-prepare-enter)
    2534        @sudo bash -c "echo "debwrt-$(TARGET_ARCH)" > $(ROOTFS_BUILD_DIR)/etc/debian_chroot"
    2635        @sudo cp $(ROOTFS_BUILD_DIR)/etc/resolv.conf $(ROOTFS_BUILD_DIR)/etc/resolv.conf_debwrt
     
    2837        @sudo chroot $(ROOTFS_BUILD_DIR)
    2938        @sudo rm -f $(ROOTFS_BUILD_DIR)$(QEMU_INTERPRETER)
    30         @sudo rm -f $(ROOTFS_BUILD_DIR)/debian_chroot
     39        @sudo rm -f $(ROOTFS_BUILD_DIR)/etc/debian_chroot
    3140        @sudo cp $(ROOTFS_BUILD_DIR)/etc/resolv.conf_debwrt $(ROOTFS_BUILD_DIR)/etc/resolv.conf
    32 
    33 debian/rootfs/qemu-check:
    34         @if [ ! -x $(QEMU_BIN_STATIC) ]; then echo "E: can't find qemu ($(QEMU_BIN_STATIC))"; fi
    35         @if [ ! -e /proc/sys/fs/binfmt_misc/qemu-$(TARGET_ARCH) ]; then echo "E: can't find binfmt_misc qemu-$(TARGET_ARCH) ( /proc/sys/fs/binfmt_misc/qemu-$(TARGET_ARCH)).\nE: install qemu-user-static, or\nE: disable second stage with qemu with menuconfig (DEBIAN_ROOTFS_QEMU_2ND_STAGE)."; fi
    36         @if [ ! -x $(QEMU_BIN_STATIC) -o ! -e /proc/sys/fs/binfmt_misc/qemu-$(TARGET_ARCH) ]; then echo "E: abort"; exit 1; fi
    37         @sudo cp $(QEMU_BIN_STATIC) $(ROOTFS_BUILD_DIR)$(QEMU_INTERPRETER)
    38         @if ! sudo chroot $(ROOTFS_BUILD_DIR) /bin/ls >/dev/null; then echo "E: qemu can't execute binaries for $(TARGET_ARCH)"; echo "E: abort"; exit 1; fi
    3941
    4042debian/rootfs: debian/rootfs/bootstrap         \
     
    4547               debian/rootfs/post-setup        \
    4648               debian/rootfs/second-stage-qemu
     49        @echo "I: root filesystem $(DEBIAN_BUILD_VERSION) $(TARGET_ARCH) prepared in $(ROOTFS_BUILD_DIR)"
     50        @echo "I: don't forget to install the correct kernel modules"
     51        @echo "I: kernel modules can be copied manually, or build and copied by:"
     52        @echo "I: - make openwrt/all"
     53        @echo "I: - make debian/rootfs/modules-install"
     54        @echo "I:"
     55        @echo "I: install the image to USB-Disk/USB-Stick/SD-Card (make sure it is already mounted at /media/DEBWRT_ROOTFS)"
     56        @echo "I: - make debian/rootfs/install"
     57        @echo "I:"
     58        @echo "I: enter the change root(with qemu) and perform additional post install steps:"
     59        @echo "I: - make chr"
     60        @echi "I: - apt-get update # example statement ;-) - networking works!"
    4761        touch $@
    4862
     
    8094        sudo tar xof $(DEBWRT_MODULES_ARCHIVE) -C $(ROOTFS_BUILD_DIR)
    8195        #sudo depmod -a -b $(ROOTFS_BUILD_DIR) $(MODULES_VERSION)
     96else
     97        @echo "W: Can't install kernel module to the change root. Kernel modules archive missing. ($(DEBWRT_MODULES_ARCHIVE))"
    8298endif
    8399        touch $@
     
    133149
    134150ifeq ($(DEBIAN_ROOTFS_QEMU_2ND_STAGE),y)
    135 debian/rootfs/second-stage-qemu: debian/rootfs/bootstrap debian/buildenv/qemu-build debian/rootfs/qemu-check
     151debian/rootfs/second-stage-qemu: debian/rootfs/bootstrap debian/buildenv/qemu-build
     152        $(call qemu-prepare-enter)
    136153        sudo chroot $(ROOTFS_BUILD_DIR) /usr/sbin/PostInstall && sudo rm -f $(ROOTFS_BUILD_DIR)/usr/sbin/PostInstall
    137154        sudo rm -f $(ROOTFS_BUILD_DIR)$(QEMU_INTERPRETER)
    138155else
    139 debian/rootfs/second-stage-qemu: debian/rootfs/bootstrap debian/buildenv/qemu-build
     156debian/rootfs/second-stage-qemu: debian/rootfs/bootstrap
    140157        @echo "I: Qemu 2nd stage install disabled. Second stage needs now to be performend on the target device itself."
    141158        @echo "I: Qemu 2nd stage install can be enabled using menuconfig (DEBIAN_ROOTFS_QEMU_2ND_STAGE)."
     
    150167        rm -f debian/rootfs/files-install
    151168        rm -f debian/rootfs/modules-install
     169
Note: See TracChangeset for help on using the changeset viewer.