Hi,

the attached patches change the OLPC build system to use relative payload paths 
instead of using a hardcoded file in /tmp which will sooner or later cause 
security problems. Additionally, a check for config file correctness has been 
added so you can't accidentially generate the wrong payload for a given 
LinuxBIOS config.
I forgot how to invert command return codes in makefiles, so it would be cool 
if somebody could replace the FIXME in the olpc patch with the inverted grep 
command of some lines later.

Please note: The buildrom patch can only be applied upstream after teh 
LinuxBIOS patch has been applied upstream (and the needed svn revision 
obviously also has to be updated).

Regards,
Carl-Daniel

-- 


"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
Index: LinuxBIOSv2/targets/olpc/rev_a/Config.SPI.lb
===================================================================
--- LinuxBIOSv2/targets/olpc/rev_a/Config.SPI.lb	(Revision 2381)
+++ LinuxBIOSv2/targets/olpc/rev_a/Config.SPI.lb	(Arbeitskopie)
@@ -17,7 +17,7 @@
 	option USE_FALLBACK_IMAGE=1
 	option ROM_IMAGE_SIZE=32*1024
 	option LINUXBIOS_EXTRA_VERSION=".0Fallback"
-	payload /tmp/olpcpayload.elf
+	payload ../../../../../../../../deploy/olpc-payload
 end
 
 buildrom ./linuxbios.rom ROM_SIZE  "fallback"
Index: LinuxBIOSv2/targets/olpc/rev_a/Config.1M.lb
===================================================================
--- LinuxBIOSv2/targets/olpc/rev_a/Config.1M.lb	(Revision 2381)
+++ LinuxBIOSv2/targets/olpc/rev_a/Config.1M.lb	(Arbeitskopie)
@@ -17,7 +17,7 @@
 	option USE_FALLBACK_IMAGE=1
 	option ROM_IMAGE_SIZE=32*1024
 	option LINUXBIOS_EXTRA_VERSION=".0Fallback"
-	payload /tmp/olpcpayload.elf
+	payload ../../../../../../../../deploy/olpc-payload
 end
 
 buildrom ./linuxbios.rom ROM_SIZE  "fallback"
diff --git a/Config.mk b/Config.mk
index f77e5cb..345ac6d 100644
--- a/Config.mk
+++ b/Config.mk
@@ -3,7 +3,7 @@ # This is the configuration for the buil
 # Uncomment this to see the output from the package builds
 #VERBOSE=y
 
-LINUXBIOS_CONFIG=Config.SPI.lb
+#LINUXBIOS_CONFIG=Config.SPI.lb
 LINUXBIOS_VER=2378
 
 # Specify the commandline to use with mkelfimage
diff --git a/Makefile b/Makefile
index 9ac9e0c..071d0c4 100644
--- a/Makefile
+++ b/Makefile
@@ -59,9 +59,13 @@ # Note that we refuse to continue if the
 	@ $(STAGING_DIR)/sbin/mkelfImage --command-line="$(COMMAND_LINE)" \
 	--ramdisk=$(OUTPUT_DIR)/initrd $(OUTPUT_DIR)/bzImage $@
 	@ chmod 0644 $@
+	@ echo "Checking whether the LinuxBIOS config supports bzImage ELF payload..."
+	@ #FIXME
 	@ $(BIN_DIR)/checkrom.sh $@
 
 $(OUTPUT_DIR)/olpc-payload.elf.nrv2b: nrv2b $(OUTPUT_DIR)/olpc-payload-uncompressed.elf
+	@ echo "Checking whether the LinuxBIOS config supports nrv2b compressed ELF payload..."
+	@ grep -q '^[[:blank:]]*option[[:blank:]]*CONFIG_PRECOMPRESSED_ROM_STREAM[[:blank:]]*=[[:blank:]]*1' $(LINUXBIOS_TARGET_DIR)/$(LINUXBIOS_CONFIG_NAME)
 	@ echo "Compressing the ELF payload with nrv2b..."
 	@ $(STAGING_DIR)/bin/nrv2b e \
 	$(OUTPUT_DIR)/olpc-payload-uncompressed.elf \
diff --git a/packages/linuxbios/linuxbios.mk b/packages/linuxbios/linuxbios.mk
index 13cd987..1b25206 100644
--- a/packages/linuxbios/linuxbios.mk
+++ b/packages/linuxbios/linuxbios.mk
@@ -47,8 +47,7 @@ endif
 	$(LINUXBIOS_VER) > $(LINUXBIOS_FETCH_LOG) 2>&1
 	@ touch $@
 
-# fix me sooner or later!
-/tmp/olpcpayload.elf: $(PAYLOAD_TARGET)
+$(OUTPUT_DIR)/olpc-payload: $(PAYLOAD_TARGET)
 	@ cp $< $@
 
 $(LINUXBIOS_STAMP_DIR)/.configured: $(LINUXBIOS_STAMP_DIR)/.unpacked_$(LINUXBIOS_VER)
@@ -56,7 +55,7 @@ # fix me sooner or later!
 	./buildtarget $(LINUXBIOS_CONFIG_NAME) > $(LINUXBIOS_CONFIG_LOG) 2>&1)
 	@ touch $@
 
-$(LINUXBIOS_BUILD_DIR)/linuxbios.rom:  $(LINUXBIOS_STAMP_DIR)/.configured /tmp/olpcpayload.elf
+$(LINUXBIOS_BUILD_DIR)/linuxbios.rom:  $(LINUXBIOS_STAMP_DIR)/.configured $(OUTPUT_DIR)/olpc-payload
 	@ echo "Building linuxbios..."
 	@ make -C $(LINUXBIOS_BUILD_DIR) > $(LINUXBIOS_BUILD_LOG) 2>&1
 
-- 
linuxbios mailing list
[email protected]
http://www.openbios.org/mailman/listinfo/linuxbios

Reply via email to