cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gcwang
Observer
Observer
8,797 Views
Registered: ‎07-10-2012

Larger ramdisk cannot be support?

Jump to solution

I just built myself the zImage and Ramdisk.img according to the Xilinx web site.i need adding  my applications to rootfs,so,i want to creat a larger ramdisk,such as 12M or 16M etc,and i ament some files.

 

http://wiki.xilinx.com/zynq-rootfs

When creat the ramdisk.img,i changed the "count=8192" to "count=12288“ and geting a 12M ramdisk.img,as follow.

 

dd if=/dev/zero of=ramdisk.img bs=1024 count=12288

mke2fs -F ramdisk.img -L "ramdisk" -b 1024 -m 0

tune2fs ramdisk.img -i 0

chmod 777 ramdisk.img

 

then,i ament the /arch/arm/boot/dts/zynq-zc702.dts file, 8M to 12M, as follows.

 

chosen {
  bootargs = "console=ttyPS0,115200 root=/dev/ram rw initrd=0x800000,12M ip=:::::eth0:dhcp earlyprintk";
  linux,stdout-path = "/amba@0/uart@E0001000";
 };

 

When i geting the ramdisk.img(12M) and zynq-zc702.dtb,i run them in QEMU.

 

ram size=40000000
error reading QSPI block device
error no mtd drive for nand flash
a0mpcore_priv: smp_priv_base f8f00000
error no sd drive for sdhci controller (0)
error no sd drive for sdhci controller (1)
Number of configured NICs 0x1
ram_size 40000000, board_id d32, loader_start 0
rom: requested regions overlap (rom /opt/zynq_linux_test/zynq_zc70207.dtb. free=0x01800000, addr=0x01000000)
rom loading failed

 

I try to test the different size as 13M  and 16M using the same method,but,the result is same.

i think that the size of RAMDISK should can be changed, if the QEMU not supporting the larger size except 8M?

Anyone give me some suggestions?thanks.

 

 

 

 

 

 

 





0 Kudos
1 Solution

Accepted Solutions
norman_wong
Scholar
Scholar
11,079 Views
Registered: ‎05-28-2012

I would say yes. Took a quick look at the QEMU source at the Xilinx Git, The uncompressed ramdisk image is limited to 8MB in QEMU. See

File: hw/arm_boot.c
...
#define KERNEL_ARGS_ADDR 0x100
#define KERNEL_LOAD_ADDR 0x00010000
#define INITRD_LOAD_ADDR 0x00800000
#define DTB_LOAD_ADDR    0x1000000
#define DTB_MAX_SIZE     0x10000
...

This matches the address noted at the Xilinx Wiki page, http://wiki.xilinx.com/zynq-linux
"The 2nd method, and the default in the Xilinx kernel configuration, is hard coded such that it expects the device tree at address 0x1000000 (16 MB)."

I suppose you could recompile QEMU and Linux with a higher DTB address to allow more room for ramdisk/initrd image. Lot of work.

Alternative would be the noted R2=DTB method. That would mean using a newer version of QEMU and Linux reconfigured for it. The Wiki pages says not to for performance reasons.

 

View solution in original post

0 Kudos
12 Replies
norman_wong
Scholar
Scholar
11,080 Views
Registered: ‎05-28-2012

I would say yes. Took a quick look at the QEMU source at the Xilinx Git, The uncompressed ramdisk image is limited to 8MB in QEMU. See

File: hw/arm_boot.c
...
#define KERNEL_ARGS_ADDR 0x100
#define KERNEL_LOAD_ADDR 0x00010000
#define INITRD_LOAD_ADDR 0x00800000
#define DTB_LOAD_ADDR    0x1000000
#define DTB_MAX_SIZE     0x10000
...

This matches the address noted at the Xilinx Wiki page, http://wiki.xilinx.com/zynq-linux
"The 2nd method, and the default in the Xilinx kernel configuration, is hard coded such that it expects the device tree at address 0x1000000 (16 MB)."

I suppose you could recompile QEMU and Linux with a higher DTB address to allow more room for ramdisk/initrd image. Lot of work.

Alternative would be the noted R2=DTB method. That would mean using a newer version of QEMU and Linux reconfigured for it. The Wiki pages says not to for performance reasons.

 

View solution in original post

0 Kudos
gcwang
Observer
Observer
8,772 Views
Registered: ‎07-10-2012
Yes,i agree. Thank you very much.The DTB_LOAD_ADDR and INITRD_LOAD_ADDR decide the size of RAMDISK can not be larger than 8M. In other word, need to reconfig the Linux and u-boot,dts for larger ramdisk.
0 Kudos
gcwang
Observer
Observer
8,751 Views
Registered: ‎07-10-2012
To norman_wong:
How and where to reconfig the linux for a higher DTB address?
I just try to do,but not find.
I want to know the linux Kernal how and where to get the DTB address? pass from u-boot?thanks!
0 Kudos
norman_wong
Scholar
Scholar
8,742 Views
Registered: ‎05-28-2012

My search path though the kernel:

 

arch/arm/mach-zynq/Kconfig
Device Tree At Fixed Address
CONFIG_XILINX_FIXED_DEVTREE_ADDR

arch/arm/mach-zynq/Makefile.boot - Unsure if this is relevant
initrd_phys-y   := 0x00800000

arch/arm/kernel/head.S - hard coded here
#ifdef CONFIG_XILINX_FIXED_DEVTREE_ADDR
         mov     r2,#0x1000000
#endif

 

If I understand this correctly, QEMU does not use U-Boot. It uses that hard coded value on the QEMU source. Real HW uses U-Boot and the DTB address is hard-coded in the environment variables. For example, qspiboot will copy the DTB from an address in QSPI to address 0x01000000. Similiar for the other media. Since U-Boot is not configured to save changes to the env vars, you have to recompile U-Boot with changed values for env vars

.

0 Kudos
linnj
Xilinx Employee
Xilinx Employee
8,734 Views
Registered: ‎09-10-2008
Yes you got that right. On the next release we're moving to bootm rather than go in u-boot and the device tree is not at a fixed address anymore with the hardware. U-boot then alters the device tree such that initrd is no longer used on the kernel command line. We may remove the ugly slamming of R2 with the device tree address, but I need to see what's happening in QEMU to pass the device tree address to Linux.

Thanks.
0 Kudos
gcwang
Observer
Observer
8,729 Views
Registered: ‎07-10-2012
Thanks norman_wong and John.
Expect the next release.
0 Kudos
norman_wong
Scholar
Scholar
8,728 Views
Registered: ‎05-28-2012

Not sure about this, the most current version of QEMU (not the one at the Xilinx Git) supports DTB in R2. The location of DTB is dynamically placed just after the initrd image.

0 Kudos
grasscap
Observer
Observer
8,540 Views
Registered: ‎09-24-2012

Hi gcwang,

 

Did you get your problem resolved? 

 

I just got my zynq board and am now having the same problem. I want a 128MB ramdisk but until now I am not able to get it working. If you already solved this problem, could you share some information?

 

Thanks!

0 Kudos
madboat
Participant
Participant
8,501 Views
Registered: ‎09-14-2010

grasscap,

 

I don't have a kernel working with the new stuff that john uploaded last week yet, but I can say that with the old stuff, you can expand the size of the the ramdisk, and IIRC all you need to change are the settings for it in the u-boot config file (include/configs/zynq_common.h).

 

For actually creating an image, I wrote the following script, Run as is, you specify either a 16M ramdisk or an 8M ramdisk, and it creates one for you (the name of the output file doesn't change, however). Modify it for your 128M version.

 


if   [ $1 == "8"  ] ; then COUNT=8192
elif [ $1 == "16" ] ; then COUNT=16384
else echo "$1 is not a valid size for the output RAMDISK. " ; exit ; fi

read -p " Ramdisk size is $1 Megabytes. Target directory structure is housed in $2. Press [Enter] to go"
dd if=/dev/zero of=ramdisk8M.image bs=1024 count=$COUNT
mke2fs -F ramdisk8M.image -L "ramdisk8M" -b 1024 -m 0
tune2fs ramdisk8M.image -i 0
chmod 777 ramdisk8M.image

mkdir ramdisk8M
mount -o loop ramdisk8M.image ramdisk8M/

cp -R $2/* ramdisk8M
read -p "Press [Enter]..."
umount ramdisk8M/

gzip ramdisk8M.image

 

 

0 Kudos
gcwang
Observer
Observer
3,957 Views
Registered: ‎07-10-2012
Hello!
You can creat the 128M ramdisk according to the Xilinx website just like madboat's reply.
I think you need to modify the Device Tree At Fixed Address(ram addr) in linux and u-boot config file(include/configs/zynq_common.h).Perhaps,need to modify the MTD partions.
Moreover, the QSPI device of zynq up to 32M, your 128M ramdisk only can saved to SD or NAND.
0 Kudos
grasscap
Observer
Observer
3,952 Views
Registered: ‎09-24-2012

Thanks for the reply, guys. I will try them.

0 Kudos
grasscap
Observer
Observer
3,934 Views
Registered: ‎09-24-2012

" modify the Device Tree At Fixed Address(ram addr) in linux"

 

Do you know which file contains the definition?

 

I modified zynq_common.,h in uboot. And it looks like I have to give devicetree a new address. Thanks.

0 Kudos