layerscape: add u-boot environment support for OpenWrt boot
authorYangbo Lu <yangbo.lu@nxp.com>
Tue, 17 Jul 2018 09:42:47 +0000 (17:42 +0800)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 22 Sep 2018 19:20:56 +0000 (21:20 +0200)
This patch is to implement u-boot environment txt files
to support OpenWrt boot for all layerscape devices.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
package/boot/uboot-layerscape-armv8_32b/Makefile
package/boot/uboot-layerscape/Makefile
package/boot/uboot-layerscape/files/ls1012afrdm-uEnv.txt [new file with mode: 0644]
package/boot/uboot-layerscape/files/ls1012ardb-uEnv.txt [new file with mode: 0644]
package/boot/uboot-layerscape/files/ls1043ardb-uEnv.txt [new file with mode: 0644]
package/boot/uboot-layerscape/files/ls1046ardb-uEnv.txt [new file with mode: 0644]
package/boot/uboot-layerscape/files/ls1088ardb-uEnv.txt [new file with mode: 0644]
package/boot/uboot-layerscape/files/ls2088ardb-uEnv.txt [new file with mode: 0644]
target/linux/layerscape/image/Makefile

index 415d9bdbea685e084c1415d3bd9646851607801e..b9cec52174ac8f4b236d8a4fe97949a222da3bf5 100644 (file)
@@ -29,27 +29,32 @@ define Package/uboot-layerscape-armv8_32b/Config
     TITLE:=$(2)
     DEPENDS:=@TARGET_layerscape_armv8_32b
     CONFIG:=$(3)
+    ENV_SIZE:=$(4)
   endef
 endef
 
 define Package/uboot-layerscape-armv8_32b/ls1012ardb
   TITLE:=U-Boot image for NXP LS1012ARDB
   CONFIG:=ls1012ardb-uboot.bin
+  ENV_SIZE:=0x40000
 endef
 
 define Package/uboot-layerscape-armv8_32b/ls1012afrdm
   TITLE:=U-Boot image for NXP LS1012FRDM
   CONFIG:=ls1012afrdm-uboot.bin
+  ENV_SIZE:=0x40000
 endef
 
 define Package/uboot-layerscape-armv8_32b/ls1043ardb
   TITLE:=U-Boot image for NXP LS1043ARDB
   CONFIG:=ls1043ardb-uboot.bin
+  ENV_SIZE:=0x20000
 endef
 
 define Package/uboot-layerscape-armv8_32b/ls1046ardb
   TITLE:=U-Boot image for NXP LS1046ARDB
   CONFIG:=ls1046ardb-uboot.bin
+  ENV_SIZE:=0x2000
 endef
 
 define Build/Compile
@@ -59,6 +64,9 @@ define Package/uboot-layerscape-armv8_32b/Install
   define Package/u-boot-$(1)-image/install
        $(INSTALL_DIR) $(STAGING_DIR_IMAGE)
        $(CP) $(PKG_BUILD_DIR)/$(CONFIG) $(STAGING_DIR_IMAGE)/
+       $(PKG_BUILD_DIR)/tools/mkenvimage -s $(ENV_SIZE) \
+               -o $(STAGING_DIR_IMAGE)/$(1)-uboot-env.bin \
+               ../uboot-layerscape/files/$(1)-uEnv.txt
   endef
 endef
 
@@ -70,7 +78,7 @@ UBOOTS := \
 
 $(foreach u,$(UBOOTS), \
        $(eval $(Package/uboot-layerscape-armv8_32b/$(u))) \
-       $(eval $(call Package/uboot-layerscape-armv8_32b/Config,$(u),$(TITLE),$(CONFIG))) \
+       $(eval $(call Package/uboot-layerscape-armv8_32b/Config,$(u),$(TITLE),$(CONFIG),$(ENV_SIZE))) \
        $(eval $(call Package/uboot-layerscape-armv8_32b/Install,$(u))) \
        $(eval $(call BuildPackage,u-boot-$(u)-image)) \
 )
index 9e4079e38614fb7c3bc5002de1a2c26fdec1aed3..ffa392cd6e6b3834d8612735ace2f4b3532ac7f1 100644 (file)
@@ -24,20 +24,24 @@ define U-Boot/Default
   BUILD_SUBTARGET:=armv8_64b
   BUILD_DEVICES:=$(1)
   UBOOT_IMAGE:=u-boot-dtb.bin
+  ENV_SIZE:=0x2000
 endef
 
 define U-Boot/ls1012ardb
   NAME:=NXP LS1012ARDB
   UBOOT_CONFIG:=ls1012ardb_qspi
+  ENV_SIZE:=0x40000
 endef
 
 define U-Boot/ls1012afrdm
   NAME:=NXP LS1012AFRDM
   UBOOT_CONFIG:=ls1012afrdm_qspi
+  ENV_SIZE:=0x40000
 endef
 
 define U-Boot/ls1043ardb
   NAME:=NXP LS1043ARDB
+  ENV_SIZE:=0x20000
 endef
 
 define U-Boot/ls1046ardb
@@ -67,6 +71,9 @@ define Build/InstallDev
        $(INSTALL_DIR) $(STAGING_DIR_IMAGE)
        $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) \
                $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-uboot.bin
+       $(PKG_BUILD_DIR)/tools/mkenvimage -s $(ENV_SIZE) \
+               -o $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-uboot-env.bin \
+               files/$(BUILD_VARIANT)-uEnv.txt
 endef
 
 define Package/u-boot/install/default
diff --git a/package/boot/uboot-layerscape/files/ls1012afrdm-uEnv.txt b/package/boot/uboot-layerscape/files/ls1012afrdm-uEnv.txt
new file mode 100644 (file)
index 0000000..32419dd
--- /dev/null
@@ -0,0 +1,8 @@
+fdtaddr=0x8f000000
+loadaddr=0x81000000
+fdt_high=0xffffffffffffffff
+initrd_high=0xffffffffffffffff
+qspi_boot=sf probe 0:0;sf read $fdtaddr f00000 100000;sf read $loadaddr 1000000 1000000;bootm $loadaddr - $fdtaddr
+bootargs=ubi.mtd=9 root=ubi0:rootfs rw rootfstype=ubifs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=1550000.quadspi:1m(rcw),2m(u-boot),1m(u-boot-env),2m(ppa),4m(reserved-1),3m(pfe),2m(reserved-2),1m(dtb),16m(kernel),32m(ubifs)
+bootcmd=echo starting openwrt ...;pfe stop;run qspi_boot
+bootdelay=3
diff --git a/package/boot/uboot-layerscape/files/ls1012ardb-uEnv.txt b/package/boot/uboot-layerscape/files/ls1012ardb-uEnv.txt
new file mode 100644 (file)
index 0000000..32419dd
--- /dev/null
@@ -0,0 +1,8 @@
+fdtaddr=0x8f000000
+loadaddr=0x81000000
+fdt_high=0xffffffffffffffff
+initrd_high=0xffffffffffffffff
+qspi_boot=sf probe 0:0;sf read $fdtaddr f00000 100000;sf read $loadaddr 1000000 1000000;bootm $loadaddr - $fdtaddr
+bootargs=ubi.mtd=9 root=ubi0:rootfs rw rootfstype=ubifs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=1550000.quadspi:1m(rcw),2m(u-boot),1m(u-boot-env),2m(ppa),4m(reserved-1),3m(pfe),2m(reserved-2),1m(dtb),16m(kernel),32m(ubifs)
+bootcmd=echo starting openwrt ...;pfe stop;run qspi_boot
+bootdelay=3
diff --git a/package/boot/uboot-layerscape/files/ls1043ardb-uEnv.txt b/package/boot/uboot-layerscape/files/ls1043ardb-uEnv.txt
new file mode 100644 (file)
index 0000000..c78bfe0
--- /dev/null
@@ -0,0 +1,9 @@
+fdtaddr=0x8f000000
+loadaddr=0x81000000
+fdt_high=0xffffffffffffffff
+initrd_high=0xffffffffffffffff
+hwconfig=fsl_ddr:bank_intlv=auto
+nor_boot=cp.b 60f00000 $fdtaddr 100000;cp.b 61000000 $loadaddr 1000000;bootm $loadaddr - $fdtaddr
+bootargs=root=/dev/mtdblock9 rootfstype=squashfs,jffs2 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=60000000.nor:1m(rcw),2m(u-boot),1m(u-boot-env),2m(ppa),3m(reserved-1),256k(fman),5888k(reserved-2),1m(dtb),16m(kernel),32m(rootfs)
+bootcmd=echo starting openwrt ...;run nor_boot
+bootdelay=3
diff --git a/package/boot/uboot-layerscape/files/ls1046ardb-uEnv.txt b/package/boot/uboot-layerscape/files/ls1046ardb-uEnv.txt
new file mode 100644 (file)
index 0000000..fecb8fd
--- /dev/null
@@ -0,0 +1,9 @@
+fdtaddr=0x8f000000
+loadaddr=0x81000000
+fdt_high=0xffffffffffffffff
+initrd_high=0xffffffffffffffff
+hwconfig=fsl_ddr:bank_intlv=auto
+qspi_boot=sf probe 0:0;sf read $fdtaddr f00000 100000;sf read $loadaddr 1000000 1000000;bootm $loadaddr - $fdtaddr
+bootargs=ubi.mtd=10 root=ubi0:rootfs rw rootfstype=ubifs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=1550000.quadspi:1m(rcw),2m(u-boot),1m(u-boot-env),2m(ppa),3m(reserved-1),256k(fman),5888k(reserved-2),1m(dtb),16m(kernel),32m(ubifs)
+bootcmd=echo starting openwrt ...;run qspi_boot
+bootdelay=3
diff --git a/package/boot/uboot-layerscape/files/ls1088ardb-uEnv.txt b/package/boot/uboot-layerscape/files/ls1088ardb-uEnv.txt
new file mode 100644 (file)
index 0000000..1bcd701
--- /dev/null
@@ -0,0 +1,10 @@
+fdtaddr=0x8f000000
+loadaddr=0x81000000
+fdt_high=0xa0000000
+initrd_high=0xffffffffffffffff
+hwconfig=fsl_ddr:bank_intlv=auto
+mc_init=sf probe 0:0;sf read 80000000 a00000 300000;sf read 80300000 e00000 100000;fsl_mc start mc 80000000 80300000;sf read 80400000 d00000 100000;fsl_mc apply dpl 80400000
+qspi_boot=sf probe 0:0;sf read $fdtaddr f00000 100000;sf read $loadaddr 1000000 1000000;bootm $loadaddr - $fdtaddr
+bootargs=ubi.mtd=11 root=ubi0:rootfs rw rootfstype=ubifs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=20c0000.quadspi:1m(rcw),2m(u-boot),1m(u-boot-env),2m(ppa),4m(reserved-1),3m(mc),1m(dpl),1m(dpc),1m(dtb),16m(kernel),32m(ubifs)
+bootcmd=echo starting openwrt ...;run mc_init;run qspi_boot
+bootdelay=3
diff --git a/package/boot/uboot-layerscape/files/ls2088ardb-uEnv.txt b/package/boot/uboot-layerscape/files/ls2088ardb-uEnv.txt
new file mode 100644 (file)
index 0000000..f3b6725
--- /dev/null
@@ -0,0 +1,10 @@
+fdtaddr=0x8f000000
+loadaddr=0x81000000
+fdt_high=0xa0000000
+initrd_high=0xffffffffffffffff
+hwconfig=fsl_ddr:bank_intlv=auto
+mc_init=fsl_mc start mc 580a00000 580e00000;fsl_mc apply dpl 580d00000
+nor_boot=cp.b 580f00000 $fdtaddr 100000;cp.b 581000000 $loadaddr 1000000;bootm $loadaddr - $fdtaddr
+bootargs=root=/dev/mtdblock10 rootfstype=squashfs,jffs2 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS1,115200 mtdparts=580000000.nor:1m(rcw),2m(u-boot),1m(u-boot-env),2m(ppa),4m(reserved-1),3m(mc),1m(dpl),1m(dpc),1m(dtb),16m(kernel),32m(rootfs)
+bootcmd=echo starting openwrt ...;run mc_init;run nor_boot
+bootdelay=3
index 8e85f768480c41734f19098368182c87ccf86f0c..be091318ab4223f8a4c065e080bac76d0acb7af4 100644 (file)
@@ -18,6 +18,10 @@ define Build/append-ls-uboot
        dd if=$(STAGING_DIR_IMAGE)/$(1)-uboot.bin >> $@
 endef
 
+define Build/append-ls-uboot-env
+       dd if=$(STAGING_DIR_IMAGE)/$(1)-uboot-env.bin >> $@
+endef
+
 define Build/append-ls-ppa
        dd if=$(STAGING_DIR_IMAGE)/$(1)-ppa.itb >> $@
 endef
@@ -86,7 +90,8 @@ define Device/ls1043ardb
   endif
   DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1043a-rdb-sdk
   IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
-                       append-ls-uboot $(1) | pad-to 4M | \
+                       append-ls-uboot $(1) | pad-to 3M | \
+                       append-ls-uboot-env $(1) | pad-to 4M | \
                        append-ls-ppa $(1) | pad-to 9M | \
                        append-ls-fman $(1) | pad-to 15M | \
                        append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
@@ -109,7 +114,8 @@ define Device/ls1046ardb
   BLOCKSIZE := 256KiB
   PAGESIZE := 1
   IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
-                       append-ls-uboot $(1) | pad-to 4M | \
+                       append-ls-uboot $(1) | pad-to 3M | \
+                       append-ls-uboot-env $(1) | pad-to 4M | \
                        append-ls-ppa $(1) | pad-to 9M | \
                        append-ls-fman $(1) | pad-to 15M | \
                        append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
@@ -132,7 +138,8 @@ define Device/ls1012ardb
   BLOCKSIZE := 256KiB
   PAGESIZE := 1
   IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
-                       append-ls-uboot $(1) | pad-to 4M | \
+                       append-ls-uboot $(1) | pad-to 3M | \
+                       append-ls-uboot-env $(1) | pad-to 4M | \
                        append-ls-ppa $(1) | pad-to 10M | \
                        append-ls-ppfe | pad-to 15M | \
                        append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
@@ -155,7 +162,8 @@ define Device/ls1012afrdm
   BLOCKSIZE := 256KiB
   PAGESIZE := 1
   IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
-                       append-ls-uboot $(1) | pad-to 4M | \
+                       append-ls-uboot $(1) | pad-to 3M | \
+                       append-ls-uboot-env $(1) | pad-to 4M | \
                        append-ls-ppa $(1) | pad-to 10M | \
                        append-ls-ppfe | pad-to 15M | \
                        append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
@@ -177,7 +185,8 @@ define Device/ls1088ardb
   BLOCKSIZE := 256KiB
   PAGESIZE := 1
   IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
-                       append-ls-uboot $(1) | pad-to 4M | \
+                       append-ls-uboot $(1) | pad-to 3M | \
+                       append-ls-uboot-env $(1) | pad-to 4M | \
                        append-ls-ppa $(1) | pad-to 10M | \
                        append-ls-mc $(1) | pad-to 13M | \
                        append-ls-dpl $(1) | pad-to 14M | \
@@ -195,7 +204,8 @@ define Device/ls2088ardb
                        layerscape-ppa-ls2088ardb
   DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls2088a-rdb
   IMAGE/firmware.bin = append-ls-rcw $(1) | pad-to 1M | \
-                       append-ls-uboot $(1) | pad-to 4M | \
+                       append-ls-uboot $(1) | pad-to 3M | \
+                       append-ls-uboot-env $(1) | pad-to 4M | \
                        append-ls-ppa $(1) | pad-to 10M | \
                        append-ls-mc $(1) | pad-to 13M | \
                        append-ls-dpl $(1) | pad-to 14M | \