[openwrt/openwrt] mvebu: Add turris-omnia.bootscript

LEDE Commits lede-commits at lists.infradead.org
Fri Dec 4 11:57:48 EST 2020


adrian pushed a commit to openwrt/openwrt.git, branch openwrt-19.07:
https://git.openwrt.org/ca1ee3985430a111dd921002dd789ed321a7c41e

commit ca1ee3985430a111dd921002dd789ed321a7c41e
Author: Klaus Kudielka <klaus.kudielka at gmail.com>
AuthorDate: Mon Dec 23 08:34:49 2019 +0100

    mvebu: Add turris-omnia.bootscript
    
    In contrast to the U-Boot version shipped with older versions of Turris
    Omnia (CZ11NIC13, CZ11NIC20), the version shipped with Turris Omnia 2019
    (CZ11NIC23) relies on the existence of /boot.scr.
    
    Consequently, add a suitable boot script to the sysupgrade image.
    
    Flash instructions for Turris Omnia 2019:
    - Download openwrt-...-sysupgrade.img.gz, gunzip it, and copy the resulting
      .img file to the root of a USB flash drive (FAT32 or ext2/3/4).
    - Enter a rescue shell: Either via 5-LED reset and ssh root at 192.168.1.1
      on LAN port 4, or via 7-LED reset and the serial console.
    - Insert the USB drive and mount it:
      mkdir /mnt; mount /dev/sda1 /mnt
    - Flash the OpenWrt image to eMMC:
      dd if=/mnt/openwrt-...-sysupgrade.img of=/dev/mmcblk0 bs=4096 conv=fsync
    - Reboot.
    
    Flash instructions using a temporary "medkit" installation were written for
    the older versions of Turris Omnia, and will *not* work on the Turris Omnia
    2019.
    
    Signed-off-by: Klaus Kudielka <klaus.kudielka at gmail.com>
    Reviewed-by: Tomasz Maciej Nowak <tomek_n at o2.pl>
    Tested-by: W. Michael Petullo <mike at flyn.org> (Turris Omnia "2020")
    (cherry picked from commit afd4375a33840fa949c898fb6bc603e8645edd61)
---
 target/linux/mvebu/image/cortex-a9.mk            |  3 ++-
 target/linux/mvebu/image/turris-omnia.bootscript | 17 +++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/target/linux/mvebu/image/cortex-a9.mk b/target/linux/mvebu/image/cortex-a9.mk
index 17d950d595..0e0bbcac45 100644
--- a/target/linux/mvebu/image/cortex-a9.mk
+++ b/target/linux/mvebu/image/cortex-a9.mk
@@ -175,11 +175,12 @@ define Device/cznic_turris-omnia
     wpad-basic kmod-ath9k kmod-ath10k-ct ath10k-firmware-qca988x-ct \
     partx-utils kmod-i2c-core kmod-i2c-mux kmod-i2c-mux-pca954x
   IMAGES := $$(IMAGE_PREFIX)-sysupgrade.img.gz omnia-medkit-$$(IMAGE_PREFIX)-initramfs.tar.gz
-  IMAGE/$$(IMAGE_PREFIX)-sysupgrade.img.gz := boot-img | sdcard-img | gzip | append-metadata
+  IMAGE/$$(IMAGE_PREFIX)-sysupgrade.img.gz := boot-scr | boot-img | sdcard-img | gzip | append-metadata
   IMAGE/omnia-medkit-$$(IMAGE_PREFIX)-initramfs.tar.gz := omnia-medkit-initramfs | gzip
   IMAGE_NAME = $$(2)
   DEVICE_DTS := armada-385-turris-omnia
   SUPPORTED_DEVICES += armada-385-turris-omnia
+  BOOT_SCRIPT := turris-omnia
 endef
 TARGET_DEVICES += cznic_turris-omnia
 
diff --git a/target/linux/mvebu/image/turris-omnia.bootscript b/target/linux/mvebu/image/turris-omnia.bootscript
new file mode 100644
index 0000000000..fcec5fc1b8
--- /dev/null
+++ b/target/linux/mvebu/image/turris-omnia.bootscript
@@ -0,0 +1,17 @@
+# Determine root device
+setexpr rootpart ${distro_bootpart} + 1
+if test ${devtype} = mmc -a ${devnum} = 0; then
+	setenv rootdev /dev/mmcblk0p${rootpart}
+elif test ${devtype} = scsi -a ${devnum} = 0; then
+	setenv rootdev /dev/sda${rootpart}
+else
+	# New U-Boot only
+	part uuid ${devtype} ${devnum}:${rootpart} uuid
+	setenv rootdev PARTUUID=${uuid}
+fi
+setenv bootargs earlyprintk console=ttyS0,115200 root=${rootdev} rootfstype=auto rootwait
+
+# Load and boot
+load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} @DTB at .dtb
+load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} zImage
+bootz ${kernel_addr_r} - ${fdt_addr_r}



More information about the lede-commits mailing list