diff --git a/buildroot-external/board/asus/tinker/patches/uboot/0001-Support-HassOS-bootstate-partition.patch b/buildroot-external/board/asus/tinker/patches/uboot/0001-Support-HassOS-bootstate-partition.patch deleted file mode 100644 index 29b0f47cb..000000000 --- a/buildroot-external/board/asus/tinker/patches/uboot/0001-Support-HassOS-bootstate-partition.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 8458beb24f2540fff3c3faed4fa068553b9e474e Mon Sep 17 00:00:00 2001 -From: Pascal Vizeli -Date: Wed, 8 Aug 2018 09:45:07 +0000 -Subject: [PATCH 1/1] Support HassOS bootstate partition - -Signed-off-by: Pascal Vizeli ---- - env/mmc.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/env/mmc.c b/env/mmc.c -index 5e3da6dca75..353f58a12c9 100644 ---- a/env/mmc.c -+++ b/env/mmc.c -@@ -18,6 +18,11 @@ - #include - #include - -+#undef CONFIG_SYS_MMC_ENV_DEV -+#define CONFIG_SYS_MMC_ENV_DEV 1 -+#undef CONFIG_ENV_OFFSET -+#define CONFIG_ENV_OFFSET 0x25100000 -+ - #define __STR(X) #X - #define STR(X) __STR(X) - --- -2.17.1 - diff --git a/buildroot-external/board/asus/tinker/uboot-boot.sh b/buildroot-external/board/asus/tinker/uboot-boot.sh index dc8b0d179..e882f60ff 100644 --- a/buildroot-external/board/asus/tinker/uboot-boot.sh +++ b/buildroot-external/board/asus/tinker/uboot-boot.sh @@ -1,3 +1,17 @@ + +part start mmc ${devnum} 6 mmc_env +mmc dev ${devnum} +setenv loadbootstate " \ + echo 'loading env...'; \ + mmc read ${ramdisk_addr_r} ${mmc_env} 0x40; \ + env import -c ${ramdisk_addr_r} 0x8000;" + +setenv storebootstate " \ + echo 'storing env...'; \ + env export -c -s 0x8000 ${ramdisk_addr_r} BOOT_ORDER BOOT_A_LEFT BOOT_B_LEFT; \ + mmc write ${ramdisk_addr_r} ${mmc_env} 0x40;" + +run loadbootstate test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "A B" test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3 test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3 @@ -10,10 +24,10 @@ setenv bootargs_a "root=PARTUUID=8d3d53e3-6d49-4c38-8349-aff6859e82fd rootfstype setenv bootargs_b "root=PARTUUID=a3ec664e-32ce-4665-95ea-7ae90ce9aa20 rootfstype=squashfs ro" # Load extraargs -fileenv mmc 1:1 ${ramdisk_addr_r} cmdline.txt cmdline +fileenv mmc ${devnum}:1 ${ramdisk_addr_r} cmdline.txt cmdline # Load device tree -fatload mmc 1:1 ${fdt_addr_r} rk3288-tinker.dtb +fatload mmc ${devnum}:1 ${fdt_addr_r} rk3288-tinker.dtb setenv bootargs for BOOT_SLOT in "${BOOT_ORDER}"; do @@ -23,26 +37,26 @@ for BOOT_SLOT in "${BOOT_ORDER}"; do if test ${BOOT_A_LEFT} -gt 0; then setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1 echo "Found valid slot A, ${BOOT_A_LEFT} attempts remaining" - setenv load_kernel "ext4load mmc 1:2 ${kernel_addr_r} zImage" + setenv load_kernel "ext4load mmc ${devnum}:2 ${kernel_addr_r} zImage" setenv bootargs "${bootargs_hassos} ${bootargs_a} rauc.slot=A ${cmdline}" fi elif test "x${BOOT_SLOT}" = "xB"; then if test ${BOOT_B_LEFT} -gt 0; then setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1 echo "Found valid slot B, ${BOOT_B_LEFT} attempts remaining" - setenv load_kernel "ext4load mmc 1:4 ${kernel_addr_r} zImage" + setenv load_kernel "ext4load mmc ${devnum}:4 ${kernel_addr_r} zImage" setenv bootargs "${bootargs_hassos} ${bootargs_b} rauc.slot=B ${cmdline}" fi fi done if test -n "${bootargs}"; then - saveenv + run storebootstate else echo "No valid slot found, resetting tries to 3" setenv BOOT_A_LEFT 3 setenv BOOT_B_LEFT 3 - saveenv + run storebootstate reset fi diff --git a/buildroot-external/board/asus/tinker/uboot.config b/buildroot-external/board/asus/tinker/uboot.config index e2e1ea464..97cc22fbf 100644 --- a/buildroot-external/board/asus/tinker/uboot.config +++ b/buildroot-external/board/asus/tinker/uboot.config @@ -2,5 +2,4 @@ # CONFIG_DOS_PARTITION is not set CONFIG_DM_VIDEO=y CONFIG_CMD_FILEENV=y -CONFIG_ENV_IS_IN_MMC=y -CONFIG_ENV_OFFSET=0x25100000 +CONFIG_ENV_IS_NOWHERE=Y diff --git a/buildroot-external/board/hardkernel/odroid-c2/uboot-boot.sh b/buildroot-external/board/hardkernel/odroid-c2/uboot-boot.sh index 226faca9b..9f00e3b5c 100644 --- a/buildroot-external/board/hardkernel/odroid-c2/uboot-boot.sh +++ b/buildroot-external/board/hardkernel/odroid-c2/uboot-boot.sh @@ -3,15 +3,15 @@ part start mmc ${devnum} 9 mmc_env mmc dev ${devnum} -setenv loadbootstate "\ -echo 'loading env...';\ -mmc read ${ramdisk_addr_r} ${mmc_env} 0x10;\ -env import -c ${ramdisk_addr_r} 0x2000;" +setenv loadbootstate " \ + echo 'loading env...'; \ + mmc read ${ramdisk_addr_r} ${mmc_env} 0x10; \ + env import -c ${ramdisk_addr_r} 0x2000;" -setenv storebootstate "\ -echo 'storing env...';\ -env export -c -s 0x2000 ${ramdisk_addr_r} BOOT_ORDER BOOT_A_LEFT BOOT_B_LEFT;\ -mmc write ${ramdisk_addr_r} ${mmc_env} 0x10;" +setenv storebootstate " \ + echo 'storing env...'; \ + env export -c -s 0x2000 ${ramdisk_addr_r} BOOT_ORDER BOOT_A_LEFT BOOT_B_LEFT; \ + mmc write ${ramdisk_addr_r} ${mmc_env} 0x10;" run loadbootstate test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "A B" diff --git a/buildroot-external/board/raspberrypi/patches/uboot/0001-Support-HassOS-bootstate-partition.patch b/buildroot-external/board/raspberrypi/patches/uboot/0001-Support-HassOS-bootstate-partition.patch deleted file mode 100644 index 0061130fe..000000000 --- a/buildroot-external/board/raspberrypi/patches/uboot/0001-Support-HassOS-bootstate-partition.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 8458beb24f2540fff3c3faed4fa068553b9e474e Mon Sep 17 00:00:00 2001 -From: Pascal Vizeli -Date: Wed, 8 Aug 2018 09:45:07 +0000 -Subject: [PATCH 1/1] Support HassOS bootstate partition - -Signed-off-by: Pascal Vizeli ---- - env/mmc.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/env/mmc.c b/env/mmc.c -index 5e3da6dca75..353f58a12c9 100644 ---- a/env/mmc.c -+++ b/env/mmc.c -@@ -18,6 +18,11 @@ - #include - #include - -+#undef CONFIG_SYS_MMC_ENV_DEV -+#define CONFIG_SYS_MMC_ENV_DEV 0 -+#undef CONFIG_ENV_OFFSET -+#define CONFIG_ENV_OFFSET 0x25100000 -+ - #define __STR(X) #X - #define STR(X) __STR(X) - --- -2.17.1 - diff --git a/buildroot-external/board/raspberrypi/rpi3-64/uboot-boot.sh b/buildroot-external/board/raspberrypi/rpi3-64/uboot-boot.sh index a04666cc6..0d6595cd7 100644 --- a/buildroot-external/board/raspberrypi/rpi3-64/uboot-boot.sh +++ b/buildroot-external/board/raspberrypi/rpi3-64/uboot-boot.sh @@ -1,3 +1,17 @@ + +part start mmc ${devnum} 6 mmc_env +mmc dev ${devnum} +setenv loadbootstate " \ + echo 'loading env...'; \ + mmc read ${ramdisk_addr_r} ${mmc_env} 0x20; \ + env import -c ${ramdisk_addr_r} 0x4000;" + +setenv storebootstate " \ + echo 'storing env...'; \ + env export -c -s 0x4000 ${ramdisk_addr_r} BOOT_ORDER BOOT_A_LEFT BOOT_B_LEFT; \ + mmc write ${ramdisk_addr_r} ${mmc_env} 0x20;" + +run loadbootstate test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "A B" test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3 test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3 @@ -38,12 +52,12 @@ done setenv fdt_addr if test -n "${bootargs}"; then - saveenv + run storebootstate else echo "No valid slot found, resetting tries to 3" setenv BOOT_A_LEFT 3 setenv BOOT_B_LEFT 3 - saveenv + run storebootstate reset fi diff --git a/buildroot-external/board/raspberrypi/uboot-boot.sh b/buildroot-external/board/raspberrypi/uboot-boot.sh index 7355334ce..fa84eb39f 100644 --- a/buildroot-external/board/raspberrypi/uboot-boot.sh +++ b/buildroot-external/board/raspberrypi/uboot-boot.sh @@ -1,3 +1,17 @@ + +part start mmc ${devnum} 6 mmc_env +mmc dev ${devnum} +setenv loadbootstate " \ + echo 'loading env...'; \ + mmc read ${ramdisk_addr_r} ${mmc_env} 0x20; \ + env import -c ${ramdisk_addr_r} 0x4000;" + +setenv storebootstate " \ + echo 'storing env...'; \ + env export -c -s 0x4000 ${ramdisk_addr_r} BOOT_ORDER BOOT_A_LEFT BOOT_B_LEFT; \ + mmc write ${ramdisk_addr_r} ${mmc_env} 0x20;" + +run loadbootstate test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "A B" test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3 test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3 @@ -38,12 +52,12 @@ done setenv fdt_addr if test -n "${bootargs}"; then - saveenv + run storebootstate else echo "No valid slot found, resetting tries to 3" setenv BOOT_A_LEFT 3 setenv BOOT_B_LEFT 3 - saveenv + run storebootstate reset fi diff --git a/buildroot-external/board/raspberrypi/uboot.config b/buildroot-external/board/raspberrypi/uboot.config index 68813977d..b028a6259 100644 --- a/buildroot-external/board/raspberrypi/uboot.config +++ b/buildroot-external/board/raspberrypi/uboot.config @@ -1,3 +1,4 @@ # CONFIG_USB_STORAGE is not set # CONFIG_DOS_PARTITION is not set -CONFIG_ENV_IS_IN_MMC=y +CONFIG_CMD_FILEENV=y +CONFIG_ENV_IS_NOWHERE=Y