[U-Boot] [PATCH 0/2] omapl: mmc boot help

The omapl-138 board can boot the ais image from mmc, but the right offset needs to be provided to SPL.
This series fixes the uboot raw offset config option and adds help text for the user to copy the AIS image to the sd card.
Axel Haslam (2): da850: Add instructions to copy AIS image to an MMC card omapl138_lcdk: Set uboot raw mmc sector to 0x41
board/davinci/da8xxevm/README.da850 | 16 ++++++++++++++++ configs/omapl138_lcdk_defconfig | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-)

The da850 soc's can boot from a external mmc card, but the AIS image should be written to the correct sector.
Add instructions to copy the AIS image to a MMC card.
Signed-off-by: Axel Haslam ahaslam@baylibre.com --- board/davinci/da8xxevm/README.da850 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/board/davinci/da8xxevm/README.da850 b/board/davinci/da8xxevm/README.da850 index 313a1ef..e8fec3e 100644 --- a/board/davinci/da8xxevm/README.da850 +++ b/board/davinci/da8xxevm/README.da850 @@ -47,6 +47,22 @@ U-Boot > sf erase 0 +320000 U-Boot > tftp u-boot.ais U-Boot > sf write c0700000 0 $filesize
+Flashing the images to MMC +========================== +If the boot pins are set to boot from mmc, the RBL will try to load the +next boot stage form the first couple of sectors of an external mmc card. +As sector 0 is usually used for storing the partition information, the +AIS image should be written after the first sector, but before the first +partition begins. (e.g: make sure to leave at least 500KB of unallocated +space at the start of the mmc when creating the partitions) + +To skip the first sector, the AIS image can then written using +the following dd command: +dd if=u-boot.ais of=/dev/mmcblk0 seek=1 bs=512 conv=fsync + +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is used by SPL, and should +point to the sector were the u-boot image starts on the MMC card. +(eg. after SPL).
Recovery ========

The uboot binary on the AIS file starts at offset 0x8000. This would be sector 0x40 on a mmc card with 512 bytes per sector: 0x8000/0x200 = 0x40.
But because we usually skip the first mmc sector to preserve the partition table, the ais image is written starting on sector 0x1, and the u-boot binary ends up at sector 0x41.
Set the address of the u-boot binary to 0x41 so that spl can correctly jump to it.
Signed-off-by: Axel Haslam ahaslam@baylibre.com --- configs/omapl138_lcdk_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig index d20af19..a249ebd 100644 --- a/configs/omapl138_lcdk_defconfig +++ b/configs/omapl138_lcdk_defconfig @@ -12,7 +12,7 @@ CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5 +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x41 CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="U-Boot > " CONFIG_CMD_BOOTZ=y

On Mon, Feb 13, 2017 at 11:44:57AM +0100, Axel Haslam wrote:
The uboot binary on the AIS file starts at offset 0x8000. This would be sector 0x40 on a mmc card with 512 bytes per sector: 0x8000/0x200 = 0x40.
But because we usually skip the first mmc sector to preserve the partition table, the ais image is written starting on sector 0x1, and the u-boot binary ends up at sector 0x41.
Set the address of the u-boot binary to 0x41 so that spl can correctly jump to it.
Signed-off-by: Axel Haslam ahaslam@baylibre.com
configs/omapl138_lcdk_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig index d20af19..a249ebd 100644 --- a/configs/omapl138_lcdk_defconfig +++ b/configs/omapl138_lcdk_defconfig @@ -12,7 +12,7 @@ CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5 +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x41
Since we're changing a default here, and one that will lead to non-booting boards if you don't notice, where did the old value come from, and is it actually in use anywhere? Thanks!

Hi Tom
On Mon, Feb 13, 2017 at 2:23 PM, Tom Rini trini@konsulko.com wrote:
On Mon, Feb 13, 2017 at 11:44:57AM +0100, Axel Haslam wrote:
The uboot binary on the AIS file starts at offset 0x8000. This would be sector 0x40 on a mmc card with 512 bytes per sector: 0x8000/0x200 = 0x40.
But because we usually skip the first mmc sector to preserve the partition table, the ais image is written starting on sector 0x1, and the u-boot binary ends up at sector 0x41.
Set the address of the u-boot binary to 0x41 so that spl can correctly jump to it.
Signed-off-by: Axel Haslam ahaslam@baylibre.com
configs/omapl138_lcdk_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig index d20af19..a249ebd 100644 --- a/configs/omapl138_lcdk_defconfig +++ b/configs/omapl138_lcdk_defconfig @@ -12,7 +12,7 @@ CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5 +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x41
Since we're changing a default here, and one that will lead to non-booting boards if you don't notice, where did the old value come from, and is it actually in use anywhere? Thanks!
I think the "old offset" would be correct when you copy the AIS image to the sd card using the uflash tool from TI. This tool adds some extra space at the start of the mmc for UBL configuration settings, which does not seem to be needed for the lcdk. The generated AIS image with SPL can boot the board directly and we can just copy the resulting AIS to the sdcard with the "dd" command.
-Axel.
-- Tom

On Mon, Feb 13, 2017 at 03:14:28PM +0100, Axel Haslam wrote:
Hi Tom
On Mon, Feb 13, 2017 at 2:23 PM, Tom Rini trini@konsulko.com wrote:
On Mon, Feb 13, 2017 at 11:44:57AM +0100, Axel Haslam wrote:
The uboot binary on the AIS file starts at offset 0x8000. This would be sector 0x40 on a mmc card with 512 bytes per sector: 0x8000/0x200 = 0x40.
But because we usually skip the first mmc sector to preserve the partition table, the ais image is written starting on sector 0x1, and the u-boot binary ends up at sector 0x41.
Set the address of the u-boot binary to 0x41 so that spl can correctly jump to it.
Signed-off-by: Axel Haslam ahaslam@baylibre.com
configs/omapl138_lcdk_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig index d20af19..a249ebd 100644 --- a/configs/omapl138_lcdk_defconfig +++ b/configs/omapl138_lcdk_defconfig @@ -12,7 +12,7 @@ CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5 +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x41
Since we're changing a default here, and one that will lead to non-booting boards if you don't notice, where did the old value come from, and is it actually in use anywhere? Thanks!
I think the "old offset" would be correct when you copy the AIS image to the sd card using the uflash tool from TI. This tool adds some extra space at the start of the mmc for UBL configuration settings, which does not seem to be needed for the lcdk. The generated AIS image with SPL can boot the board directly and we can just copy the resulting AIS to the sdcard with the "dd" command.
Ah yes, that tool. What is the drive for not being compatible with that tool in terms of offset? With binman it should be easy enough to have U-Boot generate a binary with sufficient padding between items. Thanks!

On Mon, Feb 13, 2017 at 3:17 PM, Tom Rini trini@konsulko.com wrote:
On Mon, Feb 13, 2017 at 03:14:28PM +0100, Axel Haslam wrote:
Hi Tom
On Mon, Feb 13, 2017 at 2:23 PM, Tom Rini trini@konsulko.com wrote:
On Mon, Feb 13, 2017 at 11:44:57AM +0100, Axel Haslam wrote:
The uboot binary on the AIS file starts at offset 0x8000. This would be sector 0x40 on a mmc card with 512 bytes per sector: 0x8000/0x200 = 0x40.
But because we usually skip the first mmc sector to preserve the partition table, the ais image is written starting on sector 0x1, and the u-boot binary ends up at sector 0x41.
Set the address of the u-boot binary to 0x41 so that spl can correctly jump to it.
Signed-off-by: Axel Haslam ahaslam@baylibre.com
configs/omapl138_lcdk_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig index d20af19..a249ebd 100644 --- a/configs/omapl138_lcdk_defconfig +++ b/configs/omapl138_lcdk_defconfig @@ -12,7 +12,7 @@ CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5 +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x41
Since we're changing a default here, and one that will lead to non-booting boards if you don't notice, where did the old value come from, and is it actually in use anywhere? Thanks!
I think the "old offset" would be correct when you copy the AIS image to the sd card using the uflash tool from TI. This tool adds some extra space at the start of the mmc for UBL configuration settings, which does not seem to be needed for the lcdk. The generated AIS image with SPL can boot the board directly and we can just copy the resulting AIS to the sdcard with the "dd" command.
Ah yes, that tool. What is the drive for not being compatible with that tool in terms of offset? With binman it should be easy enough to have U-Boot generate a binary with sufficient padding between items. Thanks!
Good point. i will try that instead. Thanks for the tip.
Axel.
-- Tom

Hi Tom
On Mon, Feb 13, 2017 at 3:23 PM, Axel Haslam ahaslam@baylibre.com wrote:
On Mon, Feb 13, 2017 at 3:17 PM, Tom Rini trini@konsulko.com wrote:
On Mon, Feb 13, 2017 at 03:14:28PM +0100, Axel Haslam wrote:
Hi Tom
On Mon, Feb 13, 2017 at 2:23 PM, Tom Rini trini@konsulko.com wrote:
On Mon, Feb 13, 2017 at 11:44:57AM +0100, Axel Haslam wrote:
The uboot binary on the AIS file starts at offset 0x8000. This would be sector 0x40 on a mmc card with 512 bytes per sector: 0x8000/0x200 = 0x40.
But because we usually skip the first mmc sector to preserve the partition table, the ais image is written starting on sector 0x1, and the u-boot binary ends up at sector 0x41.
Set the address of the u-boot binary to 0x41 so that spl can correctly jump to it.
Signed-off-by: Axel Haslam ahaslam@baylibre.com
configs/omapl138_lcdk_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig index d20af19..a249ebd 100644 --- a/configs/omapl138_lcdk_defconfig +++ b/configs/omapl138_lcdk_defconfig @@ -12,7 +12,7 @@ CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5 +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x41
Since we're changing a default here, and one that will lead to non-booting boards if you don't notice, where did the old value come from, and is it actually in use anywhere? Thanks!
I think the "old offset" would be correct when you copy the AIS image to the sd card using the uflash tool from TI. This tool adds some extra space at the start of the mmc for UBL configuration settings, which does not seem to be needed for the lcdk. The generated AIS image with SPL can boot the board directly and we can just copy the resulting AIS to the sdcard with the "dd" command.
Ah yes, that tool. What is the drive for not being compatible with that tool in terms of offset? With binman it should be easy enough to have U-Boot generate a binary with sufficient padding between items. Thanks!
Good point. i will try that instead. Thanks for the tip.
I looked at how the uflash tool works and it takes as input the AIS image, which i think means we would have to have yet another type of image specific for mmc that adds the padding.
An alternative to this would be just to document that to write the AIS image we need to skip 117 sectors, like so:
sudo dd if=./u-boot.ais of=/dev/mmcblk0 seek=117 bs=512
this would make u-boot fall into sector 0xb5, which would be exactly the same that is uflash ends up writing uboot to, and there would be no defconfig changes.
Would this be acceptable?
-Axel.
Axel.
-- Tom

On Mon, Feb 13, 2017 at 05:11:09PM +0100, Axel Haslam wrote:
Hi Tom
On Mon, Feb 13, 2017 at 3:23 PM, Axel Haslam ahaslam@baylibre.com wrote:
On Mon, Feb 13, 2017 at 3:17 PM, Tom Rini trini@konsulko.com wrote:
On Mon, Feb 13, 2017 at 03:14:28PM +0100, Axel Haslam wrote:
Hi Tom
On Mon, Feb 13, 2017 at 2:23 PM, Tom Rini trini@konsulko.com wrote:
On Mon, Feb 13, 2017 at 11:44:57AM +0100, Axel Haslam wrote:
The uboot binary on the AIS file starts at offset 0x8000. This would be sector 0x40 on a mmc card with 512 bytes per sector: 0x8000/0x200 = 0x40.
But because we usually skip the first mmc sector to preserve the partition table, the ais image is written starting on sector 0x1, and the u-boot binary ends up at sector 0x41.
Set the address of the u-boot binary to 0x41 so that spl can correctly jump to it.
Signed-off-by: Axel Haslam ahaslam@baylibre.com
configs/omapl138_lcdk_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/omapl138_lcdk_defconfig b/configs/omapl138_lcdk_defconfig index d20af19..a249ebd 100644 --- a/configs/omapl138_lcdk_defconfig +++ b/configs/omapl138_lcdk_defconfig @@ -12,7 +12,7 @@ CONFIG_VERSION_VARIABLE=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y -CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xb5 +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x41
Since we're changing a default here, and one that will lead to non-booting boards if you don't notice, where did the old value come from, and is it actually in use anywhere? Thanks!
I think the "old offset" would be correct when you copy the AIS image to the sd card using the uflash tool from TI. This tool adds some extra space at the start of the mmc for UBL configuration settings, which does not seem to be needed for the lcdk. The generated AIS image with SPL can boot the board directly and we can just copy the resulting AIS to the sdcard with the "dd" command.
Ah yes, that tool. What is the drive for not being compatible with that tool in terms of offset? With binman it should be easy enough to have U-Boot generate a binary with sufficient padding between items. Thanks!
Good point. i will try that instead. Thanks for the tip.
I looked at how the uflash tool works and it takes as input the AIS image, which i think means we would have to have yet another type of image specific for mmc that adds the padding.
An alternative to this would be just to document that to write the AIS image we need to skip 117 sectors, like so:
sudo dd if=./u-boot.ais of=/dev/mmcblk0 seek=117 bs=512
this would make u-boot fall into sector 0xb5, which would be exactly the same that is uflash ends up writing uboot to, and there would be no defconfig changes.
Would this be acceptable?
Yes, changing the instructions so that we write to the same location as the TI tool and not need to change the defconfig would be the preferred approach, thanks!
participants (2)
-
Axel Haslam
-
Tom Rini