Currently there isn't images ready for flashing liveboxes boards. This patch 
adds a 
script and the code to call it in the  bcm63xx images builder makefile  to 
generate the
livebox 1 firmware.

I removed some lines to avoid generating unneded files in the bin/ dir for this 
board.
And added code to generate a squashed rootfs aligned to 64 kB since the current 
one in the /bin dir is 128 kB aligned and doesn't work. Still no sysupgrade 
support 
for this board. Upgrading from within openwrt can be done writing with mtd the 
kernel, 
and then the 64k aligned rootfs.

Regards

Signed-off-by: Daniel Gonzalez <dgcb...@gmail.com>
Index: target/linux/brcm63xx/image/Makefile
===================================================================
--- target/linux/brcm63xx/image/Makefile        (revision 40555)
+++ target/linux/brcm63xx/image/Makefile        (working copy)
@@ -89,11 +89,15 @@
 endef
 
 define Image/Build/RedBoot
-       cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(1)-vmlinux.elf
        gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
-       $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
-       dd if=$(KDIR)/vmlinux.bin.l7 of=$(BIN_DIR)/openwrt-$(1)-vmlinux.lzma 
bs=65536 conv=sync
        dd if=$(KDIR)/vmlinux.bin.gz of=$(BIN_DIR)/openwrt-$(1)-vmlinux.gz 
bs=65536 conv=sync
+       dd if=$(KDIR)/root.squashfs of="$(BIN_DIR)/openwrt-$(1)-root.squashfs" 
bs=64k conv=sync
+       echo -ne \\xDE\\xAD\\xC0\\xDE >> "$(BIN_DIR)/openwrt-$(1)-root.squashfs"
+       # Generate the scripted image
+       -sh $(TOPDIR)/scripts/livebox1-image.sh \
+               "$(BIN_DIR)/openwrt-$(1)-vmlinux.gz" \
+               "$(BIN_DIR)/openwrt-$(1)-root.squashfs" \
+               "$(BIN_DIR)/openwrt-$(1)-redboot.bin"
 endef
 
 define Image/Build/SPW303V
Index: scripts/livebox1-image.sh
===================================================================
--- scripts/livebox1-image.sh   (revision 0)
+++ scripts/livebox1-image.sh   (working copy)
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# Livebox 1 (bcm6348) scripted image generator for RedBoot.
+#
+# The image consists of three parts:
+#      script : with the commands used by RedBoot for autoflashing: 4096 byes
+#      kernel : aligned to 64 kB
+#      rootfs : aligned to 64 kB with deadc0de appended
+
+[ -f "$1" -a -f "$2" ] || {
+       echo "Usage: $0 <kernel image> <rootfs image> [output file]"
+       exit 1
+}
+
+# Calculate addresses and lenghts of Redboot partitions
+kernlength=`printf "%#x\n" $(stat -c "%s" $1)`
+rootfladdr=`printf '%#x\n' $[0xBE430000+$kernlength]`
+rootlength=`printf '%#x\n' $[0xBEBF0000-$rootfladdr]`
+rootdatalength=`printf "%#x\n" $(stat -c "%s" $2)`
+# Calculate the offset in RAM for rootfs
+offset2=`printf '%#x\n' $[0x1000+$kernlength]`
+
+# Create script image header required by Redboot for auto flashing via tftp
+echo "fis init -f
+
+fconfig boot_script true
+fconfig boot_script_data
+fis load -b 0x80010000 -d kernel
+exec -c \"noinitrd\" 0x80010000
+
+
+fconfig boot_script_timeout 20
+
+fis create -o 0x1000 -f 0xBE430000 -l $kernlength kernel
+
+fis create -o $offset2 -s $rootdatalength -f $rootfladdr -l $rootlength rootfs
+
+reset" > redbootscript.tmp
+
+# pad the script to end in 0x1000 RAM offset where kernel data starts
+dd if=redbootscript.tmp of=redbootscriptpad.tmp bs=4096 conv=sync
+
+# create the image
+cat redbootscriptpad.tmp $1 $2 > $3
+
+# Clean up.
+rm redbootscript.tmp redbootscriptpad.tmp

Property changes on: scripts/livebox1-image.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to