Skip to content
ckuethe edited this page Dec 13, 2014 · 15 revisions

You may wish to keep multiple kernels on disk; in this example the `uname_r` environment variable is used to select the kernel to boot.

mmcinfo
ext2ls mmc 0:1 /boot

setenv bootdelay 5
setenv bootargs 'console=ttymxc0,115200 root=/dev/mmcblk0p1 rootwait rw panic=5'
setenv bootcmd 'ext2load mmc 0:1 0x70800000 /boot/${uname_r}/uImage; ext2load mmc 0:1 0x71000000 /boot/${uname_r}/imx53-usbarmory.dtb; bootm 0x70800000 - 0x71000000'
saveenv

setenv bootargs "${bootargs} ${bootargs_disk} ${bootargs_debug}"

boot

It is possible to load a kernel over the SerialConsole using the xmodem or ymodem protocols. Below is an example of this; don't worry about the panic, it's because of the unformatted microsd card.

loady 0x71000000
## Ready for binary (ymodem) download to 0x71000000 at 115200 bps...
C146(SOH)/0(STX)/0(CAN) packets, 5 retries
## Total Size      = 0x000047b1 = 18353 Bytes
=> loady 0x70800000
## Ready for binary (ymodem) download to 0x70800000 at 115200 bps...
C 15034(SOH)/0(STX)/0(CAN) packets, 4 retries
## Total Size      = 0x001d5bd8 = 1924056 Bytes
=> boot
## Booting kernel from Legacy Image at 70800000 ...
   Image Name:   Linux-3.18.0
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1923992 Bytes = 1.8 MiB
   Load Address: 70008000
   Entry Point:  70008000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 71000000
   Booting using the fdt blob at 0x71000000
   Loading Kernel Image ... OK
   Loading Device Tree to 8f566000, end 8f56d7b0 ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 3.18.0 (ckuethe@ambiflex) (gcc version 4.9.1 (Ubuntu/Linaro 4.9.1-16ubuntu6) ) #1 PREEMPT Sat Dec 13 13:37:37 PST 2014
CPU: ARMv7 Processor [412fc085] revision 5 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: Inverse Path USB Armory
Memory policy: Data cache writeback
CPU: All CPU(s) started in SVC mode.
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk0p1 rootwait rw
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 515844K/524288K available (2671K kernel code, 124K rwdata, 784K rodata, 128K init, 90K bss, 8444K reserved, 0K highmem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
    vmalloc : 0xa0800000 - 0xff000000   (1512 MB)
    lowmem  : 0x80000000 - 0xa0000000   ( 512 MB)
    pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)
    modules : 0x7f000000 - 0x7fe00000   (  14 MB)
      .text : 0x80008000 - 0x80367e84   (3456 kB)
      .init : 0x80368000 - 0x80388000   ( 128 kB)
      .data : 0x80388000 - 0x803a7060   ( 125 kB)
       .bss : 0x803a7060 - 0x803bd8b0   (  91 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
NR_IRQS:16 nr_irqs:16 16
TrustZone Interrupt Controller (TZIC) initialized
CPU identified as i.MX53, silicon rev 2.1
Switching to timer-based delay loop, resolution 29ns
sched_clock: 32 bits at 33MHz, resolution 29ns, wraps every 128849015778ns
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 66.66 BogoMIPS (lpj=333333)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x7028d340 - 0x7028d398
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 2
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
cpuidle: using governor menu
imx53-pinctrl 53fa8000.iomuxc: initialized IMX pinctrl driver
i2c i2c-1: IMX I2C adapter registered
i2c i2c-0: IMX I2C adapter registered
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
Switched to clocksource mxc_timer1
NET: Registered protocol family 2
TCP established hash table entries: 4096 (order: 2, 16384 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
futex hash table entries: 256 (order: -1, 3072 bytes)
msgmni has been set to 1007
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
imx-sdma 63fb0000.sdma: failed to get firmware from device tree
imx-sdma 63fb0000.sdma: initialized
Serial: IMX driver
imx-uart 53fbc000.serial: ttymxc0 at MMIO 0x53fbc000 (irq = 47, base_baud = 4166666) is a IMX
console [ttymxc0] enabled
loop: module loaded
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
sdhci-esdhc-imx 50004000.esdhc: No vmmc regulator found
sdhci-esdhc-imx 50004000.esdhc: No vqmmc regulator found
mmc0: SDHCI controller on 50004000.esdhc [50004000.esdhc] using ADMA
sdhci-esdhc-imx 50020000.esdhc: No vmmc regulator found
sdhci-esdhc-imx 50020000.esdhc: No vqmmc regulator found
mmc0: host does not support reading read-only switch, assuming write-enable
mmc0: new high speed SDHC card at address ba66
mmcblk0: mmc0:ba66 SU04G 3.69 GiB 
mmc1: SDHCI controller on 50020000.esdhc [50020000.esdhc] using ADMA
 mmcblk0: unknown partition table
TCP: cubic registered
NET: Registered protocol family 17
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
VFS: Cannot open root device "mmcblk0p1" or unknown-block(179,1): error -6
Please append a correct "root=" boot option; here are the available partitions:
b300         3872256 mmcblk0  driver: mmcblk
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)
Rebooting in 5 seconds..

uBoot's env tools now support reading and writing settings from MMC; a suitable version of fw_printenv can be cross compiled with `env ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make env`. The resulting `fw_printenv` tool can be copied into userland and symlinked to `fw_setenv`; buildroot does this correctly. This is the required configuration file

root@usbarmory:~# cat /etc/fw_env.config 
# Device name    NVRAM offset    Env. size
/dev/mmcblk0     0x60000         0x2000
Clone this wiki locally