load kernel from SD card in U-boot

cancel
Showing results for 
Search instead for 
Did you mean: 

load kernel from SD card in U-boot

34,866 Views
Contributor II

Hello,

I would like to ask question how to load image from SD-card with U-boot running.

My setup is:

- U-boot loaded to i.MX6sl through serial download mode (because I compile under Linux, I have been using imx_usb to put U-boot on board)

- I have serial console working and steps I set:

Hit any key to stop autoboot:  0

U-Boot > setenv loadaddr 0x80800000

U-Boot > setenv bootargs_base 'setenv bootargs console=ttymxc0,115200'

U-Boot > setenv kernel 'uImage'

U-Boot > setenv bootargs_mmc 'setenv bootargs ${bootargs} root=/dev/mmcblk0p1 rootwait rw'

U-Boot > setenv bootcmd_mmc 'run bootargs_base bootargs_mmc;mmc dev 2;mmc read ${loadaddr} 0x800 0x1800;bootm

U-Boot > setenv bootcmd 'run bootcmd_mmc'

U-Boot > saveenv

Saving Environment to MMC...

Writing to MMC(2)... done

U-Boot > run bootcmd

mmc2 is current device

MMC read: dev # 2, block # 2048, count 6144 ... 6144 blocks read: OK

Wrong Image Format for bootm command

ERROR: can't get kernel image!

I am using SD3 so card is seen on 2nd port.

I think that problem is with proper path settings to uImage (I wish to see line 'Uncompressing Linux....')

Card I am using have 2 partitions 1st fat bootable, 2nd Linux partition:

:~/$ cat /proc/partitions

major minor  #blocks  name

   8  49  8192 sdd1
   8  50544768 sdd2

How should I change my setting to be able to load from /sdd2/boot/uImage ?

uImage info:

Image Name:   Linux-3.0.35-02887-g731b440-dirt

Created:      Mon Nov 23 14:49:09 2015

Image Type:   ARM Linux Kernel Image (uncompressed)

Data Size:    3567572 Bytes = 3483.96 kB = 3.40 MB

Load Address: 10008000

Entry Point:  10008000

  Image arch/arm/boot/uImage is ready

Labels (1)
Tags (4)
0 Kudos
6 Replies

1,062 Views
NXP TechSupport
NXP TechSupport

HI Pawel

/dev/mmcblk0 corresponds to  MMC/SD Slot 1 as

described on p.25 attached i.MX6SL EVK Linux Guide.

Also it may be useful to look at Release Notes

Table 7. Kernel Boot Parameters

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

1,062 Views
Contributor II

Hi Igor,

Realy apprechiate how much You are helping. Thank You a lot. It takes me some time for me to figure it out since I was trying to download kernel through serial (possible) and to build descent one for my usage. So now I am step closer to success. So my situation is:

I have SD card with two partitions:

1st fat

2nd ext3

I can 'boot' uImage from both (fatload mmc 0:1 0x80800000 uImage) (ext2load mmc 0:2 0x80800000 /boot/uImage) but for this content lets assume that I have been using 2nd partition ext3.

I can list it:

MX6Sl EVK U-Boot > mmc dev 0

mmc0 is current device

MX6Sl EVK U-Boot > ext2ls mmc 0:2

<DIR>       4096 .

<DIR>       4096 ..

<DIR>      16384 lost+found

<DIR>       4096 mnt

<DIR>       4096 var

<DIR>       4096 etc

<DIR>       4096 lib

<DIR>       4096 usr

<DIR>       4096 opt

<DIR>       4096 home

<DIR>       4096 boot

<DIR>       4096 sys

<DIR>       4096 bin

<DIR>       4096 proc

<DIR>       4096 run

<DIR>       4096 dev

<DIR>       4096 unit_tests

<DIR>       4096 sbin

<DIR>       4096 tmp

<DIR>       4096 media

So I can say that this is not hardware problem.

Ok. So I am loading it and run:

MX6Sl EVK U-Boot > ext2load mmc 0:2 0x80800000 /boot/uImage

Loading file "/boot/uImage" from mmc device 0:2 (xxa2)

3330308 bytes read

MX6Sl EVK U-Boot > bootm 0x80800000

## Booting kernel from Legacy Image at 80800000 ...

   Image Name:   Linux-3.0.35-02887-g731b440-dirt

   Image Type:   ARM Linux Kernel Image (uncompressed)

   Data Size:    3330244 Bytes =  3.2 MB

   Load Address: 80008000

   Entry Point:  80008000

   Verifying Checksum ... 

Everything goes quite nice untill it try to mount filesystem (I try mtdblock2 since I expect there will be filesystem)

VFS: Cannot open root device "mtdblock2" or unknown-block(0,0)

Please append a correct "root=" boot option; here are the available partitions:

1f00              64 mtdblock0

(driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

And when I try to mount only one visible mtdblock0 (size 64 -> definitely sth is wrong here)

jffs2: Too few erase blocks (2)

List of all partitions:

1f00              64 mtdblock0  (driver?)

No filesystem could mount root, tried:  jffs2

Of course jffs2/ext3 no difference.

My idea was that there were missing drivers for ext3, but they are build in kernel (*file.png).

I attach whole log (close.txt) if some more info is needed.

Any ideas? Hint? Any help will be great Smiley Happy

0 Kudos

1,062 Views
Contributor II

Ok I am closer Smiley Happy

"host SD card with different parameters than your own U-Boot" <-- there were key.

I change card MUX setting on configuration files.

(had 8bit support while using only 4 to communicate with SD).

For other have same problem look at (board-mx6...c with SD cards and headers board-mx6...common.h and iomux-mx6...h)

Now kernel command line look:

Kernel command line: noinitrd console=ttymxc0,115200 root=/dev/mmcblk0p2 rootwait rw rootfstype=ext3 ip=off

now partitions are visible.

VFS: Cannot open root device "mmcblk0p2" or unknown-block(179,2)

Please append a correct "root=" boot option; here are the available partitions:

mmc1: mmc_rescan_try_freq: trying to init card at 100000 Hz

1f00              64 mtdblock0  (driver?)

b300         3931136 mmcblk0  driver: mmcblk

  b301          204800 mmcblk0p1 00000000-0000-0000-0000-000000000000

  b302         3725312 mmcblk0p2 00000000-0000-0000-0000-000000000000

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,2)

so close but why it is not booting since it looks ok?

0 Kudos

1,062 Views
NXP TechSupport
NXP TechSupport

HI Pawel

what board/Linux distribution you are using,

Is it freescale from i.MX6SL EVK product page ?

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=IMX6SLEVK&fpsp=1&tab=Design_Tools_Tab

Also you are using kernel command line:

noinitrd console=ttymxc0,115200 root=/dev/mtdblock0 rw rootfstype=jffs2 ip=off

Had you read suggested attached documents, it never show such command line.

Best regards

igor

0 Kudos

1,062 Views
Contributor II

Board based on i.MX6SL EVK (thats why I am using sources from this board).

Linux:

git://github.com/embest-tech/linux-imx.git -b embest_imx_3.0.35_4.0.0

Which has imx6s_defconfig and have support to imx6sl processors (support.png)

Yes I think I read almost every one more than once.

usually they advice sth like:

root=/dev/mmcblkXpY

while kernel doesn't see any partition available except mtdblock0. If I set boot_comand to mount root from /dev/mmcblkXpY error is same as 1st log:

VFS: Cannot open root device "mtdblock2" or unknown-block(0,0)

later jffs or ext.. doesn't metter since kernel can't find device.

0 Kudos

1,062 Views
NXP TechSupport
NXP TechSupport

for embest distribution please post this to

meta-fsl-arm mailing list, so that someone familiar with that board could try to assist you.

https://lists.yoctoproject.org/listinfo/meta-freescale

Best regards

igor

0 Kudos