From 6b5b7884a8d4ff57eeffd2eb043e4c2bcc313281 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Tue, 9 Mar 2021 23:12:17 +0800 Subject: [PATCH] ath79: domywifi_dw33d: support startup from breed (#6490) Signed-off-by: Chen Minqiang Co-authored-by: Chen Minqiang --- .../ath79/dts/qca9558_domywifi_dw33d.dts | 29 +++++++++++++++++-- target/linux/ath79/image/nand.mk | 29 ++++++++++++++----- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts b/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts index 776e92cee..f5951095f 100644 --- a/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts +++ b/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts @@ -132,6 +132,31 @@ }; partition@50000 { + label = "loader1"; + reg = <0x50000 0x10000>; + }; + + partition@60000 { + compatible = "openwrt,okli"; + label = "firmware"; + reg = <0x60000 0xe20000>; + }; + + partition@e80000 { + label = "loader2"; + reg = <0xe80000 0x10000>; + }; + + partition@e90000 { + label = "unused"; + reg = <0xe90000 0x160000>; + }; + + /* firmware + * oem-rootfs: 0x50000 0xe30000 ->loader1(64k) + kernel + rootfs + * oem-kernel: 0xe80000 0x170000 ->loader2(64k) + */ + partition@1 { label = "oem-firmware"; reg = <0x50000 0xfa0000>; }; @@ -154,12 +179,12 @@ #size-cells = <1>; partition@0 { - label = "kernel"; + label = "nand-kernel"; reg = <0x0 0x500000>; }; partition@500000 { - label = "ubi"; + label = "nand-ubi"; reg = <0x500000 0x5b00000>; }; diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index c7f96eb6d..05f8c2308 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -2,6 +2,17 @@ include ./common-netgear.mk # for netgear-uImage DEVICE_VARS += RAS_ROOTFS_SIZE RAS_BOARD RAS_VERSION +define Build/append-okli-kernel + dd if="$(KDIR)/loader-$(word 1,$(1)).uImage" >> "$@" +endef + +define Build/prepad-okli-kernel + -[ -f "$@" ] && \ + dd if="$(KDIR)/loader-$(word 1,$(1)).uImage" of="$@".tmp bs=64k conv=sync && \ + cat "$@" >>"$@".tmp && \ + mv "$@".tmp "$@" +endef + # attention: only zlib compression is allowed for the boot fs define Build/zyxel-buildkerneljffs rm -rf $(KDIR_TMP)/zyxelnbg6716 @@ -69,15 +80,19 @@ define Device/domywifi_dw33d DEVICE_MODEL := DW33D DEVICE_PACKAGES := kmod-usb2 kmod-usb-storage kmod-usb-ledtrig-usbport \ kmod-ath10k-ct ath10k-firmware-qca988x-ct - KERNEL_SIZE := 5120k - IMAGE_SIZE := 98304k - BLOCKSIZE := 128k - PAGESIZE := 2048 - UBINIZE_OPTS := -E 5 + IMAGE_SIZE := 14464k + BLOCKSIZE := 64k + LOADER_TYPE := bin + LOADER_FLASH_OFFS := 0x60000 + COMPILE := loader-$(1).bin loader-$(1).uImage + COMPILE/loader-$(1).bin := loader-okli-compile + COMPILE/loader-$(1).uImage := append-loader-okli $(1) | pad-to 64k | lzma | uImage lzma + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 IMAGES += factory.bin - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \ + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata | \ check-size + IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \ + prepad-okli-kernel $(1) | pad-to 14528k | append-okli-kernel $(1) endef TARGET_DEVICES += domywifi_dw33d