Carl-Daniel Hailfinger wrote: > Ronald G Minnich wrote: > > Jordan Crouse wrote: > > > > > So if its cool with everybody, I'll put this patch into my local > > > patch set, and await the LinuxBIOS patch with great anticipation. > > > > yes. buildrom works now. we'll work with the lzma mods but not release > > until it is solid. > > Updated patch attached. This patch will build a lzma compressed ELF > payload while still leaving the existing build unmodified. It will give > you an estimate of how much more you can cram into the kernel and initrd > before space runs out. > > That only leaves the LinuxBIOS patch to be done.
I noticed that switching to nrv2b compression alone will save >20 kb. And nrv2b is already supported by LinuxBIOS. If you apply the attached patch and change line 7 in work/linuxbios/LinuxBIOSv2/targets/olpc/rev_a/Config.1M.lb to option CONFIG_COMPRESSED_ROM_STREAM=1 you _should_ get a working ROM. Can someone please test this, preferably not on the builtin flash (in case it doesn't boot)? Regards, Carl-Daniel -- Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit! "Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl
diff --git a/Config.mk b/Config.mk index 854d933..b6bcdc9 100644 --- a/Config.mk +++ b/Config.mk @@ -26,6 +26,9 @@ # Say 'y' here to build uclibc as a shar # win if you selected more then one of the above) UCLIBC_DYNAMIC=y +# say 'y' here to build a full rom image with lzma compression +LZMA_PACKAGE=y + # say 'y' here to build a full rom image (minus the vsa) LINUXBIOS_PACKAGE=y @@ -59,6 +62,10 @@ ifeq ($(INITRD_KEXEC_TOOLS),y) INITRD_PACKAGES += kexec-tools endif +ifeq ($(LZMA_PACKAGE), y) +TARGETS += lzma +endif + ifeq ($(LINUXBIOS_PACKAGE), y) TARGETS += linuxbios endif diff --git a/Makefile b/Makefile index 13c11e7..38c4887 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,10 @@ include Vars.mk PKGLIST=uclibc kernel $(INITRD_PACKAGES) +ifeq ($(LZMA_PACKAGE),y) +PKGLIST += lzma +endif + ifeq ($(LINUXBIOS_PACKAGE),y) PKGLIST += linuxbios endif @@ -13,10 +17,11 @@ PKG_distclean=$(patsubst %, %-distclean, all: $(TARGETS) -payload: $(OUTPUT_DIR)/olpc-payload.elf +payload: $(OUTPUT_DIR)/olpc-payload.elf $(OUTPUT_DIR)/olpc-payload-uncompressed.elf.lzma $(OUTPUT_DIR)/olpc-payload-uncompressed.elf.nrv2b initrd: $(OUTPUT_DIR)/initrd +initrd.uncompressed: $(OUTPUT_DIR)/initrd.uncompressed -$(OUTPUT_DIR)/initrd: uclibc $(INITRD_PACKAGES) +$(OUTPUT_DIR)/initrd.uncompressed: uclibc $(INITRD_PACKAGES) @ cp -af $(SKELETON_DIR)/* $(INITRD_DIR) @ chmod 0755 $(INITRD_DIR)/linuxrc @@ -28,7 +33,10 @@ initrd: $(OUTPUT_DIR)/initrd @ echo "Building the initrd..." @ install -d $(OUTPUT_DIR) - @ cd $(INITRD_DIR); find . | cpio -o -H newc 2> /dev/null | gzip -9 > $@ + @ cd $(INITRD_DIR); find . | cpio -o -H newc 2> /dev/null > $@ + +$(OUTPUT_DIR)/initrd: initrd.uncompressed + @ gzip -9 -c -n $(OUTPUT_DIR)/initrd.uncompressed > $@ # Note that we refuse to continue if the ELF image is too big @@ -44,6 +52,32 @@ # Note that we refuse to continue if the if [ $$delta -lt 0 ]; then echo "ERROR! ERROR! ERROR!"; \ echo "The ELF image $@ is too big!"; exit -1; fi) +$(OUTPUT_DIR)/olpc-payload-uncompressed.elf: kernel initrd.uncompressed mkelfimage + @ echo "Building the uncompressed ELF payload..." + @ rm -f $@ + @ $(STAGING_DIR)/sbin/mkelfImage --command-line="$(COMMAND_LINE)" \ + --ramdisk=$(OUTPUT_DIR)/initrd.uncompressed $(OUTPUT_DIR)/vmlinux $@ + @ chmod 0644 $@ + +$(OUTPUT_DIR)/olpc-payload-uncompressed.elf.lzma: $(OUTPUT_DIR)/olpc-payload-uncompressed.elf $(STAGING_DIR)/bin/lzma + @ echo "Compressing the uncompressed ELF payload with lzma..." + @ $(STAGING_DIR)/bin/lzma e $(OUTPUT_DIR)/olpc-payload-uncompressed.elf 2>/dev/null $@ + @ ( size=`du -b $@ | cut -f1`; \ + delta=`expr 884736 - $$size`; \ + echo "Bytes left in ROM: $$delta"; \ + if [ $$delta -lt 0 ]; then echo "ERROR! ERROR! ERROR!"; \ + echo "The ELF image $@ is too big!"; exit -1; fi) + +$(OUTPUT_DIR)/olpc-payload-uncompressed.elf.nrv2b: $(OUTPUT_DIR)/olpc-payload-uncompressed.elf $(STAGING_DIR)/bin/nrv2b + @ echo "Compressing the uncompressed ELF payload with nrv2b..." + @ $(STAGING_DIR)/bin/nrv2b e $(OUTPUT_DIR)/olpc-payload-uncompressed.elf 2>/dev/null $@ + @ chmod 0644 $@ + @ ( size=`du -b $@ | cut -f1`; \ + delta=`expr 884736 - $$size`; \ + echo "Bytes left in ROM: $$delta"; \ + if [ $$delta -lt 0 ]; then echo "ERROR! ERROR! ERROR!"; \ + echo "The ELF image $@ is too big!"; exit -1; fi) + clean: $(PKG_clean) @ rm -rf $(INITRD_DIR) $(OUTPUT_DIR) diff --git a/packages/kernel/kernel.mk b/packages/kernel/kernel.mk index bb64419..73ed469 100644 --- a/packages/kernel/kernel.mk +++ b/packages/kernel/kernel.mk @@ -33,10 +33,14 @@ endif @ install -d $(OUTPUT_DIR) @ install -m 0644 $< $@ +$(OUTPUT_DIR)/vmlinux: $(KERNEL_SRC_DIR)/vmlinux + @ install -d $(OUTPUT_DIR) + @ install -m 0644 $< $@ + $(KERNEL_STAMP_DIR) $(KERNEL_LOG_DIR): @ mkdir -p $@ -kernel: $(KERNEL_STAMP_DIR) $(KERNEL_LOG_DIR) $(OUTPUT_DIR)/bzImage +kernel: $(KERNEL_STAMP_DIR) $(KERNEL_LOG_DIR) $(OUTPUT_DIR)/bzImage $(OUTPUT_DIR)/vmlinux kernel-clean: @ echo "Cleaning kernel..." diff --git a/packages/linuxbios/linuxbios.mk b/packages/linuxbios/linuxbios.mk index ce9081d..a035408 100644 --- a/packages/linuxbios/linuxbios.mk +++ b/packages/linuxbios/linuxbios.mk @@ -44,8 +44,17 @@ endif @ touch $@ # fix me sooner or later! -/tmp/olpcpayload.elf: $(OUTPUT_DIR)/olpc-payload.elf - @ cp $(OUTPUT_DIR)/olpc-payload.elf /tmp/olpcpayload.elf +/tmp/olpcpayload.elf: $(OUTPUT_DIR)/olpc-payload-uncompressed.elf.nrv2b + @ cp $(OUTPUT_DIR)/olpc-payload-uncompressed.elf.nrv2b /tmp/olpcpayload.elf + +# FIXME: we want local CFLAGS etc. +$(LINUXBIOS_SRC_DIR)/util/nrv2b/nrv2b: $(LINUXBIOS_STAMP_DIR)/.unpacked_$(LINUXBIOS_VER) + @ echo "Building nrv2b..." + @ make -C $(LINUXBIOS_SRC_DIR)/util/nrv2b > $(LINUXBIOS_BUILD_LOG) 2>&1 + +$(STAGING_DIR)/bin/nrv2b: $(LINUXBIOS_SRC_DIR)/util/nrv2b/nrv2b + @ install -d $(STAGING_DIR)/bin + @ install -m 0755 $< $@ $(LINUXBIOS_STAMP_DIR)/.configured: $(LINUXBIOS_STAMP_DIR)/.unpacked_$(LINUXBIOS_VER) @( cd $(LINUXBIOS_TARGET_DIR); \ diff --git a/packages/lzma/lzma.mk b/packages/lzma/lzma.mk new file mode 100644 index 0000000..c5f0c5f --- /dev/null +++ b/packages/lzma/lzma.mk @@ -0,0 +1,46 @@ +LZMA_URL=http://switch.dl.sourceforge.net/sourceforge/sevenzip +LZMA_SOURCE=lzma443.tar.bz2 +LZMA_DIR=$(BUILD_DIR)/lzma +LZMA_SRC_DIR=$(LZMA_DIR)/lzma-443 +LZMA_STAMP_DIR=$(LZMA_DIR)/stamps +LZMA_LOG_DIR=$(LZMA_DIR)/logs + +ifeq ($(VERBOSE),y) +LZMA_BUILD_LOG=/dev/stdout +LZMA_CONFIG_LOG=/dev/stdout +else +LZMA_BUILD_LOG=$(LZMA_LOG_DIR)/build.log +LZMA_CONFIG_LOG=$(LZMA_LOG_DIR)/config.log +endif + +$(SOURCE_DIR)/$(LZMA_SOURCE): + @ mkdir -p $(SOURCE_DIR) + @ wget -P $(SOURCE_DIR) $(LZMA_URL)/$(LZMA_SOURCE) + +$(LZMA_STAMP_DIR)/.unpacked: $(SOURCE_DIR)/$(LZMA_SOURCE) + @ mkdir -p $(LZMA_SRC_DIR) + @ tar -C $(LZMA_SRC_DIR) -jxf $(SOURCE_DIR)/$(LZMA_SOURCE) + @ touch $@ + +$(LZMA_SRC_DIR)/C/7zip/Compress/LZMA_Alone/lzma: $(LZMA_STAMP_DIR)/.unpacked + @ echo "Building lzma..." + @ ( export CC=$(HOST_CC); export CFLAGS=$(HOST_CFLAGS); \ + export LDFLAGS=$(HOST_LDFLAGS); unset LIBS; \ + cd $(LZMA_SRC_DIR)/C/7zip/Compress/LZMA_Alone; \ + $(MAKE) -C $(LZMA_SRC_DIR)/C/7zip/Compress/LZMA_Alone -f makefile.gcc > $(LZMA_BUILD_LOG) 2>&1 ) + +$(STAGING_DIR)/bin/lzma: $(LZMA_SRC_DIR)/C/7zip/Compress/LZMA_Alone/lzma + @ install -d $(STAGING_DIR)/bin + @ install -m 0755 $< $@ + +$(LZMA_STAMP_DIR) $(LZMA_LOG_DIR): + @ mkdir -p $@ + +lzma: $(LZMA_STAMP_DIR) $(LZMA_LOG_DIR) $(STAGING_DIR)/bin/lzma + +lzma-clean: + @ $(MAKE) -C $(LZMA_SRC_DIR) clean > /dev/null 2>&1 + +lzma-distclean: + @ rm -rf $(LZMA_DIR)/* +
_______________________________________________ Devel mailing list [email protected] http://mailman.laptop.org/mailman/listinfo/devel
