Booting mx25 based device from SD and NOR

Roberto Nibali rnibali at gmail.com
Wed May 23 06:43:47 EDT 2012


Hi Sascha

> I have been trying to boot a customized mx25 based device using barebox
> and
> > I seem to be missing a few basic pointers, I believe, since it does not
> > work. I have attached my config and put my current patch-set online:
> > http://pastebin.com/KUVAwWRk. It's based on git commit 'dadcf5bd8f715'.
> >
> > I don't know if the way of adding the boatloader to the SD card for later
> > installing it onto NOR flash is the correct one. I currently issue a:
> >
> > sudo dd if=barebox.bin of=/dev/sdc bs=512 skip=2 seek=2 && sync
> >
>
> You have configured barebox for external boot mode. This is not suitable
> for SD cards, you have to use internal bootmode instead. This requires
> that you provide a dtd header, see for example the babbage board for how
> to do this.
>
>
To be honest, after reading section 7 in the RM of the mx24, reading dozens
of post, your comments in the source code with regard to internal vs.
external boot, I still seem to be confused.

Nevertheless, your suggestion works!! Also, they way I setup my SD card was
slightly wrong; the reserved 2048 sectors on my SD card confused me, but
the reason is the 8-byte alignment boundary for speed reasons. To better
document things, here are the steps that lead to my mx25 based device
booting barebox as first stage boot loader from SD card in internal boot
mode  (my SD card being detected as /dev/sdc):

root at pc-develop:~# fdisk -l /dev/sdc

Disk /dev/sdc: 2002 MB, 2002780160 bytes
62 heads, 62 sectors/track, 1017 cylinders, total 3911680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xfb7a8756

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048        4095        1024   83  Linux
/dev/sdc2            4096     1052671      524288    b  W95 FAT32
/dev/sdc3         1052672     3911679     1429504   83  Linux
root at pc-develop:~# umount /media/216B-BCD2
root at pc-develop:~# mkfs.vfat /dev/sdc2
mkfs.vfat 3.0.12 (29 Oct 2011)
root at pc-develop:~# mkfs.ext3 /dev/sdc3
mke2fs 1.42 (29-Nov-2011)
[...]
root at pc-develop:~# dd if=./barebox.bin of=/dev/sdc1 bs=512
553+1 records in
553+1 records out
283144 bytes (283 kB) copied, 0.0504609 s, 5.6 MB/s

Set the switches to boot from SD on the mx25 device and power on. It
successfully loads barebox and I can mount the fat partition (of course the
other partition is unmountable, because there is no ext2/3 support in
barebox). Booting from my environment currently fails, but I reckon it has
to do with my configuration settings. Here is where it gets so far:

[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Memory: 64MB = 64MB total
[    0.000000] Memory: 57860k/57860k available, 7676k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xc4800000 - 0xff000000   ( 936 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc062e608   (6298 kB)
[    0.000000]       .init : 0xc062f000 - 0xc0665000   ( 216 kB)
[    0.000000]       .data : 0xc0666000 - 0xc06a4a48   ( 251 kB)
[    0.000000]        .bss : 0xc06a4a6c - 0xc06e7084   ( 266 kB)
[    0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0,
CPUs=1, Nodes=1
[    0.000000] NR_IRQS:336
[    0.000000] MXC IRQ initialized
[    0.000000] CPU identified as i.MX25, unknown revision
[    0.000000] sched_clock: 32 bits at 66MHz, resolution 15ns, wraps every
64585ms
[    0.000000] Console: colour dummy device 80x30
[    0.000494] Calibrating delay loop... 199.06 BogoMIPS (lpj=995328)
[    0.070322] pid_max: default: 32768 minimum: 301
[    0.070847] Mount-cache hash table entries: 512
[    0.072033] CPU: Testing write buffer coherency: ok
[    0.072302] ftrace: allocating 15086 entries in 45 pages
[    0.168557] Setting up static identity map for 0x80480fc8 - 0x80481004
[    0.171939] devtmpfs: initialized
[    0.175457] NET: Registered protocol family 16
[    0.187052] gpiochip_add: registered GPIOs 0 to 31 on device:
imx31-gpio.0
[    0.189598] gpiochip_add: registered GPIOs 32 to 63 on device:
imx31-gpio.1
[    0.191705] gpiochip_add: registered GPIOs 64 to 95 on device:
imx31-gpio.2
[    0.193832] gpiochip_add: registered GPIOs 96 to 127 on device:
imx31-gpio.3
[    0.320820] bio: create slab <bio-0> at 0
[    0.326517] SCSI subsystem initialized
[    0.330858] usbcore: registered new interface driver usbfs
[    0.331815] usbcore: registered new interface driver hub
[    0.332898] usbcore: registered new device driver usb
[    0.343553] Advanced Linux Sound Architecture Driver Version 1.0.24.
[    0.347646] Bluetooth: Core ver 2.16
[    0.348460] NET: Registered protocol family 31
[    0.348508] Bluetooth: HCI device and connection manager initialized
[    0.348556] Bluetooth: HCI socket layer initialized
[    0.348590] Bluetooth: L2CAP socket layer initialized
[    0.348704] Bluetooth: SCO socket layer initialized
[    0.351609] cfg80211: Calling CRDA to update world regulatory domain
[    0.353985] Switching to clocksource mxc_timer1
[    0.499000] NET: Registered protocol family 2
[    0.499750] IP route cache hash table entries: 1024 (order: 0, 4096
bytes)
[    0.501890] TCP established hash table entries: 2048 (order: 2, 16384
bytes)
[    0.502117] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.502236] TCP: Hash tables configured (established 2048 bind 2048)
[    0.502269] TCP reno registered
[    0.502316] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.502402] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.503200] NET: Registered protocol family 1
[    0.504788] RPC: Registered named UNIX socket transport module.
[    0.504838] RPC: Registered udp transport module.
[    0.504867] RPC: Registered tcp transport module.
[    0.504894] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.507432] FQ mxc_sim driver started: v1.1 (2012/02/21)
[    0.585854] NTFS driver 2.1.30 [Flags: R/W].
[    0.588284] JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[    0.591345] fuse init (API version 7.18)
[    0.595203] msgmni has been set to 113
[    0.601501] Block layer SCSI generic (bsg) driver version 0.4 loaded
(major 253)
[    0.601562] io scheduler noop registered
[    0.601755] io scheduler cfq registered (default)
[    0.607105] imx-sdma imx35-sdma: loaded firmware 1.0
[    0.635752] imx-sdma imx35-sdma: initialized
[    0.637804] Serial: IMX driver
[    0.638199] imx21-uart.0: ttymxc0 at MMIO 0x43f90000 (irq = 45) is a IMX
[    1.089977] console [ttymxc0] enabled
[    1.118473] loop: module loaded
[    1.121838] at24 0-0050: 65024 byte 24c16 EEPROM, writable, 128
bytes/write
[    1.135587] physmap platform flash device: 04000000 at a0000000
[    1.146468] physmap-flash physmap-flash.0: map_probe failed
[    1.181758] spi_imx_setup: mode 3, 8 bpw, 20000000 hz
[    1.187997] spi_imx imx35-cspi.2: probed
[    1.196679] FEC Ethernet Driver
[    1.207440] fec_enet_mii_bus: probed
[    1.216038] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.222774] mxc-ehci mxc-ehci.0: initializing i.MX USB Controller
[    1.254156] mxc-ehci mxc-ehci.0: Freescale On-Chip EHCI Host Controller
[    1.261079] mxc-ehci mxc-ehci.0: new USB bus registered, assigned bus
number 1
[    1.294278] mxc-ehci mxc-ehci.0: irq 37, io mem 0x53ff4000
[    1.314205] mxc-ehci mxc-ehci.0: USB 2.0 started, EHCI 1.00
[    1.320074] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.327010] usb usb1: New USB device strings: Mfr=3, Product=2,
SerialNumber=1
[    1.334342] usb usb1: Product: Freescale On-Chip EHCI Host Controller
[    1.340823] usb usb1: Manufacturer: Linux 3.3.4-00448-g80850fc-dirty
ehci_hcd
[    1.348051] usb usb1: SerialNumber: mxc-ehci.0
[    1.355432] hub 1-0:1.0: USB hub found
[    1.359293] hub 1-0:1.0: 1 port detected
[    1.363954] mxc-ehci mxc-ehci.1: initializing i.MX USB Controller
[    1.394159] mxc-ehci mxc-ehci.1: Freescale On-Chip EHCI Host Controller
[    1.400983] mxc-ehci mxc-ehci.1: new USB bus registered, assigned bus
number 2
[    1.434279] mxc-ehci mxc-ehci.1: irq 35, io mem 0x53ff4400
[    1.454377] mxc-ehci mxc-ehci.1: USB 2.0 started, EHCI 1.00
[    1.460251] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    1.467188] usb usb2: New USB device strings: Mfr=3, Product=2,
SerialNumber=1
[    1.474518] usb usb2: Product: Freescale On-Chip EHCI Host Controller
[    1.480999] usb usb2: Manufacturer: Linux 3.3.4-00448-g80850fc-dirty
ehci_hcd
[    1.488224] usb usb2: SerialNumber: mxc-ehci.1
[    1.495664] hub 2-0:1.0: USB hub found
[    1.499525] hub 2-0:1.0: 1 port detected
[    1.506043] usbcore: registered new interface driver uas
[    1.511399] Initializing USB Mass Storage driver...
[    1.517643] usbcore: registered new interface driver usb-storage
[    1.523694] USB Mass Storage support registered.
[    1.529647] usbcore: registered new interface driver libusual
[    1.537456] usbcore: registered new interface driver usbserial
[    1.544447] USB Serial support registered for generic
[    1.550387] usbcore: registered new interface driver usbserial_generic
[    1.557266] usbserial: USB Serial Driver core
[    1.562532] usbcore: registered new interface driver fq_cpr40
[    1.569460] usbcore: registered new interface driver sisusb
[    1.579705] imxdi_rtc imxdi_rtc.0: rtc core: registered imxdi_rtc as rtc0
[    1.587516] i2c /dev entries driver
[    1.592996] Driver for 1-wire Dallas network protocol.
[    1.603270] imx2-wdt imx2-wdt.0: IMX2+ Watchdog Timer enabled.
timeout=60s (nowayout=0)
[    1.613364] usbcore: registered new interface driver btusb
[    1.619238] cpuidle: using governor ladder
[    1.623379] cpuidle: using governor menu
[    1.628129] sdhci: Secure Digital Host Controller Interface driver
[    1.634609] sdhci: Copyright(c) Pierre Ossman
[    1.639176] spi_imx_setup: mode 3, 8 bpw, 20000000 hz
[    1.644533] mmc_spi spi2.0: ASSUMING 3.2-3.4 V slot power
[    1.651878] mmc_spi spi2.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
[    1.659804] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.681925] sdhci_pltfm_init: MMC quirks: 651ec000 (1696514048)
[    1.814297] usb 2-1: new full-speed USB device number 2 using mxc-ehci
[    1.838533] sdhci [sdhci_add_host()]: mmc1: Auto-CMD23 unavailable
[    1.985712] usb 2-1: not running at top speed; connect to a high speed
hub
[    2.011883] usb 2-1: New USB device found, idVendor=0424, idProduct=2513
[    2.043754] usb 2-1: New USB device strings: Mfr=0, Product=0,
SerialNumber=0
[    2.055683] esdhc_set_clock: Current dividers: pre_div=2 div=1
[    2.077609] mmc1: SDHCI controller on sdhci-esdhc-imx25.0
[sdhci-esdhc-imx25.0] using DMA
[    2.134930] hub 2-1:1.0: USB hub found
[    2.145712] hub 2-1:1.0: 3 ports detected
[    2.176905] usbcore: registered new interface driver usbhid
[    2.182523] usbhid: USB HID core driver
[    4.674272] spi_imx_setup: mode 7, 8 bpw, 20000000 hz
[    4.681104] spi_imx_setup: mode 3, 8 bpw, 20000000 hz
[    4.688547] aic3x_i2c_probe: Probing for TLV320AIC3x (selected
model=AIC3101)
[    4.696167] spi_imx_setup: mode 3, 8 bpw, 400000 hz
[    4.701859] aic3x_modinit: Success registering the TLV320AIC3x I2C driver
[    4.713884] aic3x_probe: Probing AIC3x
[    4.718488] aic3x_init: Setting Default Volume, Routes and Mute
[    4.724688] aic3x_probe: Setting AIC3x snd_controls
[    4.729819] spi_imx_setup: mode 3, 8 bpw, 400000 hz
[    4.735520] aic3x_probe: Adding AIC3x widgets
[    4.745137] spi_imx_setup: mode 3, 8 bpw, 400000 hz
[    4.752725] spi_imx_setup: mode 3, 8 bpw, 400000 hz
[    4.759139] asoc: tlv320aic3x-hifi <-> imx-ssi.0 mapping ok
[    4.766926] spi_imx_setup: mode 3, 8 bpw, 400000 hz
[    4.775269] spi_imx_setup: mode 3, 8 bpw, 400000 hz
[    4.780267] mmc0: host doesn't support card's voltages
[    4.787462] ASoC: Platform initialized
[    4.791252] ALSA device list:
[    4.794576]   #0: noah-audio
[    4.800269] TCP cubic registered
[    4.803540] NET: Registered protocol family 17
[    4.808211] mmc0: error -22 whilst initialising SDIO card
[    4.814457] spi_imx_setup: mode 3, 8 bpw, 400000 hz
[    4.819633] Bluetooth: RFCOMM TTY layer initialized
[    4.824939] Bluetooth: RFCOMM socket layer initialized
[    4.830245] spi_imx_setup: mode 3, 8 bpw, 400000 hz
[    4.835465] Bluetooth: RFCOMM ver 1.11
[    4.839258] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    4.844912] Bluetooth: BNEP filters: protocol multicast
[    4.850216] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[    4.856400] spi_imx_setup: mode 3, 8 bpw, 400000 hz
[    4.863768] imxdi_rtc imxdi_rtc.0: setting system clock to 1970-01-01
00:00:03 UTC (3)
[    4.872019] spi_imx_setup: mode 3, 8 bpw, 400000 hz
[    4.877172] mmc0: host doesn't support card's voltages
[    4.882342] mmc0: error -22 whilst initialising SD card
[    4.889411] eth0: Freescale FEC PHY driver [SMSC LAN8710/LAN8720]
(mii_bus:phy_addr=imx25-fec-1:00, irq=-1)
[    4.900151] spi_imx_setup: mode 3, 8 bpw, 400000 hz
[    4.906156] spi_imx_setup: mode 3, 8 bpw, 400000 hz
[    4.911135] mmc0: host doesn't support card's voltages
[    4.916461] mmc0: error -22 whilst initialising MMC card
[    4.922858] esdhc_set_clock: Current dividers: pre_div=2 div=1
[    4.944164] esdhc_set_clock: Current dividers: pre_div=2 div=1
[    4.950040] esdhc_set_clock: Adjustment 1 dividers: pre_div=16 div=11
[    4.956510] desired SD clock: 400000, actual=377840 (max=66500000)
[    4.962715] esdhc_set_clock: Adjustment 2 dividers: pre_div=1 div=1
[    5.010020] mmc1: host does not support reading read-only switch.
assuming write-enable.
[    5.019134] esdhc_set_clock: Current dividers: pre_div=2 div=1
[    5.025008] esdhc_set_clock: Adjustment 1 dividers: pre_div=2 div=1
[    5.031304] desired SD clock: 50000000, actual=33250000 (max=66500000)
[    5.037857] esdhc_set_clock: Adjustment 2 dividers: pre_div=1 div=1
[    5.045723] mmc1: new high speed SD card at address 0002
[    5.052267] blk_limits_max_hw_sectors: set to minimum 8
[    5.058272] mmcblk0: mmc1:0002 00000 1.86 GiB
[    5.072167]  mmcblk0: p1 p2 p3
[    6.884651] PHY: imx25-fec-1:00 - Link is Up - 100/Full
[    6.924205] Sending DHCP requests ., OK
[    7.934638] IP-Config: Got DHCP answer from 0.0.0.0, my address is
192.168.1.211
[    7.942931] IP-Config: Complete:
[    7.946490]      device=eth0, addr=192.168.1.211, mask=255.255.255.0,
gw=192.168.1.1,
[    7.954238]      host=192.168.1.211, domain=domini.int,
nis-domain=(none),
[    7.961160]      bootserver=0.0.0.0, rootserver=192.168.1.23, rootpath=
[  103.029081] VFS: Unable to mount root fs via NFS, trying floppy.
[  103.036763] VFS: Cannot open root device "nfs" or unknown-block(2,0)
[  103.043157] Please append a correct "root=" boot option; here are the
available partitions:
[  103.052007] b300         1955840 mmcblk0  driver: mmcblk
[  103.057512]   b301            1024 mmcblk0p1
00000000-0000-0000-0000-000000000mmcblk0p1
[  103.065670]   b302          524288 mmcblk0p2
00000000-0000-0000-0000-000000000mmcblk0p2
[  103.073744]   b303         1429504 mmcblk0p3
00000000-0000-0000-0000-000000000mmcblk0p3
[  103.081904] Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(2,0)
[  103.090367] [<c000fb8c>] (unwind_backtrace+0x0/0x13c) from [<c047e360>]
(dump_stack+0x20/0x24)
[  103.099148] [<c047e360>] (dump_stack+0x20/0x24) from [<c047e3f0>]
(panic+0x8c/0x1d0)
[  103.107044] [<c047e3f0>] (panic+0x8c/0x1d0) from [<c062fc38>]
(mount_block_root+0x164/0x214)
[  103.115630] [<c062fc38>] (mount_block_root+0x164/0x214) from
[<c062fdc4>] (mount_root+0xdc/0x100)
[  103.124644] [<c062fdc4>] (mount_root+0xdc/0x100) from [<c062ff0c>]
(prepare_namespace+0x124/0x188)
[  103.133674] [<c062ff0c>] (prepare_namespace+0x124/0x188) from
[<c062f890>] (kernel_init+0xf4/0x128)
[  103.142860] [<c062f890>] (kernel_init+0xf4/0x128) from [<c000a5c8>]
(kernel_thread_exit+0x0/0x8)

Thank you very much for your pointers.

Best regards
Roberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/barebox/attachments/20120523/b1481bb7/attachment-0001.html>


More information about the barebox mailing list