SAMA5D27-SOM1-EK1 Boot From SDMMC1

Moderator: nferre

sirdan
Posts: 25
Joined: Thu Jun 25, 2009 4:19 pm

SAMA5D27-SOM1-EK1 Boot From SDMMC1

Sat Feb 17, 2018 3:36 am

Hello,

We are using the SAMA5D27-SOM1-EK1 development board with buildroot. We have the board booting properly from SDMMC0 but have a need to have it boot from the micro SD slot SDMMC1 (J14). It was pointed out to us by user thackerp that we have to reconfigure and rebuild the bootstrap and U-Boot images, and modify the U-Boot environment to look for the kernel, device tree and root file system on SDMMC1.

We are able to make buildroot rebuild the AT91-Bootstrap and U-Boot by deleting the .stamp_built files.

Now we need a little help on what files to edit to make the SAMA5D27-SOM1-EK1 Boot From SDMMC1. I had a look in both AT91 bootstrap and U-Boot but can't find where we might make changes. Can anyone help us with this please?

Thank you,
Dan
thackerp
Posts: 6
Joined: Tue Jul 19, 2016 10:19 pm

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Mon Feb 19, 2018 5:44 pm

sirdan wrote:
Sat Feb 17, 2018 3:36 am
Hello,

We are using the SAMA5D27-SOM1-EK1 development board with buildroot. We have the board booting properly from SDMMC0 but have a need to have it boot from the micro SD slot SDMMC1 (J14). It was pointed out to us by user thackerp that we have to reconfigure and rebuild the bootstrap and U-Boot images, and modify the U-Boot environment to look for the kernel, device tree and root file system on SDMMC1.

We are able to make buildroot rebuild the AT91-Bootstrap and U-Boot by deleting the .stamp_built files.

Now we need a little help on what files to edit to make the SAMA5D27-SOM1-EK1 Boot From SDMMC1. I had a look in both AT91 bootstrap and U-Boot but can't find where we might make changes. Can anyone help us with this please?

Thank you,
Dan

These are instructions for building stand-alone, modify as necessary for Buildroot:

For the at91bootstrap:
- make sama5d27_som1_ek_mmc_defconfig
- make menuconfig
- memory selection
- SD Card Configuration
- SD Host Controller Select
- On SDHC1
Build as usual

For U-Boot:
- make sama5d27_som1_ek_mmc_defconfig

Edit the include/configs/sama5d27_som1_ek.h file.
Modify: #define FAT_ENV_DEVICE_AND_PART "0"
to: #define FAT_ENV_DEVICE_AND_PART "1"

Optionally, modify the default bootargs and bootcmd to use mmc 0 instead of mmc1. This can also be done in the environment file, or manually from the U-Boot command line.

Then build, deploy and boot as normal.
sirdan
Posts: 25
Joined: Thu Jun 25, 2009 4:19 pm

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Tue Feb 20, 2018 9:37 am

You Rock, Thank you!
sirdan
Posts: 25
Joined: Thu Jun 25, 2009 4:19 pm

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Tue Feb 20, 2018 11:27 pm

Hello,

I have gotten a bit further following thackerp's instructions. AT91Bootstrap now loads U-Boot off of SDMMC1 but there is still a reference to SDMMC0 that I cannot find.

** Bad device mmc 0 **
So it cannot load at91-sama5d27_som1_ek.dtb

It dies on Starting kernel...

Code: Select all

AT91Bootstrap 3.8.9 (Tue Feb 20 09:32:00 PST 2018)

SD/MMC: Image: Read file u-boot.bin to 0x23f00000
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: Done to load image
<debug_uart> 

U-Boot 2017.03-linux4sam_5.7 (Feb 20 2018 - 11:06:42 -0800)

CPU: SAMA5D27 1G bits DDR2 SDRAM
Crystal frequency:       24 MHz
CPU clock        :      492 MHz
Master clock     :      164 MHz
DRAM:  128 MiB
MMC:   sdio-host@a0000000: 0, sdio-host@b0000000: 1
reading uboot.env

In:    serial@f8020000
Out:   serial@f8020000
Err:   serial@f8020000
Net:   eth0: ethernet@f8008000
Hit any key to stop autoboot:  0 
mmc_init: -110, time 5
** Bad device mmc 0 **
mmc_init: -110, time 6
** Bad device mmc 0 **
## Flattened Device Tree blob at 21000000
   Booting using the fdt blob at 0x21000000
   Loading Device Tree to 27b55000, end 27b5fcd2 ... OK

Starting kernel ...

prefetch abort
pc : [<4400092c>]          lr : [<22003228>]
sp : 2238eae0  ip : 00000000     fp : 2238dafc
r10: 20008000  r9 : 4400465c     r8 : 44000928
r7 : 00000000  r6 : 4400465c     r5 : 2238dad4  r4 : ffffffff
r3 : 00000001  r2 : 4438db14     r1 : 00000000  r0 : 220045c8
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

The error msg

Code: Select all

** Unable to read "uboot.env" from mmc1:1 **
Using default environment
Doesn't seem to be an issue, it gives the same error msg when booting from SDMMC0 with stock sama5d27_som1_ek_mmc_defconfig

Code: Select all

** Unable to read "uboot.env" from mmc0:1 **v
Using default environment
I put all the changes back and can boot from SDMMC0 again.

Code: Select all


AT91Bootstrap 3.8.9 (Tue Feb 20 11:38:59 PST 2018)

SD/MMC: Image: Read file u-boot.bin to 0x23f00000
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: Done to load image
<debug_uart> 

U-Boot 2017.03-linux4sam_5.7 (Feb 20 2018 - 11:39:25 -0800)

CPU: SAMA5D27 1G bits DDR2 SDRAM
Crystal frequency:       24 MHz
CPU clock        :      492 MHz
Master clock     :      164 MHz
DRAM:  128 MiB
MMC:   sdio-host@a0000000: 0, sdio-host@b0000000: 1
reading uboot.env

** Unable to read "uboot.env" from mmc0:1 **
Using default environment

In:    serial@f8020000
Out:   serial@f8020000
Err:   serial@f8020000
Net:   eth0: ethernet@f8008000
Hit any key to stop autoboot:  0 
[b]reading at91-sama5d27_som1_ek.dtb[/b]
31955 bytes read in 19 ms (1.6 MiB/s)
reading zImage
3726080 bytes read in 237 ms (15 MiB/s)
## Flattened Device Tree blob at 21000000
   Booting using the fdt blob at 0x21000000
   Loading Device Tree to 27b56000, end 27b60cd2 ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0

I have searched through the u-boot config files and found references to #define FAT_ENV_DEVICE_AND_PART "0" that pertain to sama5

Code: Select all

./include/configs/at91-sama5_common.h:#define FAT_ENV_DEVICE_AND_PART   "0"
./include/configs/sama5d27_som1_ek.h:#define FAT_ENV_DEVICE_AND_PART    "0"
./include/configs/sama5d2_xplained.h:#undef FAT_ENV_DEVICE_AND_PART
./include/configs/sama5d2_xplained.h:#define FAT_ENV_DEVICE_AND_PART    "1"
I changed them to FAT_ENV_DEVICE_AND_PART "1" , but I still get the ** Bad device mmc 0 ** error message.

Can anyone shed some light on this?

Thank you,
Dan
sirdan
Posts: 25
Joined: Thu Jun 25, 2009 4:19 pm

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Wed Feb 21, 2018 10:49 am

Success!

I should have paid more attention to what user thackerp told me.

For the at91bootstrap:
- make sama5d27_som1_ek_mmc_defconfig
- make menuconfig
- memory selection
- SD Card Configuration
- SD Host Controller Select
- On SDHC1
Build as usual

For U-Boot:
- make sama5d27_som1_ek_mmc_defconfig

Edit the include/configs/sama5d27_som1_ek.h file.
Modify: #define FAT_ENV_DEVICE_AND_PART "0"
to: #define FAT_ENV_DEVICE_AND_PART "1"
Optionally, modify the default bootargs and bootcmd to use mmc 0 instead of mmc1.

To clarify his instructions; The include/configs/sama5d27_som1_ek.h file needs the following changes.

FROM:

Code: Select all


#define FAT_ENV_DEVICE_AND_PART	"0"
#define FAT_ENV_FILE		"uboot.env"
#define CONFIG_ENV_SIZE		0x4000
/* bootstrap + u-boot + env in sd card */
#define CONFIG_BOOTCOMMAND	"fatload mmc 0:1 0x21000000 at91-sama5d27_som1_ek.dtb; " \
				"fatload mmc 0:1 0x22000000 zImage; " \
				"bootz 0x22000000 - 0x21000000"
#undef CONFIG_BOOTARGS
#define CONFIG_BOOTARGS \
	"console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rw rootwait"
#endif


TO:

Code: Select all


#define FAT_ENV_DEVICE_AND_PART	"1"
#define FAT_ENV_FILE		"uboot.env"
#define CONFIG_ENV_SIZE		0x4000
/* bootstrap + u-boot + env in sd card */
#define CONFIG_BOOTCOMMAND	"fatload mmc 1:1 0x21000000 at91-sama5d27_som1_ek.dtb; " \
				"fatload mmc 1:1 0x22000000 zImage; " \
				"bootz 0x22000000 - 0x21000000"
#undef CONFIG_BOOTARGS
#define CONFIG_BOOTARGS \
	"console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait"
#endif

Thank you for your help thackerp! Maybe this will help someone else.

This support ticket can be closed :)

Dan

Return to “SAMA5-based”

Who is online

Users browsing this forum: No registered users and 2 guests