[PATCH v2 1/3] phycore_imx8mm: Switch to using env text files

Move the environment into the board directory and convert header to a txt file. In addition, this patch also applies following changes:
- Change default nfsroot path to /srv/nfs due to compliance with Linux FHS 3.0.
- Rename specific variables as stated in the bootstd documentation. Renamed variables: fdt_addr => fdt_addr_r fdt_file => fdtfile
Signed-off-by: Yunus Bas y.bas@phytec.de --- .../phytec/phycore_imx8mm/phycore_imx8mm.env | 51 +++++++++++++++++++ include/configs/phycore_imx8mm.h | 46 ----------------- 2 files changed, 51 insertions(+), 46 deletions(-) create mode 100644 board/phytec/phycore_imx8mm/phycore_imx8mm.env
diff --git a/board/phytec/phycore_imx8mm/phycore_imx8mm.env b/board/phytec/phycore_imx8mm/phycore_imx8mm.env new file mode 100644 index 00000000000..33a2595fa16 --- /dev/null +++ b/board/phytec/phycore_imx8mm/phycore_imx8mm.env @@ -0,0 +1,51 @@ +console=ttymxc2,115200 +emmc_dev=2 +fdt_addr_r=0x48000000 +fdtfile=CONFIG_DEFAULT_FDT_FILE +image=Image +ip_dyn=yes +loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image} +loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile} +mmcargs= + setenv bootargs console=${console} + root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw +mmcautodetect=yes +mmcboot= + echo Booting from mmc ...; + run mmcargs; + if run loadfdt; then + if test ${dofitboot} = 1; then + booti ${loadaddr} - ${fdt_addr_r} + else + echo WARN: Cannot load the DT; + fi; + fi; +mmcdev=CONFIG_SYS_MMC_ENV_DEV +mmcpart=1 +mmcroot=2 +netargs= + setenv bootargs console=${console} root=/dev/nfs ip=dhcp + nfsroot=${serverip}:${nfsroot},v3,tcp +netboot= + echo Booting from net ...; + if test ${ip_dyn} = yes; then + setenv get_cmd dhcp; + else + setenv get_cmd tftp; + fi; + ${get_cmd} ${loadaddr} ${image}; + run netargs; + if ${get_cmd} ${fdt_addr_r} ${fdtfile}; then + booti ${loadaddr} - ${fdt_addr_r}; + else + echo WARN: Cannot load the DT; + fi; +nfsroot=/srv/nfs +update_bootimg= + mmc dev ${mmcdev}; + if dhcp ${loadaddr} ${update_filepath}/${update_filename}; then + setexpr fw_sz ${filesize} / 0x200; + mmc write ${loadaddr} ${update_offset} ${fw_sz}; + fi; +update_filename=flash.bin +update_offset=0x42 diff --git a/include/configs/phycore_imx8mm.h b/include/configs/phycore_imx8mm.h index e74a3f184c6..20e2ab832ee 100644 --- a/include/configs/phycore_imx8mm.h +++ b/include/configs/phycore_imx8mm.h @@ -20,52 +20,6 @@ /* For RAW image gives a error info not panic */ #endif
-#define CFG_EXTRA_ENV_SETTINGS \ - "image=Image\0" \ - "console=ttymxc2,115200\0" \ - "fdt_addr=0x48000000\0" \ - "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ - "ip_dyn=yes\0" \ - "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV) "\0" \ - "mmcpart=1\0" \ - "mmcroot=2\0" \ - "update_offset=0x42\0" \ - "update_filename=flash.bin\0" \ - "update_bootimg=" \ - "mmc dev ${mmcdev} ; " \ - "if dhcp ${loadaddr} ${update_filepath}/${update_filename} ; then " \ - "setexpr fw_sz ${filesize} / 0x200 ; " /* SD block size */ \ - "mmc write ${loadaddr} ${update_offset} ${fw_sz} ; " \ - "fi\0" \ - "mmcautodetect=yes\0" \ - "mmcargs=setenv bootargs console=${console} " \ - "root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw\0" \ - "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ - "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ - "run mmcargs; " \ - "if run loadfdt; then " \ - "booti ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi;\0 " \ - "nfsroot=/nfs\0" \ - "netargs=setenv bootargs console=${console} root=/dev/nfs ip=dhcp " \ - "nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ - "netboot=echo Booting from net ...; " \ - "run netargs; " \ - "if test ${ip_dyn} = yes; then " \ - "setenv get_cmd dhcp; " \ - "else " \ - "setenv get_cmd tftp; " \ - "fi; " \ - "${get_cmd} ${loadaddr} ${image}; " \ - "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ - "booti ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi;\0" \ - /* Link Definitions */
#define CFG_SYS_INIT_RAM_ADDR 0x40000000

Move the default bootcmd from the defconfig to the board environment.
Signed-off-by: Yunus Bas y.bas@phytec.de --- board/phytec/phycore_imx8mm/phycore_imx8mm.env | 9 +++++++++ configs/phycore-imx8mm_defconfig | 2 -- 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/board/phytec/phycore_imx8mm/phycore_imx8mm.env b/board/phytec/phycore_imx8mm/phycore_imx8mm.env index 33a2595fa16..44fa3731b8a 100644 --- a/board/phytec/phycore_imx8mm/phycore_imx8mm.env +++ b/board/phytec/phycore_imx8mm/phycore_imx8mm.env @@ -1,3 +1,12 @@ +bootcmd= + mmc dev ${mmcdev}; + if mmc rescan; then + if run loadimage; then + run mmcboot; + else + run netboot; + fi; + fi; console=ttymxc2,115200 emmc_dev=2 fdt_addr_r=0x48000000 diff --git a/configs/phycore-imx8mm_defconfig b/configs/phycore-imx8mm_defconfig index c24580430f2..3f4336837e9 100644 --- a/configs/phycore-imx8mm_defconfig +++ b/configs/phycore-imx8mm_defconfig @@ -31,8 +31,6 @@ CONFIG_FIT=y CONFIG_FIT_EXTERNAL_OFFSET=0x3000 CONFIG_SPL_LOAD_FIT=y CONFIG_OF_SYSTEM_SETUP=y -CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="mmc dev ${mmcdev}; if mmc rescan; then if run loadimage; then run mmcboot; else run netboot; fi; fi;" CONFIG_DEFAULT_FDT_FILE="oftree" CONFIG_SYS_CBSIZE=2048 CONFIG_SYS_PBSIZE=2074

Add RAUC boot logic to the environment.
Signed-off-by: Yunus Bas y.bas@phytec.de --- board/phytec/phycore_imx8mm/phycore_imx8mm.env | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/board/phytec/phycore_imx8mm/phycore_imx8mm.env b/board/phytec/phycore_imx8mm/phycore_imx8mm.env index 44fa3731b8a..a7d14e774a0 100644 --- a/board/phytec/phycore_imx8mm/phycore_imx8mm.env +++ b/board/phytec/phycore_imx8mm/phycore_imx8mm.env @@ -1,6 +1,11 @@ +#include <env/phytec/rauc.env> + bootcmd= mmc dev ${mmcdev}; if mmc rescan; then + if test ${doraucboot} = 1; then + run raucinit; + fi; if run loadimage; then run mmcboot; else @@ -17,7 +22,7 @@ loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image} loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile} mmcargs= setenv bootargs console=${console} - root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw + root=/dev/mmcblk${mmcdev}p${mmcroot} ${raucargs} rootwait rw mmcautodetect=yes mmcboot= echo Booting from mmc ...;
participants (1)
-
Yunus Bas