Search by Tags

Linux - Booting

 

Compare with Revision




Subscribe for this article updates

Boot Sequence

After reset the Tegra T20/T30 internal boot ROM code goes trough the following steps:

  • The CPU internal boot ROM reads and latches the values present at GPIO's with strapping functionality.
  • The state of the strapping pins and CPU internal fuse settings are used to determine the boot device used for booting.
  • The Boot Configuration Table (BCT) is read from the start of the boot device. The BCT contains the needed DDR RAM configuration and optimised timings for the boot device.
  • The RAM gets initialized.
  • The boot loader is read from the boot device and control is passed to the boot loader. This is the earliest where customised code can be executed.

We use an extended U-Boot as boot loader. (U-Boot)

  • U-Boot reads its environment variable from the boot device. If these data is corrupted it loads initial settings.
  • U-Boot analyses the environment variables to find out where the kernel and the rootfs are stored and what kernel command line is requested.
  • U-Boot auto detects the available RAM size and NAND Flash size and properties.
  • U-Boot sets the Ethernet MAC address and configures the hardware in preparation for the Linux kernel.
  • U-Boot loads the kernel into RAM and passes control to the kernel.
  • The kernel initializes Linux, mounts the rootfs and starts 'init' to initialize the Linux user space.

Boot Scenarios

  • Boot device is the NAND flash provided on the Colibri T20 or eMMC provided on T30 modules. U-Boot, kernel and rootfs are stored on the boot medium. The U-Boot environment in our images is set for this scenarios.
  • Boot device is a SD card. U-Boot, kernel and rootfs are stored on the boot medium. The strapping pins have to be set accordingly (Colibri T20 only).
  • By changing the U-Boot environment the storage location of the kernel and rootfs can be changed to something different than the boot device.
  • The kernel can be loaded from NAND/eMMC, SD card, USB memory stick or a TFTP server.
  • The rootfs can be on NAND/eMMC, SD card, USB memory stick or a NFS server.

Common Combinations

  • Everything on NAND/eMMC –> Standard, for production and testing.
  • Everything on SD card -> When you want to change between different OS', i.e. WinCE on NAND flash, Linux on SD card (Colibri T20 only).
  • U-Boot on NAND/eMMC, kernel and rootfs on SD card -> When you want to change between different kernels / rootfs'.
  • U-Boot on NAND/eMMC, kernel from TFTP and rootfs from NFS -> During kernel and application development and debugging.

See the release notes of our Linux image for instructions on how to activate NAND Flash or SD card boot on a Colibri T20. For the other scenarios the U-Boot environment of a module that either does NAND/eMMC or SD card boot is modified as described below.

U-Boot

Console

U-Boot's console is available on the primary aka Full Function (FF) UART aka UART_A.

While U-Boot's console output is also visible on the parallel RGB display (and with the carrier boards RAMDAC on VGA) a USB keyboard directly connected to the module does not work as of yet.

Environment Variables

The following listing shows the content of the U-Boot environment as present in our T20_LinuxImageV2.0 for NAND flash boot.

Tegra2 # printenv
baudrate=115200
bootcmd=run flashboot; run nfsboot
bootdelay=5
defargs=video=tegrafb vmalloc=128M usb_high_speed=1
ethaddr=00:14:2d:48:8a:58
fdtaddr=182ac8
flashargs=ip=off root=/dev/mtdblock0 rw rootfstype=yaffs2
flashboot=run setup; setenv bootargs ${defargs} ${flashargs} ${mtdparts} ${setupargs}; echo Booting from NAND...; nboot ${loadaddr} 0 ${lnxoffset} && bootm
ipaddr=192.168.10.2
lnxoffset=0xc80000
loadaddr=0x408000
memargs=mem=372M@0M fbmem=12M@372M nvmem=128M@384M
mmcboot=echo Loading RAM disk and kernel from MMC/SD card...; mmc init && fatload mmc 0:1 0xC08000 rootfs-ext2.img.gz && fatload mmc 0:1 ${loadaddr} uImage;run ramboot
mtdparts=mtdparts=tegra_nand:1023744K@23808K(USR),3072K@0K(BCT),256K@4096K(PT),2048K@5376K(EBT),256K@8448K(BMP),2048K@9728K(ENV),8192K@12800K(LNX),256K@22272K(ARG)
netmask=255.255.255.0
nfsargs=ip=:::::eth0:on root=/dev/nfs rw netdevwait
nfsboot=run setup; setenv bootargs ${defargs} ${nfsargs} ${mtdparts} ${setupargs}; echo Booting from NFS...; usb start; dhcp; bootm
ramargs=initrd=0xA1800000,32M ramdisk_size=32768 root=/dev/ram0 rw
ramboot=run setup; setenv bootargs ${defargs} ${ramargs} ${mtdparts} ${setupargs}; echo Booting from RAM...; bootm
sdargs=root=/dev/mmcblk0p1 ip=:::::eth0:off rw,noatime rootfstype=ext3 rootwait gpt gpt_sector=18945
sdboot=run setup; setenv bootargs ${defargs} ${sdargs} ${mtdparts} ${setupargs}; echo Booting from MMC/SD card...; mmc read 0 ${loadaddr} 0x2a00 0x4000; bootm
serverip=192.168.10.1
setup=setenv setupargs asix_mac=${ethaddr} no_console_suspend=1 console=tty1 console=ttyS0,${baudrate}n8 debug_uartport=lsport,0 ${memargs}
stderr=serial,lcd
stdin=serial,usbkbd
stdout=serial,lcd
ubiargs=ubi.mtd=0 root=ubi0:rootfs rootfstype=ubifs
ubiboot=run setup; setenv bootargs ${defargs} ${ubiargs} ${mtdparts} ${setupargs}; echo Booting from NAND...; ubi part kernel-ubi && ubi read ${loadaddr} kernel; bootm
usbboot=echo Loading RAM disk and kernel from USB stick...; usb start && fatload usb 0:1 0xC08000 rootfs-ext2.img.gz && fatload usb 0:1 ${loadaddr} uImage;run ramboot

Environment size: 2122/4092 bytes
Tegra2 #

Resetting the Environment to the Defaults

Tegra2 # env default -f
## Resetting to default environment
Tegra2 # saveenv

Creating a New or Changing an Existing Variable

Creating a new variable or changing an existing one is done using the setenv command. You must enclose the argument with ' ' if you don't want to expand variables or multiple statements are given. To make changes permanent they need to be stored in flash with saveenv:

Tegra2 # setenv defargs 'video=tegrafb vmalloc=248M usb_high_speed=1'
Tegra2 # saveenv
Saving Environment to NAND...
Erasing Nand...
Erasing at 0xe00000 -- 100% complete.
Writing to Nand... done

Booting Methods

U-Boot on NAND Flash, Kernel and Rootfs on SD Card

Note: It is recommended to use this method only during development, since normal SD cards aren't reliable for long term usage. For a simple installation of bootable images please use our Toradex Easy Installer.

Note: Besides the method described below, openembedded also supports the creation of .wic files during builds. These files are actually full images that can be directly burned into an SD card (simply decompress and burn them using the dd utility). Currently toradex imx builds include this features.

In order to boot from an SD card you need:

  • U-boot running on your module. If this is not the case, please use Toradex Easy Installer to install a running image first.
  • An SD card with two partitions. The first holding a fat fs to host the kernel image and device trees, the second holding an ext4 fs to hold the rootfs

Use your preferred partitioning tool to create both partitions in your SD card. The size will depend on your module and images, but 100MB and 1-2GB should suffice in most cases. The order of the partitions is important, since U-boot will look for the kernel in the first, and for the rootfs in the second.

sudo parted -s /dev/sd? mklabel gpt mkpart primary fat32 1MiB 100MiB mkpart ext4 100MiB 2000MiB name 1 boot name 2 rootfs
sudo mkfs.fat -n boot /dev/sd?1 && -L rootfs mkfs.ext4 /dev/sd?2
sudo lsblk /dev/sd? -o NAME,FSTYPE,LABEL,PARTLABEL (to verify)

Here, sd? is the device corresponding to the SD card (check yours by looking at dmesg after plugging the SD to your computer or using the lsblk command). We have named the partitions boot and rootfs, but you can name them at will. Do not forget to mount the partitions afterwards to be able to access them: sudo mount -L boot /mnt/boot; sudo mount -L rootfs /mnt/rootfs.

Now you need to copy the kernel image and the device trees into the first partition, and the rootfs into the second. To do this, first download an image for the Toradex Easy Installer corresponding to your module and look inside for the bootfs and the rootfs. These are named xxx-Image.bootfs.tar.xz and xxx-Image.rootfs.tar.xz. Simply untar each of them into the first and second partition respectively.

sudo tar xf Colibri-iMX6_LXDE-Image.bootfs.tar.xz --no-same-owner -C /mnt/boot
sudo tar xf Colibri-iMX6_LXDE-Image.rootfs.tar.xz -C /mnt/rootfs

where the colibri imx6 module has been used as an example. Alternatively, if you have a legacy image, you will find the boot files in the <module-name>_bin/ folder (you only need the SPL, zImage and the device tree for your module), and the rootfs in the rootfs folder. Copy them to the partitions with

sudo cp -L colibri-imx6_bin/{zImage,SPL,imx6dl-colibri-eval-v3.dtb} /mnt/boot
sudo cp -r rootfs/* /mnt/rootfs

Finally, unmount the partitions with sudo umount /mnt/{boot,rootfs}, insert the SD card into the carrier board slot and boot your module entering U-boot (by hitting any key in the early boot screen). In the U-boot prompt you can check that your partitions are recongnized with mmc dev 1; mmc part. You should see the names you gave them during the partitioning process. You can now boot with run sdboot.

Legacy Bring-up

This section provides information related to the legacy bring-up aka flashing resp. updating of Embedded Linux.

Note: Please try our new Toradex Easy Installer which is a Linux-based application providing a graphical selection of operating system images that users may choose to install onto the internal flash memory of Toradex modules in an extremely simple way.

Note: Please note that the Toradex Easy Installer will be the default pre-installed software for Apalis TK1, Apalis/Colibri iMX6, Colibri iMX7 and all newer modules in the future.

Note: Only the latest U-Boot (June 2013) for Colibri T30 is able to read from SD card.

#create on your Linux PC a SD card with a GPT partition formatted for ext3
$ sudo parted /dev/sd? mklabel gpt
$ sudo parted /dev/sd? mkpart "colibri ext3 1 -1"
$ sudo mkfs.ext3 /dev/sd?1

#copy the rootfs & kernel to the SD card
$ sudo mkdir /mnt/sd
$ sudo mount /dev/sd?1 /mnt/sd
$ sudo cp -Ppr /path to image/rootfs/* /mnt/sd/
$ sudo cp /path to kernel/uImage /mnt/sd/boot/uImage
$ sudo umount /mnt/sd

#put the card into your Colibri T20 system, connect a terminal and boot to the U-Boot prompt
#change the U-Boot environment so that it loads kernel and rootfs from SD card.
#check the blockdevice name by booting from internal memory first. It may change between image versions. 
Tegra2 # setenv mmcargs 'root=/dev/mmcblk0p1 ip=:::::eth0:off rw,noatime rootfstype=ext3 rootwait'
Tegra2 # setenv mmcboot 'run setup; setenv bootargs ${defargs} ${mmcargs} ${mtdparts} ${setupargs} ${vidargs}; echo Loading kernel and rootfs from MMC/SD card...; mmc dev 0 && mmc part && ext2load mmc 0:1 ${loadaddr} /boot/uImage; bootm'
Tegra2 # saveenv
Tegra2 # run mmcboot

#put the card into your Apalis/Colibri T30 system, connect a terminal and boot to the U-Boot prompt (Below example uses 8-bit slot on Apalis T30, use 'mmc dev 2 && ext2load mmc 2:1 ${loadaddr} /boot/uImage' for 4-bit slot e.g. on Ixora)
#change the U-Boot environment so that it loads kernel and rootfs from MMC/SD card.
#check the blockdevice name by booting from internal memory first. It may change between image versions.
Apalis T30 # setenv sdargs 'ip=off root=/dev/mmcblk1p1 rw,noatime rootfstype=ext3 rootwait'
Apalis T30 # setenv sdboot 'run setup; setenv bootargs ${defargs} ${sdargs} ${setupargs} ${vidargs}; echo Loading kernel and rootfs from MMC/SD Card...; mmc dev 1 && ext2load mmc 1:1 ${loadaddr} /boot/uImage; bootm ${loadaddr}'
Apalis T30 # saveenv
Apalis T30 # run sdboot

Note: For versions prior to V2.1Beta3_20140318 one has to replace above 'mmc dev [dev]' command by 'mmc part [dev]' command as U-Boot changed in that respect.

Toradex Easy Installer Bring-up

This section provides information related to the Toradex Easy Installer bring-up.

Make sure you have installed the latest U-Boot by installing the latest Version of Toradex Easy Installer.

Download a Toaradex Easy Installer image, here we assume it is an image for Apalis iMX6.

On a Linux PC run the following commands:

# untar the Toradex Easy Installer image
tar -xf apalis-imx6_lxde-image-tezi_2.8b3.111-20180626.tar
cd Apalis-iMX6_LXDE-Image-Tezi_2.8b3.111/

# Delete the SD card current partition table 
sudo dd if=/dev/zero of=/dev/sda bs=1k count=2
# Create new partition table
sudo parted /dev/sda mktable msdos
# Create partitions
sudo parted /dev/sda mkpart primary ext4 1 100M
sudo parted /dev/sda mkpart primary ext4 100 100%
# Format the partitions
sudo mkfs.ext4 -L boot /dev/sda1
sudo mkfs.ext4 -L root /dev/sda2

mkdir /tmp/boot
mkdir /tmp/root
sudo mount /dev/sda1 /tmp/boot
sudo mount /dev/sda1 /tmp/root

# Untar images to SD card
sudo tar -xf Apalis-iMX6_LXDE-Image.bootfs.tar.xz -C /tmp/boot/
sudo tar -xf Apalis-iMX6_LXDE-Image.rootfs.tar.xz -C /tmp/root/

sudo umount /tmp/boot
sudo umount /tmp/root
rm -r /tmp/boot
rm -r /tmp/root

Under U-Boot run the following command:

run sdboot

U-Boot on NAND Flash, Kernel from TFTP and Rootfs from NFS

We recommend using a second interface card on your development PC to build a dedicated network to your Colibri.


Install and configure a DHCP, TFTP and NFS server on your development PC.

  • U-Boot obtains the IP address and the name of the file containing the kernel from the DHCP server.
  • U-Boot loads the kernel from the TFTP server with 'serverip' address.
  • U-Boot sets the kernel's commandline so that the kernel mounts the rootfs from a NFS server.

  • Linux uses DHCP again to get an IP address and get the root-path arguments

  • Linux tries to mount the root file system using the root-path

Please consult your distributions documentation on what server packages are needed and how they get configured.
Setup your distributions DHCP, TFTP and NFS server. Maybe you additionally need to allow these protocols to pass through by your firewall rules. The following sample configuration may (or may not) fit your distribution.

After configuration changes and when changing the served NFS files the servers need to be restarted:
e.g. on Ubuntu: mk@ubuntu: ~ $ sudo service isc-dhcp-server restart; sudo service tftpd-hpa restart; sudo service nfs-kernel-server restart
e.g. on Fedora: [root@vm_one ~]# systemctl restart dhcpd.service; systemctl restart nfs-server.service

Sample DHCP Configuration

# dhcpd.conf
option domain-name "colibri.net";
option domain-name-servers ns1.example.org;

default-lease-time 600;
max-lease-time 7200;

# Use this to enable / disable dynamic dns updates globally.
ddns-update-style none;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

subnet 192.168.10.0 netmask 255.255.255.0 {
        default-lease-time              86400;
        max-lease-time                  86400;
        option broadcast-address        192.168.10.255;
        option domain-name              "colibri.net";
        option domain-name-servers      ns1.example.org;
        option ip-forwarding            off;
        option routers                  192.168.10.1;
        option subnet-mask              255.255.255.0;
        interface                       eth1;
        range                           192.168.10.32 192.168.10.254;
}
#MAC address dependent IP assignment, used for the colibri target device
host eval {
        filename                        "uImage";
        fixed-address                   192.168.10.2;
        hardware ethernet               00:14:2d:48:8a:58;
        next-server                     192.168.10.1;
        option host-name                "colibri";
        option root-path                "192.168.10.1:/srv/nfs/rootfs,wsize=1024,rsize=1024,v3";
}

Sample root-path for NFSv4

        option root-path                "rootfs,v4,tcp,clientaddr=0.0.0.0";

Note: For NFSv4, rootfs as given above is relative to the root path which is where exports has the option "fsid=root" set (see below).


Take care to only answer DHCP requests originating from your development network card. You won't make friends by providing addresses to clients on your corporate network!

Then, start/restart the relevant services e.g. on Ubuntu:

mk@ubuntu: ~ $ sudo service isc-dhcp-server restart

e.g. on Fedora:

[root@vm_one ~]# systemctl restart dhcpd.service

Sample TFTP Configuration

Configure the server to serve /srv/tftp.
e.g. on a recent Ubuntu: /etc/default/tftpd-hpa
e.g. on a recent Fedora: /etc/xinitd.d/tftp

Copy the kernel to the tftp directory

sudo cp -Ppr /path to kernel/uImage* /srv/tftp/

Sample NFS Configuration

Copy the rootfs to /srv/nfs/rootfs (while preserving symlinks, timestamps..)

sudo cp -Ppr /path to image/rootfs/* /srv/nfs/rootfs
NFSv3 Configuration

Create an export configuration:

#/etc/exports
/srv/nfs/rootfs 192.168.10.2(no_root_squash,no_subtree_check,rw)
NFSv4 Configuration

Create an export configuration:

#/etc/exports
/srv/nfs 192.168.10.1/24(no_root_squash,no_subtree_check,rw,fsid=root)
Apply Configuration

Start/restart the relevant daemons e.g. on Ubuntu:

mk@ubuntu: ~ $sudo service nfs-kernel-server restart

e.g. on Fedora:

[root@vm_one ~]# systemctl restart nfs-server.service

U-Boot Variables for TFTP/NFS Boot

See note about the MAC address (ethaddr) at the end of the page.

The Colibri IP address used for TFTP client, the IP address of the TFTP server, the MAC address:

ipaddr=192.168.10.2
serverip=192.168.10.1
ethaddr=00:14:2d:48:8a:58

To debug mounting root file system via NFS:

defargs=nfsrootdebug

Booting

stop in U-Boot and then:

Tegra2 # run nfsboot

to make this the default boot option:

Tegra2 # setenv bootcmd 'run nfsboot'
Tegra2 # saveenv

NFS and connman

In our images we use connman to manage network connections.
When using an NFS mounted rootfs connman is not started during boot. This is because connman takes an already configured NIC down before bringing it up again. In the case of a NFS boot this unmounts the rootfs and makes the boot fail.
Should you require connman when using NFS, e.g. to do tests with wireless connectivity, you could change the connman.service file. Make sure to change eth0 to the name of the used NIC on Apalis T30. This is likely enp7s0.

--- lib/systemd/system/connman.service~ 2014-05-02 17:01:49.000000000 +0200
+++ lib/systemd/system/connman.service  2014-06-16 09:48:08.454798634 +0200
@@ -3,14 +3,15 @@
 After=syslog.target
 Before=remote-fs.target
 # only if not NFS mount, connman will disconnect your rootfs otherwise!
-ConditionKernelCommandLine=!root=/dev/nfs
+#ConditionKernelCommandLine=!root=/dev/nfs
 
 [Service]
 Type=dbus
 BusName=net.connman
 Restart=on-failure
 ExecStartPre=-/usr/lib/connman/wired-setup
-ExecStart=/usr/sbin/connmand -n
+#ExecStart=/usr/sbin/connmand -n
+ExecStart=/usr/sbin/connmand -n -I eth0
 StandardOutput=null
 
 [Install]

Various Variables

Default Boot Scenario

After a timeout U-Boot automatically executes the statements stored in the environment variable bootcmd. By default this runs flashboot, should that fail a fall back to nfsboot is programmed. To make booting from SD card the default boot scenario do the following:

Tegra2 # printenv bootcmd
bootcmd=run flashboot; run nfsboot
Tegra2 # setenv bootcmd 'run mmcboot'
Tegra2 # saveenv

USB High Speed

To enable USB high speed have a look here: USB 2.0 High Speed (480Mbps)

Ethernet MAC Address

If no environment variable 'ethaddr' exists the Ethernet MAC address is read from the 'config block'. If you want to force an Ethernet MAC address add or change the ethaddr environment variable. Config block is a data structure shared with WinCE. It contains information written during manufacturing and configuration for the WinCE boot loader. See Config Block

Tegra2 # setenv ethaddr 00:01:02:03:04:05
Tegra2 # saveenv

eMMC Fast Boot Mode (Apalis/Colibri iMX6)

Not only does the eMMC fast boot mode allow for faster booting but it also proves more robust across various operating conditions.

Our Embedded Linux BSP V2.6 beta 1 release automatically migrates to eMMC fast boot mode when updating. Since U-Boot needs an updated U-Boot, images can not directly be downgraded anymore! Otherwise no further manual actions are needed. This section provides detailed about the eMMC fast boot mode in case custom migration/scripts are necessary.

In a not yet migrated module the fuse 0 5 has the value 00005062:

Apalis iMX6 # fuse sense 0 5
Sensing bank 0:
Word 0x00000005: 00005062

The eMMC fast boot mode can be enabled as a one-time-only fuse setting on the i.MX 6 SoC side and this mode requires an updated U-Boot to avoid a boot hang:

Apalis iMX6 # fuse prog 0 5 0x00005072
Programming bank 0 word 0x00000005 to 0x00005072...
Warning: Programming fuses is an irreversible operation!
This may brick your system.
Use this command only if you are sure of what you are doing!
Really perform this fuse programming? <y/N>

Please note that for an unattended update procedure one could avoid the confirmation question by adding an additional -y argument (e.g. fuse prog -y 0 5 0x00005072).

Note: Please pay attention to the following:

  • Programming the i.MX 6 SoC fuses is an irreversible operation!
  • Both the i.MX 6 SoC as well as the eMMC have to be configured to the exact same matching boot settings, otherwise booting will fail!
  • On the eMMC side one has to configure the hardware boot area partition settings as outlined below. So far none of our BSPs configures those settings!
  • The boot loader has to be programmed into the hardware boot area partition as automatically done since BSP V2.5 beta 2 and as outlined below. This implies that one can not easily downgrade to a BSP before V2.5 beta 2. But remember a yet unpublished U-Boot boot loader is anyway required!
  • To allow for seamless use of hardware/software system resets together with the eMMC fast boot mode one has to enable the eMMC hardware reset as well like outlined further below.

eMMC Hardware Boot Area Partitions (Apalis/Colibri iMX6 and Apalis/Colibri T30)

As part of our Embedded Linux BSPs V2.5 beta 2 (released on November 6, 2015) we unified the way all our modules with eMMC flashes are booting:

  • U-Boot now supports eMMC boot support commands (e.g. mmc bootbus and partconf).
  • U-Boot is now booted off the primary eMMC hardware boot area partition (e.g. /dev/mmcblk0boot0 in Linux).
  • The U-Boot environment is located at the end of the primary eMMC hardware boot area partition just before the config block (see below).
  • The Toradex factory configuration block (e.g. containing the serial number used for the MAC address) is located in the very last block thereof.
  • When updating from an older BSP version the config block is migrated to its new location and the relevant changes to the eMMC's configuration are done.

Boot Area Partitions Technical Background

Some pointers to further reading and how one can examine and alter the involved eMMC configuration from Linux or U-Boot.

A good overview about the thematic can be found in Micron’s TN-FC-06: Booting from Embedded MMC (e.MMC) - JEDEC v. 4.41.

Which supersedes TN-29-18.

Which in term supersedes TN-52-06.

As follows the relevant EXT_CSD registers:

BOOT_BUS_WIDTH Register (EXT_CSD [177]) = 0x16 (needed to set DDR mode and ACK at boot)
PARTITION_CONFIG Register (EXT_CSD [179]) = 0x48 (needed to enable booting from boot partition)

Boot Area Partitions Linux

Booting from boot partition disabled:

root@colibri-imx6:~# cat /sys/kernel/debug/mmc0/ios
clock: 52000000 Hz
actual clock: 49500000 Hz
vdd: 21 (3.3 ~ 3.4 V)
bus mode: 2 (push-pull)
chip select: 0 (don't care)
power mode: 2 (on)
bus width: 3 (8 bits)
timing spec: 7 (sd uhs DDR50)
signal voltage: 0 (3.30 V)
root@apalis-imx6:~# mmc extcsd read /dev/mmcblk0 | grep -e BOOT_INFO -e BOOT_SIZE_MULTI -e PARTITION_CONFIG -e BOOT_BUS_CONDITIONS
Boot Information [BOOT_INFO: 0x07]
Boot partition size [BOOT_SIZE_MULTI: 0x10]
Boot configuration bytes [PARTITION_CONFIG: 0x00]
Boot bus Conditions [BOOT_BUS_CONDITIONS: 0x00]

Former BSPs still allowed accessing the same via sysfs interface:

root@colibri-imx6:~# cat /sys/devices/soc0/soc.0/2100000.aips-bus/2198000.usdhc/mmc_host/mmc0/mmc0\:0001/boot_info
[ 1502.828197] mmc0: BKOPS_EN bit is not set
boot_info:0x07;
ALT_BOOT_MODE:1 - Supports alternate boot method
DDR_BOOT_MODE:1 - Supports alternate dual data rate during boot
HS_BOOTMODE:1 - Supports high speed timing during boot
boot_size:4096KB
boot_partition:0x00;
BOOT_ACK:0 - No boot acknowledge sent
BOOT_PARTITION-ENABLE: 0 - Device not boot enabled
boot_bus:0x00
BOOT_MODE:0 - Use single data rate + backward compatible timings in boot operation
RESET_BOOT_BUS_WIDTH:0 - Reset bus width to x1, single data rate and backwardcompatible timings after boot operation
BOOT_BUS_WIDTH:0 - x1 (sdr) or x4 (ddr) bus width in boot operation mode

For i.MX6 based modules, migrating to booting off the primary hardware boot area partition incl. flashing a new U-Boot there:

root@colibri-imx6:~# echo 0 > /sys/block/mmcblk0boot0/force_ro
root@colibri-imx6:~# dd if=u-boot.imx of=/dev/mmcblk0boot0 bs=512 seek=2
[ 222.394014] mmcblk0boot0: unknown partition table
598+0 records in
598+0 records out
root@colibri-imx6:~# echo 1 > /sys/block/mmcblk0boot0/force_ro
root@apalis-imx6:~# mmc bootpart enable 1 1 /dev/mmcblk0
root@apalis-imx6:~# mmc bootbus set single_hs x1 x8 /dev/mmcblk0
Changing ext_csd[BOOT_BUS_CONDITIONS] from 0x00 to 0x0a

Former BSPs still allowed accessing the same via sysfs interface:

root@colibri-imx6:~# echo 10 > /sys/devices/soc0/soc.0/2100000.aips-bus/2198000.usdhc/mmc_host/mmc0/mmc0\:0001/boot_bus_config
root@colibri-imx6:~# echo 8 > /sys/devices/soc0/soc.0/2100000.aips-bus/2198000.usdhc/mmc_host/mmc0/mmc0\:0001/boot_config

Booting from boot partition enabled:

root@apalis-imx6:~# mmc extcsd read /dev/mmcblk0 | grep -e BOOT_INFO -e BOOT_SIZE_MULTI -e PARTITION_CONFIG -e BOOT_BUS_CONDITIONS
Boot Information [BOOT_INFO: 0x07]
Boot partition size [BOOT_SIZE_MULTI: 0x10]
Boot configuration bytes [PARTITION_CONFIG: 0x48]
Boot bus Conditions [BOOT_BUS_CONDITIONS: 0x0a]

Former BSPs still allowed accessing the same via sysfs interface:

root@colibri-imx6:~# cat /sys/devices/soc0/soc.0/2100000.aips-bus/2198000.usdhc/mmc_host/mmc0/mmc0\:0001/boot_info
[ 76.145225] mmc0: BKOPS_EN bit is not set
boot_info:0x07;
ALT_BOOT_MODE:1 - Supports alternate boot method
DDR_BOOT_MODE:1 - Supports alternate dual data rate during boot
HS_BOOTMODE:1 - Supports high speed timing during boot
boot_size:4096KB
boot_partition:0x48;
BOOT_ACK:1 - Boot acknowledge sent during boot operation
BOOT_PARTITION-ENABLE: 1 - Boot partition 1 enabled
boot_bus:0x0a
BOOT_MODE:1 - Use single data rate + high speed timings in boot operation mode
RESET_BOOT_BUS_WIDTH:0 - Reset bus width to x1, single data rate and backwardcompatible timings after boot operation
BOOT_BUS_WIDTH:2 - x8 (sdr/ddr) bus width in boot operation mode

Note: Please pay attention to the following:

  • Changing boot_config takes effect immediately and does not require any power-cycle or the like.
  • Setting boot_partition back to 0x00 actually allows switching back to our current way of booting.
  • By default eMMC boot partitions are read-only and disabling via force_ro is only temporary and does not persist.
  • The Toradex Easy Installer does this configuration in a so-called wrap-up script.
  • Linux kernels used in later BSPs do no longer allow accessing the boot_info via sysfs and you may use the mmc binary from the mmc-utils-cos package instead. Syntax is compatible to the U-Boot mmc command as explained below.

Boot Area Partitions U-Boot

Enable boot partition from within U-Boot (requires enabling CONFIG_SUPPORT_EMMC_BOOT first):

mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode
- Set the BOOT_BUS_WIDTH field of the specified device

Configure the eMMC to 8-bit, reset bus width settings to default after boot operation, single data rate and high-speed timings in boot operation mode:

Colibri iMX6 # mmc bootbus 0 2 0 1
mmc partconf dev boot_ack boot_partition partition_access
- Change the bits of the PARTITION_CONFIG field of the specified device

Enable booting from the (hardware) boot area partition 1 and the boot acknowledge to be sent during boot operation:

Colibri iMX6 # mmc partconf 0 1 1 0

Resetting to old behaviour:

Colibri iMX6 # mmc bootbus 0 0 0 0
Colibri iMX6 # mmc partconf 0 0 0 0

eMMC Hardware Reset (Apalis/Colibri iMX6)

By default the eMMC hardware reset signal RST_n is not enabled. Whether or not it should be permanently disabled or enabled can be configured one-time-only from within U-Boot:

mmc rst-function dev value
- Change the RST_n_FUNCTION field of the specified device
WARNING: This is a write-once field and 0 / 1 / 2 are the only valid values.

The following one-time-only setting permanently enables the eMMC hardware reset signal:

Colibri iMX6 # mmc rst-function 0 1

Or from within Linux:

root@apalis-imx6:~# mmc hwreset enable /dev/mmcblk0