[PATCH 3/3] ramips: image: example usage of OKLI loader

Chuanhong Guo gch981213 at gmail.com
Wed Sep 2 02:22:31 EDT 2020


This is an example of using OKLI loader and will not be part of final
commits.
First uImage header covers loader + kernel so that the original firmware
mtdsplit can be used.
---
 target/linux/ramips/image/Makefile  | 10 ++++++++++
 target/linux/ramips/image/mt7620.mk |  1 +
 target/linux/ramips/image/mt7621.mk |  2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index 10e9edd3bb..b985882897 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -224,6 +224,16 @@ define Device/uimage-lzma-loader
   KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
 endef
 
+define Device/uimage-okli-loader
+  LOADER_TYPE := bin
+  LOADER_FLASH_OFFS := 0x51000
+  COMPILE := loader-$(1).bin
+  COMPILE/loader-$(1).bin := loader-okli-compile
+  KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
+  IMAGE/sysupgrade.bin := append-loader-okli $(1) | pad-to 16k | lzma | pad-to 4032 | append-kernel | uImage lzma | append-rootfs | pad-rootfs | append-metadata | check-size
+endef
+
 include $(SUBTARGET).mk
 
 $(eval $(call BuildImage))
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 0cfaa95cf0..fa8c303903 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -599,6 +599,7 @@ endef
 TARGET_DEVICES += lb-link_bl-w1200
 
 define Device/lenovo_newifi-y1
+  $(Device/uimage-okli-loader)
   SOC := mt7620a
   IMAGE_SIZE := 16064k
   DEVICE_VENDOR := Lenovo
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index d2d41be269..a15d7e25af 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -614,7 +614,7 @@ TARGET_DEVICES += jcg_jhr-ac876m
 
 define Device/lenovo_newifi-d1
   $(Device/dsa-migration)
-  $(Device/uimage-lzma-loader)
+  $(Device/uimage-okli-loader)
   IMAGE_SIZE := 32448k
   DEVICE_VENDOR := Newifi
   DEVICE_MODEL := D1
-- 
2.26.2




More information about the openwrt-devel mailing list