summaryrefslogtreecommitdiff
path: root/target/linux/brcm63xx/image/Makefile
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2014-08-01 21:56:31 +0000
committerJonas Gorski <jogo@openwrt.org>2014-08-01 21:56:31 +0000
commit701e2a38fef4fce862eaeb21fc97874a6387a569 (patch)
treeff25cf2649946ea51b35d435138362c84e8129e7 /target/linux/brcm63xx/image/Makefile
parent21845cb45da7b6da12fe977b38bfa68d4f72d9c1 (diff)
downloadmtk-20170518-701e2a38fef4fce862eaeb21fc97874a6387a569.zip
mtk-20170518-701e2a38fef4fce862eaeb21fc97874a6387a569.tar.gz
mtk-20170518-701e2a38fef4fce862eaeb21fc97874a6387a569.tar.bz2
brcm63xx: add working lzma-loader and use it for initramfs
Add a working lzma loader and use it for generating initramfs kernels to allow easily netbooting elf kernels on devices with a 4 MiB CFE size limit. Based on ar71xx's lzma-loader. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 41940
Diffstat (limited to 'target/linux/brcm63xx/image/Makefile')
-rwxr-xr-xtarget/linux/brcm63xx/image/Makefile31
1 files changed, 21 insertions, 10 deletions
diff --git a/target/linux/brcm63xx/image/Makefile b/target/linux/brcm63xx/image/Makefile
index 781425f..807eebf 100755
--- a/target/linux/brcm63xx/image/Makefile
+++ b/target/linux/brcm63xx/image/Makefile
@@ -143,9 +143,25 @@ define Build/Clean
$(MAKE) -C lzma-loader clean
endef
-define Image/Prepare
+define Image/PrepareLoader
# Standard LZMA kernel
- cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
+ $(STAGING_DIR_HOST)/bin/lzma e -d22 -fb64 -a1 $(KDIR)/vmlinux$(1) $(KDIR)/vmlinux$(1).lzma
+
+ # Build the LZMA loader
+ rm -rf $(KDIR)/lzma-loader
+ $(MAKE) -C lzma-loader \
+ $(LOADER_MAKEOPTS) \
+ BUILD_DIR="$(KDIR)" \
+ TARGET_DIR="$(BIN_DIR)" \
+ LOADER_DATA="$(KDIR)/vmlinux$(1).lzma" \
+ LOADER=$(IMG_PREFIX)-loader$(1).elf \
+ LZMA_TEXT_START=0x80a00000 \
+ compile loader.elf
+
+ rm -f $(KDIR)/vmlinux$(1).lzma
+endef
+
+define Image/Prepare
# CFE is a LZMA nazi! It took me hours to find out the parameters!
# Also I think lzma has a bug cause it generates different output depending on
@@ -158,14 +174,9 @@ define Image/Prepare
dd if=$(KDIR)/vmlinux.lzma.tmp of=$(KDIR)/vmlinux.lzma.cfe ibs=13 obs=5 skip=1 seek=1 conv=notrunc
rm -f $(KDIR)/vmlinux.lzma.tmp
- # Build the LZMA loader
- rm -f $(KDIR)/loader.gz
- $(MAKE) -C lzma-loader \
- BUILD_DIR="$(KDIR)" \
- TARGET="$(KDIR)" \
- clean install
-
- echo -ne "\\x00" >> $(KDIR)/loader.gz
+ ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
+ $(call Image/PrepareLoader,-initramfs)
+ endif
rm -f $(KDIR)/fs_mark
touch $(KDIR)/fs_mark
$(call prepare_generic_squashfs,$(KDIR)/fs_mark)