Skip to contentSkip to conversation

using initrd with U-boot on the imx28evk

U-Boot Bill 4 participants 11 messages Sep 11, 2012 – Sep 18, 2012

lore
Share & tools
lore

Bill

author
#0 lore raw

Has anyone used U-boot on the imx28evk with initrd to setup a small rootfs in RAM? I need the ability to do have a small temp rootfs to assist in mounting a full rootfs from a USB for field upgrade purposes.

Thanks,
Bill

#1 lore raw

Dear Bill,

Quoted 3 lines

Has anyone used U-boot on the imx28evk with initrd to setup a small rootfs in RAM? I need the ability to do have a small temp rootfs to assist in mounting a full rootfs from a USB for field upgrade purposes.

Yes, it's a linux thingie though. What's the problem? What version of uboot do you use?

Quoted 2 lines

Thanks,
Bill

Best regards,
Marek Vasut

author
#2 lore raw

I'm using U-boot version: U-Boot 2012.07

Through googling, I've come across several variations of using a ramdisk. So I selected some things that looked good. So basically, I am building a rootfs as a ramdisk by:

dd if=/dev/zero of=./myinitrd.img bs=1M count=35 mke2fs -m 1 ./myinitrd.img
mkdir ./myinitrd
mount -t ext2 ./myinitrd.img ./myinitrd -o loop cp -r rootfs/* ./myinitrd/.
umount ./myinitrd/
gzip ./myinitrd.img
rm -rf myinitrd

Then I use the u-boot tool to prepare it for use with u-boot by:
u-boot-imx/tools/mkimage -n 'MyRamDisk' -A arm -O linux -T
ramdisk -C none -d ./myinitrd.img.gz rootfs-initrd

I place both both my uImage and rootfs-initrd on a USB stick and insert it into the imx28evk and enter u-boot command line. I then do:

    usb start
    fatload usb 0 0x42000000 uimage
    fatload usb 0 0x43000000 rootfs-initrd
    setenv bootargs console=ttyAM0,115200n8 debug root=/dev/ram rw  
ip=dhcp  fec_mac=
    bootm 0x42000000 0x43000000

u-boot then starts booting with:

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

    Image Name:   Linux-2.6.35.3-571-gcca29a0-g45b
    Created:      2012-09-08  22:31:46 UTC
    Image Type:   ARM Linux Kernel Image (uncompressed)
    Data Size:    2582304 Bytes = 2.5 MiB
    Load Address: 40008000
    Entry Point:  40008000
    Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 43000000 ...
    Image Name:   MyRamDisk
    Created:      2012-09-12  20:51:35 UTC
    Image Type:   ARM Linux RAMDisk Image (uncompressed)
    Data Size:    37774 Bytes = 36.9 KiB

Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.35.3-571-gcca29a0-g45b53d0-dirty (blsousan at ubuntu) (gcc version 4.4.4 (4.4.4_09.06.2010) ) #13 PREEMPT Sat Sep 8 14:06:34 PDT 2012
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Freescale MX28EVK board
....
....
....

The kernel starts to boot, I get all the kernel output, and at the end it does not find the rootfs. I get:

...
...
...

List of all partitions:
b300 3872256 mmcblk0 driver: mmcblk
b301 1024 mmcblk0p1
0800 503808 sda driver: sd
0801 503792 sda1
No filesystem could mount root, tried: ext3 ext2 vfat msdos iso9660

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

I not sure how the kernel knows where the ramdisk lives in memory ( 0x43000000) where the the uboot put it ?

Thanks,
Bill

Quoted 12 lines · Marek Vasut

Dear Bill,

Quoted 3 lines

Has anyone used U-boot on the imx28evk with initrd to setup a small rootfs in RAM? I need the ability to do have a small temp rootfs to assist in mounting a full rootfs from a USB for field upgrade purposes.

Yes, it's a linux thingie though. What's the problem? What version of uboot do you use?

Quoted 2 lines

Thanks,
Bill

Best regards,
Marek Vasut

Signature · 8 lines
William (Bill) L. Sousan, Ph.D.
(w) 402.331.4977 ext. 4002
bsousan at techsi.com
Technical Support Inc.
11253 John Galt Blvd
Omaha, NE 68137
www.techsi.com
8(a) SDB Certified, ISO 9001:2008
#3 lore raw

Dear Bill,

Quoted 83 lines

I'm using U-boot version: U-Boot 2012.07

Through googling, I've come across several variations of using a ramdisk. So I selected some things that looked good. So basically, I am building a rootfs as a ramdisk by:

dd if=/dev/zero of=./myinitrd.img bs=1M count=35 mke2fs -m 1 ./myinitrd.img
mkdir ./myinitrd
mount -t ext2 ./myinitrd.img ./myinitrd -o loop cp -r rootfs/* ./myinitrd/.
umount ./myinitrd/
gzip ./myinitrd.img
rm -rf myinitrd

Then I use the u-boot tool to prepare it for use with u-boot by:
u-boot-imx/tools/mkimage -n 'MyRamDisk' -A arm -O linux -T
ramdisk -C none -d ./myinitrd.img.gz rootfs-initrd

I place both both my uImage and rootfs-initrd on a USB stick and insert it into the imx28evk and enter u-boot command line. I then do:

    usb start
    fatload usb 0 0x42000000 uimage
    fatload usb 0 0x43000000 rootfs-initrd
    setenv bootargs console=ttyAM0,115200n8 debug root=/dev/ram rw
ip=dhcp  fec_mac=
    bootm 0x42000000 0x43000000

u-boot then starts booting with:

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

    Image Name:   Linux-2.6.35.3-571-gcca29a0-g45b
    Created:      2012-09-08  22:31:46 UTC
    Image Type:   ARM Linux Kernel Image (uncompressed)
    Data Size:    2582304 Bytes = 2.5 MiB
    Load Address: 40008000
    Entry Point:  40008000
    Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 43000000 ...
    Image Name:   MyRamDisk
    Created:      2012-09-12  20:51:35 UTC
    Image Type:   ARM Linux RAMDisk Image (uncompressed)
    Data Size:    37774 Bytes = 36.9 KiB

Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.35.3-571-gcca29a0-g45b53d0-dirty (blsousan at ubuntu) (gcc version 4.4.4 (4.4.4_09.06.2010) ) #13 PREEMPT Sat Sep 8 14:06:34 PDT 2012
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Freescale MX28EVK board
....
....
....

The kernel starts to boot, I get all the kernel output, and at the end it does not find the rootfs. I get:

...
...
...

List of all partitions:
b300 3872256 mmcblk0 driver: mmcblk
b301 1024 mmcblk0p1
0800 503808 sda driver: sd
0801 503792 sda1
No filesystem could mount root, tried: ext3 ext2 vfat msdos iso9660

Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(1,0)
Backtrace:
Quoted 16 lines

I not sure how the kernel knows where the ramdisk lives in memory ( 0x43000000) where the the uboot put it ?

Thanks,
Bill

Quoted 8 lines · Marek Vasut

Dear Bill,

Quoted 3 lines

Has anyone used U-boot on the imx28evk with initrd to setup a small rootfs in RAM? I need the ability to do have a small temp rootfs to assist in mounting a full rootfs from a USB for field upgrade purposes.

Yes, it's a linux thingie though. What's the problem? What version of uboot do you use?

Some ancient kernel you have ... did you enable ramdisk support in Linux? And gzip compression for it ? And loop back block driver ?

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

Thanks,
Bill

Best regards,
Marek Vasut

Best regards,
Marek Vasut

author
#4 lore raw

Marek,

Yes, I checked the kernel and it is enabled for ramdisk support in
Linux, gzip compression, and loop back block driver. I did find some other posts where some folks added the address of the ram drive. So I changed the kernel arguments from:

setenv bootargs console=ttyAM0,115200n8 debug root=/dev/ram rw ip=dhcp fec_mac=
TO:

	setenv bootargs console=ttyAM0,115200n8 debug root=/dev/ram rw initrd=0x43000000,40K   ip=dhcp  fec_mac=

And now the kernel output generates a additional error line from RAMDISK:

...
...
...
RAMDISK: Couldn't find valid RAM disk image starting at 0. <<<<<<<< This line now appears on the console
List of all partitions:
b300 3872256 mmcblk0 driver: mmcblk
b301 1024 mmcblk0p1
0800 503808 sda driver: sd
0801 503792 sda1
No filesystem could mount root, tried: ext3 ext2 vfat msdos iso9660

Kernel panic - not syncing: VFS: Unable to mount root fs on 

unknown-block(1,0)
...
...
...

Is it something with the RAM disk format or the uboot tool mkimage parameters?

Thanks,
Bill

Quoted 109 lines · Marek Vasut

Dear Bill,

Quoted 83 lines

I'm using U-boot version: U-Boot 2012.07

Through googling, I've come across several variations of using a ramdisk. So I selected some things that looked good. So basically, I am building a rootfs as a ramdisk by:

dd if=/dev/zero of=./myinitrd.img bs=1M count=35 mke2fs -m 1 ./myinitrd.img
mkdir ./myinitrd
mount -t ext2 ./myinitrd.img ./myinitrd -o loop cp -r rootfs/* ./myinitrd/.
umount ./myinitrd/
gzip ./myinitrd.img
rm -rf myinitrd

Then I use the u-boot tool to prepare it for use with u-boot by:
u-boot-imx/tools/mkimage -n 'MyRamDisk' -A arm -O linux -T
ramdisk -C none -d ./myinitrd.img.gz rootfs-initrd

I place both both my uImage and rootfs-initrd on a USB stick and insert it into the imx28evk and enter u-boot command line. I then do:

     usb start
     fatload usb 0 0x42000000 uimage
     fatload usb 0 0x43000000 rootfs-initrd
     setenv bootargs console=ttyAM0,115200n8 debug root=/dev/ram rw
ip=dhcp  fec_mac=
     bootm 0x42000000 0x43000000

u-boot then starts booting with:

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

     Image Name:   Linux-2.6.35.3-571-gcca29a0-g45b
     Created:      2012-09-08  22:31:46 UTC
     Image Type:   ARM Linux Kernel Image (uncompressed)
     Data Size:    2582304 Bytes = 2.5 MiB
     Load Address: 40008000
     Entry Point:  40008000
     Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 43000000 ...
     Image Name:   MyRamDisk
     Created:      2012-09-12  20:51:35 UTC
     Image Type:   ARM Linux RAMDisk Image (uncompressed)
     Data Size:    37774 Bytes = 36.9 KiB

Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.35.3-571-gcca29a0-g45b53d0-dirty (blsousan at ubuntu) (gcc version 4.4.4 (4.4.4_09.06.2010) ) #13 PREEMPT Sat Sep 8 14:06:34 PDT 2012
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Freescale MX28EVK board
....
....
....

The kernel starts to boot, I get all the kernel output, and at the end it does not find the rootfs. I get:

...
...
...

List of all partitions:
b300 3872256 mmcblk0 driver: mmcblk

    b301            1024 mmcblk0p1
0800          503808 sda driver: sd
    0801          503792 sda1
No filesystem could mount root, tried:  ext3 ext2 vfat msdos iso9660
Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(1,0)
Backtrace:
Quoted 15 lines

I not sure how the kernel knows where the ramdisk lives in memory ( 0x43000000) where the the uboot put it ?

Thanks,
Bill

Quoted 7 lines · Marek Vasut

Dear Bill,

Quoted 3 lines

Has anyone used U-boot on the imx28evk with initrd to setup a small rootfs in RAM? I need the ability to do have a small temp rootfs to assist in mounting a full rootfs from a USB for field upgrade purposes.

Yes, it's a linux thingie though. What's the problem? What version of uboot do you use?

Some ancient kernel you have ... did you enable ramdisk support in Linux? And gzip compression for it ? And loop back block driver ?

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Thanks,
Bill

Best regards,
Marek Vasut

Best regards,
Marek Vasut

Signature · 8 lines
William (Bill) L. Sousan, Ph.D.
(w) 402.331.4977 ext. 4002
bsousan at techsi.com
Technical Support Inc.
11253 John Galt Blvd
Omaha, NE 68137
www.techsi.com
8(a) SDB Certified, ISO 9001:2008
#5 lore raw

Dear Bill,

I'm CCing Fabio ... he might have some idea for you.

Quoted 164 lines

Marek,

Yes, I checked the kernel and it is enabled for ramdisk support in
Linux, gzip compression, and loop back block driver. I did find some other posts where some folks added the address of the ram drive. So I changed the kernel arguments from:

setenv bootargs console=ttyAM0,115200n8 debug root=/dev/ram rw ip=dhcp
fec_mac= TO:

setenv bootargs console=ttyAM0,115200n8 debug root=/dev/ram rw
initrd=0x43000000,40K ip=dhcp fec_mac=

And now the kernel output generates a additional error line from RAMDISK:

...
...
...
RAMDISK: Couldn't find valid RAM disk image starting at 0. <<<<<<<< This line now appears on the console
List of all partitions:
b300 3872256 mmcblk0 driver: mmcblk
b301 1024 mmcblk0p1
0800 503808 sda driver: sd
0801 503792 sda1
No filesystem could mount root, tried: ext3 ext2 vfat msdos iso9660

Kernel panic - not syncing: VFS: Unable to mount root fs on

unknown-block(1,0)
...
...
...

Is it something with the RAM disk format or the uboot tool mkimage parameters?

Thanks,
Bill

Quoted 123 lines · Marek Vasut

Dear Bill,

Quoted 92 lines

I'm using U-boot version: U-Boot 2012.07

Through googling, I've come across several variations of using a ramdisk. So I selected some things that looked good. So basically, I

am building a rootfs as a ramdisk by:
dd if=/dev/zero of=./myinitrd.img bs=1M count=35 mke2fs -m 1 ./myinitrd.img
mkdir ./myinitrd
mount -t ext2 ./myinitrd.img ./myinitrd -o loop cp -r rootfs/* ./myinitrd/.
umount ./myinitrd/
gzip ./myinitrd.img
rm -rf myinitrd

Then I use the u-boot tool to prepare it for use with u-boot by:
u-boot-imx/tools/mkimage -n 'MyRamDisk' -A arm -O linux -T

ramdisk -C none -d ./myinitrd.img.gz rootfs-initrd

I place both both my uImage and rootfs-initrd on a USB stick and insert

it into the imx28evk and enter u-boot command line. I then do:

     usb start
     fatload usb 0 0x42000000 uimage
     fatload usb 0 0x43000000 rootfs-initrd
     setenv bootargs console=ttyAM0,115200n8 debug root=/dev/ram rw

ip=dhcp fec_mac=

     bootm 0x42000000 0x43000000

u-boot then starts booting with:

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

     Image Name:   Linux-2.6.35.3-571-gcca29a0-g45b
     Created:      2012-09-08  22:31:46 UTC
     Image Type:   ARM Linux Kernel Image (uncompressed)
     Data Size:    2582304 Bytes = 2.5 MiB
     Load Address: 40008000
     Entry Point:  40008000
     Verifying Checksum ... OK

## Loading init Ramdisk from Legacy Image at 43000000 ...

     Image Name:   MyRamDisk
     Created:      2012-09-12  20:51:35 UTC
     Image Type:   ARM Linux RAMDisk Image (uncompressed)
     Data Size:    37774 Bytes = 36.9 KiB

Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Loading Kernel Image ... OK

OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.35.3-571-gcca29a0-g45b53d0-dirty (blsousan at ubuntu) (gcc version 4.4.4 (4.4.4_09.06.2010) ) #13 PREEMPT Sat Sep 8 14:06:34 PDT 2012
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Freescale MX28EVK board
....
....
....

The kernel starts to boot, I get all the kernel output, and at the end it does not find the rootfs. I get:

...
...
...

List of all partitions:
b300 3872256 mmcblk0 driver: mmcblk

    b301            1024 mmcblk0p1

0800 503808 sda driver: sd

    0801          503792 sda1

No filesystem could mount root, tried: ext3 ext2 vfat msdos iso9660

Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(1,0)
Backtrace:
Quoted 17 lines

I not sure how the kernel knows where the ramdisk lives in memory ( 0x43000000) where the the uboot put it ?

Thanks,
Bill

Quoted 9 lines · Marek Vasut

Dear Bill,

Quoted 4 lines

Has anyone used U-boot on the imx28evk with initrd to setup a small rootfs in RAM? I need the ability to do have a small temp rootfs to assist in mounting a full rootfs from a USB for field upgrade purposes.

Yes, it's a linux thingie though. What's the problem? What version of uboot do you use?

Some ancient kernel you have ... did you enable ramdisk support in Linux? And gzip compression for it ? And loop back block driver ?

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

Thanks,
Bill

Best regards,
Marek Vasut

Best regards,
Marek Vasut

#6 lore raw

Bill,

Quoted 3 lines · Marek Vasut

Dear Bill,

I'm CCing Fabio ... he might have some idea for you.

What about starting a thread in linux-arm-kernel for this?

Regards,

Fabio Estevam

author
#7 lore raw

Thanks to both of you for following up. Over the weekend, I switched to using the initramfs within the kernel configuration (in the Freescale kernel) and set the source directory to my rootfs that will be the ramdrive and it worked great! So I'll stick with this scenario. It's nice too in that the rootfs (a small one) gets bundled up with the kernel (uImage) so its just one file. So it works out really nice. This is a good way for upgrading firmware from the flash.

Best,
Bill

Quoted 11 lines · Fabio Estevam

Bill,

Quoted 3 lines · Marek Vasut

Dear Bill,

I'm CCing Fabio ... he might have some idea for you.

What about starting a thread in linux-arm-kernel for this?

Regards,

Fabio Estevam

#8 lore raw

Dear Bill,

Quoted 7 lines

Thanks to both of you for following up. Over the weekend, I switched to using the initramfs within the kernel configuration (in the Freescale kernel) and set the source directory to my rootfs that will be the ramdrive and it worked great! So I'll stick with this scenario. It's nice too in that the rootfs (a small one) gets bundled up with the kernel (uImage) so its just one file. So it works out really nice. This is a good way for upgrading firmware from the flash.

Don't you want to check latest linux-next for the mx28 CPU?

Quoted 16 lines

Best,
Bill

Quoted 12 lines · Fabio Estevam

Bill,

Quoted 3 lines · Marek Vasut

Dear Bill,

I'm CCing Fabio ... he might have some idea for you.

What about starting a thread in linux-arm-kernel for this?

Regards,

Fabio Estevam

Best regards,
Marek Vasut

author
#9 lore raw

Good idea.

Best,
Bill

Quoted 28 lines · Marek Vasut

Dear Bill,

Quoted 7 lines

Thanks to both of you for following up. Over the weekend, I switched to using the initramfs within the kernel configuration (in the Freescale kernel) and set the source directory to my rootfs that will be the ramdrive and it worked great! So I'll stick with this scenario. It's nice too in that the rootfs (a small one) gets bundled up with the kernel (uImage) so its just one file. So it works out really nice. This is a good way for upgrading firmware from the flash.

Don't you want to check latest linux-next for the mx28 CPU?

Quoted 15 lines

Best,
Bill

Quoted 11 lines · Fabio Estevam

Bill,

Quoted 3 lines · Marek Vasut

Dear Bill,

I'm CCing Fabio ... he might have some idea for you.

What about starting a thread in linux-arm-kernel for this?

Regards,

Fabio Estevam

Best regards,
Marek Vasut

#10 lore raw
In reply to Bill

Dear Bill,

Quoted 7 lines · In message <[email protected]> you wrote:

Thanks to both of you for following up. Over the weekend, I switched to using the initramfs within the kernel configuration (in the Freescale kernel) and set the source directory to my rootfs that will be the ramdrive and it worked great! So I'll stick with this scenario. It's nice too in that the rootfs (a small one) gets bundled up with the kernel (uImage) so its just one file. So it works out really nice. This is a good way for upgrading firmware from the flash.

Actually it's a way that is limited in many respects, and nearly always there are better solutions. If just having one file is important to you, there are other approaches to acchieve the same. Using a FIT image with U-Boot would be a very flexible and powerful way (see doc/uImage.FIT/*), but even a simple multi-file image would do that, and probably better.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The human race is faced with a cruel choice: work  or  daytime  tele-
vision.