summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2015-03-25 15:34:40 +0000
committerJonas Gorski <jogo@openwrt.org>2015-03-25 15:34:40 +0000
commitd84fafb9f34be7f92b01938acafcc828d9f00478 (patch)
treec5baca1b1a43d65e12276ac1a24d5eec8370bb49 /target/linux
parent77e3d442b0a246a953706ed34f257c3c07ade12a (diff)
downloadmtk-20170518-d84fafb9f34be7f92b01938acafcc828d9f00478.zip
mtk-20170518-d84fafb9f34be7f92b01938acafcc828d9f00478.tar.gz
mtk-20170518-d84fafb9f34be7f92b01938acafcc828d9f00478.tar.bz2
brcm63xx: add Livebox 1 firmware image generation
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 <dgcbueu@gmail.com> [jogo: use sed instead of a separate shell script for the boot script, make it respect the load address] Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 44982
Diffstat (limited to 'target/linux')
-rwxr-xr-xtarget/linux/brcm63xx/image/Makefile28
-rw-r--r--target/linux/brcm63xx/image/redbootscript.template15
2 files changed, 40 insertions, 3 deletions
diff --git a/target/linux/brcm63xx/image/Makefile b/target/linux/brcm63xx/image/Makefile
index a2130f3..1913feb 100755
--- a/target/linux/brcm63xx/image/Makefile
+++ b/target/linux/brcm63xx/image/Makefile
@@ -86,11 +86,33 @@ define Image/Build/ZYXCFEDTB
endef
define Image/Build/RedBootDTB
- # Generate the image
+ # Prepare kernel and rootfs
gzip -9 -c $(KDIR)/vmlinux-$(3) > $(KDIR)/vmlinux-$(3).bin.gz
- $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux-$(3) $(KDIR)/vmlinux-$(3).bin.l7
- dd if=$(KDIR)/vmlinux-$(3).bin.l7 of=$(BIN_DIR)/openwrt-$(2)-vmlinux.lzma bs=65536 conv=sync
dd if=$(KDIR)/vmlinux-$(3).bin.gz of=$(BIN_DIR)/openwrt-$(2)-vmlinux.gz bs=65536 conv=sync
+ dd if=$(KDIR)/root.squashfs of="$(BIN_DIR)/openwrt-$(2)-root.squashfs" bs=64k conv=sync
+ echo -ne \\xDE\\xAD\\xC0\\xDE >> "$(BIN_DIR)/openwrt-$(2)-root.squashfs"
+ # Generate the scripted image
+ $(CP) ./redbootscript.template $(BIN_DIR)/redbootscript
+ let \
+ kernellen="$$$$(stat -c%s $(BIN_DIR)/openwrt-$(2)-vmlinux.gz)" \
+ rootfsdatalen="$$$$(stat -c %s $(BIN_DIR)/openwrt-$(2)-root.squashfs)" \
+ rootfsaddr="0xBE430000 + kernellen" \
+ rootfslen="0xBEBF0000 - rootfsaddr" \
+ offset2="0x1000 + kernellen"; \
+ $(SED) "s,%loadaddr,$(strip $(LOADADDR)),g" \
+ -e "s,%kernellen,$$$$(printf '%#x' $$$$kernellen),g" \
+ -e "s,%offset2,$$$$(printf '%#x' $$$$offset2),g" \
+ -e "s,%rootfsdatalen,$$$$(printf '%#x' $$$$rootfsdatalen),g" \
+ -e "s,%rootfsaddr,$$$$(printf '%#x' $$$$rootfsaddr),g" \
+ -e "s,%rootfslen,$$$$(printf '%#x' $$$$rootfslen),g" \
+ "$(BIN_DIR)/redbootscript"
+
+ dd if="$(BIN_DIR)/redbootscript" of="$(BIN_DIR)/redbootscript.padded" bs=4096 conv=sync
+ cat \
+ "$(BIN_DIR)/redbootscript.padded" \
+ "$(BIN_DIR)/openwrt-$(2)-vmlinux.gz" \
+ "$(BIN_DIR)/openwrt-$(2)-root.squashfs" \
+ > "$(BIN_DIR)/openwrt-$(2)-redboot.bin"
endef
define Image/Build/HCSDTB
diff --git a/target/linux/brcm63xx/image/redbootscript.template b/target/linux/brcm63xx/image/redbootscript.template
new file mode 100644
index 0000000..a007c84
--- /dev/null
+++ b/target/linux/brcm63xx/image/redbootscript.template
@@ -0,0 +1,15 @@
+fis init -f
+
+fconfig boot_script true
+fconfig boot_script_data
+fis load -b %loadaddr -d kernel
+exec -c "noinitrd" %loadaddr
+
+
+fconfig boot_script_timeout 20
+
+fis create -o 0x1000 -f 0xBE430000 -l %kernellen kernel
+
+fis create -o %offset2 -s %rootfsdatalen -f %rootfsaddr -l %rootfslen rootfs
+
+reset