im8mn: Loading U-Boot via serial download mode

Hi Adam,
Looking at your imx8mn beacon patches, it seems you managed to boot the imx8mn beacon board via serial download mode.
I am trying to achieve the same on an imx8mn-evk running top of tree U-Boot and added the following changes:
--- a/configs/imx8mn_evk_defconfig +++ b/configs/imx8mn_evk_defconfig @@ -50,11 +50,22 @@ CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_CACHE=y +CONFIG_USB=y +# CONFIG_SPL_DM_USB is not set +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_USB_GADGET_VENDOR_NUM=0x0525 +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 +CONFIG_CI_UDC=y +CONFIG_SDP_LOADADDR=0x0 +CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y +CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
Then I put the board into serial download mode and I run:
$ sudo uuu flash.bin
The following output appears on the console:
U-Boot SPL 2022.04-00856-g246e03476ba3-dirty (Apr 20 2022 - 16:24:48 -0300) SEC0: RNG instantiated Normal Boot WDT: Started watchdog@30280000 with servicing (60s timeout) Trying to boot from BOOTROM Find img info 0x&48020a00, size 872 Need continue download 1024 Download 694696, Total size 696232 NOTICE: BL31: v2.2(release):rel_imx_5.4.47_2.2.0-0-gc949a888e909 NOTICE: BL31: Built : 16:07:45, Apr 20 2022
What would be the other uuu command that needs to be run so that U-Boot proper can be loaded?
Thanks,
Fabio Estevam

On Wed, Apr 20, 2022 at 2:40 PM Fabio Estevam festevam@gmail.com wrote:
Hi Adam,
Looking at your imx8mn beacon patches, it seems you managed to boot the imx8mn beacon board via serial download mode.
I am trying to achieve the same on an imx8mn-evk running top of tree U-Boot and added the following changes:
--- a/configs/imx8mn_evk_defconfig +++ b/configs/imx8mn_evk_defconfig @@ -50,11 +50,22 @@ CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_CACHE=y +CONFIG_USB=y +# CONFIG_SPL_DM_USB is not set +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_USB_GADGET_VENDOR_NUM=0x0525 +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 +CONFIG_CI_UDC=y +CONFIG_SDP_LOADADDR=0x0 +CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y +CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
Then I put the board into serial download mode and I run:
$ sudo uuu flash.bin
The following output appears on the console:
U-Boot SPL 2022.04-00856-g246e03476ba3-dirty (Apr 20 2022 - 16:24:48 -0300) SEC0: RNG instantiated Normal Boot WDT: Started watchdog@30280000 with servicing (60s timeout) Trying to boot from BOOTROM Find img info 0x&48020a00, size 872 Need continue download 1024 Download 694696, Total size 696232 NOTICE: BL31: v2.2(release):rel_imx_5.4.47_2.2.0-0-gc949a888e909 NOTICE: BL31: Built : 16:07:45, Apr 20 2022
What would be the other uuu command that needs to be run so that U-Boot proper can be loaded?
I had to set the environmental variable for ENV is nowhere. There was a bunch of discussion about the fact that the 8MN and 8MP have some special code which makes the environmental variable location depend on the boot device. A few of us went a few rounds, but Marek didn't like our solution.
Set CONFIG_ENV_IS_NOWHERE=y and rebuild. It will likely boot.
adam
Thanks,
Fabio Estevam

Hi
Il mer 20 apr 2022, 21:49 Adam Ford aford173@gmail.com ha scritto:
On Wed, Apr 20, 2022 at 2:40 PM Fabio Estevam festevam@gmail.com wrote:
Hi Adam,
Looking at your imx8mn beacon patches, it seems you managed to boot the imx8mn beacon board via serial download mode.
I am trying to achieve the same on an imx8mn-evk running top of tree U-Boot and added the following changes:
--- a/configs/imx8mn_evk_defconfig +++ b/configs/imx8mn_evk_defconfig @@ -50,11 +50,22 @@ CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_CACHE=y +CONFIG_USB=y +# CONFIG_SPL_DM_USB is not set +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_USB_GADGET_VENDOR_NUM=0x0525 +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 +CONFIG_CI_UDC=y +CONFIG_SDP_LOADADDR=0x0 +CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y +CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
Then I put the board into serial download mode and I run:
$ sudo uuu flash.bin
The following output appears on the console:
U-Boot SPL 2022.04-00856-g246e03476ba3-dirty (Apr 20 2022 - 16:24:48
-0300)
SEC0: RNG instantiated Normal Boot WDT: Started watchdog@30280000 with servicing (60s timeout) Trying to boot from BOOTROM Find img info 0x&48020a00, size 872 Need continue download 1024 Download 694696, Total size 696232 NOTICE: BL31: v2.2(release):rel_imx_5.4.47_2.2.0-0-gc949a888e909 NOTICE: BL31: Built : 16:07:45, Apr 20 2022
What would be the other uuu command that needs to be run so that U-Boot proper can be loaded?
I had to set the environmental variable for ENV is nowhere. There was a bunch of discussion about the fact that the 8MN and 8MP have some special code which makes the environmental variable location depend on the boot device. A few of us went a few rounds, but Marek didn't like our solution.
Set CONFIG_ENV_IS_NOWHERE=y and rebuild. It will likely boot.
That code should be dropped because it's really buggy. We already sent several patches. I prefer some registered mechanism and not those board, arch etc function definition.
Michael
adam
Thanks,
Fabio Estevam

Hi Michael,
On Wed, Apr 20, 2022 at 4:53 PM Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
Set CONFIG_ENV_IS_NOWHERE=y and rebuild. It will likely boot.
That code should be dropped because it's really buggy. We already sent several patches. I prefer some registered mechanism and not those board, arch etc function definition.
Just to confirm: you are saying adding CONFIG_ENV_IS_NOWHERE=y is not an acceptable solution and that a a better solution needs to be implemented, correct?
Care to point to previous patches that were sent to address this issue?
Thanks

On Wed, Apr 20, 2022 at 3:16 PM Fabio Estevam festevam@gmail.com wrote:
Hi Michael,
On Wed, Apr 20, 2022 at 4:53 PM Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
Set CONFIG_ENV_IS_NOWHERE=y and rebuild. It will likely boot.
That code should be dropped because it's really buggy. We already sent several patches. I prefer some registered mechanism and not those board, arch etc function definition.
Just to confirm: you are saying adding CONFIG_ENV_IS_NOWHERE=y is not an acceptable solution and that a a better solution needs to be implemented, correct?
Care to point to previous patches that were sent to address this issue?
This problem is the code in arch/arm/mach-imx/imx8m/soc.c:
#if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP) struct rom_api *g_rom_api = (struct rom_api *)0x980;
enum boot_device get_boot_device(void) <snip>
get_boot_device() assumes that all users want the environmental variables to be stored in a different location depending on the boot device. When booting from USB, none of the environmental variable locations are given, so nowhere is the only option.
There is another issue where some people want their environmental variables in the same place all the time regardless of what the boot device was. This code also breaks that functionality. For some reason it's only applied to 8MN and 8MP, so only their environment settings are affected and not 8MQ or 8MM.
When I build, I just delete the function, so my environment is where I want it. It's far from ideal, but there doesn't seem to be consensus.
adam
Thanks

Hi
On Wed, Apr 20, 2022 at 11:29 PM Adam Ford aford173@gmail.com wrote:
On Wed, Apr 20, 2022 at 3:16 PM Fabio Estevam festevam@gmail.com wrote:
Hi Michael,
On Wed, Apr 20, 2022 at 4:53 PM Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
Set CONFIG_ENV_IS_NOWHERE=y and rebuild. It will likely boot.
That code should be dropped because it's really buggy. We already sent several patches. I prefer some registered mechanism and not those board, arch etc function definition.
Just to confirm: you are saying adding CONFIG_ENV_IS_NOWHERE=y is not an acceptable solution and that a a better solution needs to be implemented, correct?
Care to point to previous patches that were sent to address this issue?
This problem is the code in arch/arm/mach-imx/imx8m/soc.c:
#if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP) struct rom_api *g_rom_api = (struct rom_api *)0x980;
enum boot_device get_boot_device(void)
<snip>
get_boot_device() assumes that all users want the environmental variables to be stored in a different location depending on the boot device. When booting from USB, none of the environmental variable locations are given, so nowhere is the only option.
There is another issue where some people want their environmental variables in the same place all the time regardless of what the boot device was. This code also breaks that functionality. For some reason it's only applied to 8MN and 8MP, so only their environment settings are affected and not 8MQ or 8MM.
When I build, I just delete the function, so my environment is where I want it. It's far from ideal, but there doesn't seem to be consensus.
This was the code posted to address it
https://www.mail-archive.com/u-boot@lists.denx.de/msg430587.html
If I remember
Michael
adam
Thanks

On Thu, Apr 21, 2022 at 08:53:57AM +0200, Michael Nazzareno Trimarchi wrote:
Hi
On Wed, Apr 20, 2022 at 11:29 PM Adam Ford aford173@gmail.com wrote:
On Wed, Apr 20, 2022 at 3:16 PM Fabio Estevam festevam@gmail.com wrote:
Hi Michael,
On Wed, Apr 20, 2022 at 4:53 PM Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
Set CONFIG_ENV_IS_NOWHERE=y and rebuild. It will likely boot.
That code should be dropped because it's really buggy. We already sent several patches. I prefer some registered mechanism and not those board, arch etc function definition.
Just to confirm: you are saying adding CONFIG_ENV_IS_NOWHERE=y is not an acceptable solution and that a a better solution needs to be implemented, correct?
Care to point to previous patches that were sent to address this issue?
This problem is the code in arch/arm/mach-imx/imx8m/soc.c:
#if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP) struct rom_api *g_rom_api = (struct rom_api *)0x980;
enum boot_device get_boot_device(void)
<snip>
get_boot_device() assumes that all users want the environmental variables to be stored in a different location depending on the boot device. When booting from USB, none of the environmental variable locations are given, so nowhere is the only option.
There is another issue where some people want their environmental variables in the same place all the time regardless of what the boot device was. This code also breaks that functionality. For some reason it's only applied to 8MN and 8MP, so only their environment settings are affected and not 8MQ or 8MM.
When I build, I just delete the function, so my environment is where I want it. It's far from ideal, but there doesn't seem to be consensus.
This was the code posted to address it
https://www.mail-archive.com/u-boot@lists.denx.de/msg430587.html
If I remember
Hi All, Right, patchset can be found here
https://patchwork.ozlabs.org/project/uboot/list/?series=283787&state=%2A...
Regards, Tommaso
Michael
adam
Thanks
-- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@amarulasolutions.com __________________________________
Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@amarulasolutions.com www.amarulasolutions.com

On 4/21/22 10:56, Tommaso Merciai wrote:
On Thu, Apr 21, 2022 at 08:53:57AM +0200, Michael Nazzareno Trimarchi wrote:
Hi
On Wed, Apr 20, 2022 at 11:29 PM Adam Ford aford173@gmail.com wrote:
On Wed, Apr 20, 2022 at 3:16 PM Fabio Estevam festevam@gmail.com wrote:
Hi Michael,
On Wed, Apr 20, 2022 at 4:53 PM Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
Set CONFIG_ENV_IS_NOWHERE=y and rebuild. It will likely boot.
That code should be dropped because it's really buggy. We already sent several patches. I prefer some registered mechanism and not those board, arch etc function definition.
Just to confirm: you are saying adding CONFIG_ENV_IS_NOWHERE=y is not an acceptable solution and that a a better solution needs to be implemented, correct?
Care to point to previous patches that were sent to address this issue?
This problem is the code in arch/arm/mach-imx/imx8m/soc.c:
#if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP) struct rom_api *g_rom_api = (struct rom_api *)0x980;
enum boot_device get_boot_device(void)
<snip>
get_boot_device() assumes that all users want the environmental variables to be stored in a different location depending on the boot device. When booting from USB, none of the environmental variable locations are given, so nowhere is the only option.
There is another issue where some people want their environmental variables in the same place all the time regardless of what the boot device was. This code also breaks that functionality. For some reason it's only applied to 8MN and 8MP, so only their environment settings are affected and not 8MQ or 8MM.
When I build, I just delete the function, so my environment is where I want it. It's far from ideal, but there doesn't seem to be consensus.
This was the code posted to address it
https://www.mail-archive.com/u-boot@lists.denx.de/msg430587.html
If I remember
Hi All, Right, patchset can be found here
https://patchwork.ozlabs.org/project/uboot/list/?series=283787&state=%2A...
Please re-read comments in 4/4 about how this breaks every single board except the mn/mp evk and how to implement it properly without duplication.

Hi Adam,
On Wed, Apr 20, 2022 at 4:49 PM Adam Ford aford173@gmail.com wrote:
I had to set the environmental variable for ENV is nowhere. There was a bunch of discussion about the fact that the 8MN and 8MP have some special code which makes the environmental variable location depend on the boot device. A few of us went a few rounds, but Marek didn't like our solution.
Set CONFIG_ENV_IS_NOWHERE=y and rebuild. It will likely boot.
Yes, I confirm that only adding CONFIG_ENV_IS_NOWHERE=y allows the board to boot via "sudo uuu flash.bin"
diff --git a/configs/imx8mn_ddr4_evk_defconfig b/configs/imx8mn_ddr4_evk_defconfig index 917cdb5aa9d9..4252036df770 100644 --- a/configs/imx8mn_ddr4_evk_defconfig +++ b/configs/imx8mn_ddr4_evk_defconfig @@ -48,6 +48,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y +CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_DEV=1
participants (5)
-
Adam Ford
-
Fabio Estevam
-
Marek Vasut
-
Michael Nazzareno Trimarchi
-
Tommaso Merciai