BRN:Software:Build and Distribution:Build and install an image

From
Jump to navigation Jump to search

Kernel

ELF-executable compressed kernel image

  • Strip off some (unneeded) binary code segments
$ /tmp/mj-build/openwrt/staging_dir_mipsel/bin/mipsel-linux-uclibc-objcopy -O binary \
  -R .reginfo \
  -R .note \
  -R .comment \
  -R .mdebug \
  -S /tmp/mj-build/openwrt/build_mipsel/linux-2.6-brcm/linux-2.6.16.7/vmlinux /tmp/mj-build/openwrt/build_mipsel/linux-2.6-brcm/vmlinux
  • Build loader program for decompressing LZMA-compressed at boot time
$ make -C /tmp/mj-build/openwrt/build_mipsel/loader-0.04 \
       CC=/tmp/mj-build/openwrt/staging_dir_mipsel/bin/mipsel-linux-uclibc-gcc \
       LD=/tmp/mj-build/openwrt/staging_dir_mipsel/bin/mipsel-linux-uclibc-ld \
       CROSS_COMPILE=/tmp/mj-build/openwrt/staging_dir_mipsel/bin/mipsel-linux-uclibc-
$ cp -fpR /tmp/mj-build/openwrt/build_mipsel/loader-0.04/loader.gz /tmp/mj-build/openwrt/build_mipsel/loader.gz
$ cp -fpR /tmp/mj-build/openwrt/build_mipsel/loader-0.04/loader.o /tmp/mj-build/openwrt/build_mipsel/loader.elf
$ cp -fpR /tmp/mj-build/openwrt/build_mipsel/loader.gz /tmp/mj-build/openwrt/build_mipsel/linux-2.6-brcm/loader.tmp.gz
$ echo -ne "\\x00" >> /tmp/mj-build/openwrt/build_mipsel/linux-2.6-brcm/loader.tmp.gz

The same for Kamikaze:

$ make -C  /tmp/mj-build/Kamikaze/target/linux/brcm-2.6/image/lzma-loader/src/ \
       CC=/tmp/mj-build/Kamikaze/staging_dir_mipsel/bin/mipsel-linux-uclibc-gcc \
       LD=/tmp/mj-build/Kamikaze/staging_dir_mipsel/bin/mipsel-linux-uclibc-ld \
       CROSS_COMPILE=/tmp/mj-build/Kamikaze/staging_dir_mipsel/bin/mipsel-linux-uclibc- \
       TOPDIR=/tmp/mj-build/Kamikaze/ \
       V=99
  • Compress the binary code (with LZMA)
$ cat /tmp/mj-build/openwrt/build_mipsel/linux-2.6-brcm/vmlinux \
  | /tmp/mj-build/openwrt/staging_dir_mipsel/bin/lzma e \
      -si -so -eos -lc1 -lp2 -pb2 > /tmp/mj-build/openwrt/build_mipsel/linux-2.6-brcm/vmlinux.lzma
  • Make TRX headers
$ /tmp/mj-build/openwrt/staging_dir_mipsel/bin/trx \
      -o /tmp/mj-build/openwrt/build_mipsel/linux-2.6-brcm/kernel.trx \
      /tmp/mj-build/openwrt/build_mipsel/linux-2.6-brcm/loader.tmp.gz \
      /tmp/mj-build/openwrt/build_mipsel/linux-2.6-brcm/vmlinux.lzma
  • Put loader and TRX image into resulting (bootable) kernel image
$ dd if=/tmp/mj-build/openwrt/build_mipsel/loader.elf of=/tmp/mj-build/openwrt/bin/bootable-kernel-image.bin bs=131072 conv=sync
$ cat /tmp/mj-build/openwrt/build_mipsel/linux-2.6-brcm/kernel.trx >> /tmp/mj-build/openwrt/bin/bootable-kernel-image.bin

RootFS


Prev | Contents