Bootable eMMC

From linux-sunxi.org
Jump to: navigation, search

Contents

Introduction

First of all, any eMMC can be also used as a regular SD card. Which means that it can be treated as a single large block device representing its full capacity. And the first stage bootloader (U-Boot SPL or Allwinner's boot0) is expected to be stored in a special hardcoded place between the MBR and the first partition, which does not play very nice with GPT partitioning. But if you are happy with this particular setup, then just go to the Bootable SD card page for further information and instructions.

eMMC supports separate boot partitions for storing the bootloader. They are not sharing the same block device with the data.

At least Allwinner H3 is expected to support eMMC boot paritions because the manual says "Supports eMMC boot operation and alternative boot operation". The JEDEC eMMC spec mentions "boot operation" and "alternative boot operation".

Information for devboard designers

TBD

The BROM implementation details

TBD

Software development and trying something here and now

MBOX icon important.png This is a very preliminary collection of work-in-progress notes, don't expect anything usable yet.

Disabling eMMC boot partitions write protection in Linux (for more details, check https://www.kernel.org/doc/Documentation/mmc/mmc-dev-parts.txt):

   echo 0 > /sys/block/mmcblk1boot0/force_ro
   echo 0 > /sys/block/mmcblk1boot1/force_ro

Just trying to write the SPL into boot partitions does not seem to work. So we need to inspect the BROM code to check what exactly it is doing. As an alternative, use the Fastboot approach.

Examination of mmc_burn_boot function in the A64's BSP u-boot code suggests that booting from a eMMC boot partition is indeed supported and that BootROM expects the boot0 code located at the first sector of such partition. At least for the A64 chip, this has been proven to be correct: when a boot partition is properly activated (as specified by the eMMC standard, JESD84-B51), the boot0 gets loaded and the boot goes as usual.

The proper eMMC configuration allowing to boot from these partitions can be easily setup inside mainline u-boot with SUPPORT_EMMC_BOOT option enabled. Executing these two commands in the u-boot's shell activates booting from the first boot partition:

   # mmc bootbus <dev> <bus_width> <reset_boot_bus_width> <boot_mode>
   mmc bootbus 1 1 0 0
   # mmc partconf <dev> <boot_ack> <boot_partition> <partition_acces>
   mmc partconf 1 1 1 0

Also, if you rely on U-boot proper residing immediately behind SPL (i.e. when you use u-boot-sunxi-with-spl.bin), make sure to update CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR value to 0x40.

See also

Personal tools
Namespaces

Variants
Actions
Navigation
Tools