UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor mullerch
Visitor
5,247 Views
Registered: ‎12-07-2012

Booting a compiled linux 3.6 from git sources in qemu

Hi,

 

I noticed severall problems with the actual versions pushed into the git when booting in Qemu. I noticed that others have the same issues. As I found a functionnal configuration I share here the changes :

 

Qemu : change the initrd loading adress to 0x04000000

  • qemu-xarm/hw/arm-boot.c:19
  • #define INITRD_LOAD_ADDR 0x04000000

Device tree : the kernel tree dts "zynq-zc702.dts" (from arch/arm/boot/dts) has been modified and used to run under Qemu.

  • Change the bootargs : bootargs = "console=ttyPS0,115200 root=/dev/ram rw initrd=0x04000000,8M ip=:::::eth0:dhcp earlyprintk";

Kernel config : devtree origin

  • CONFIG_XILINX_FIXED_DEVTREE_ADDR=y

Note : thw xilinx wiki suggest another modification :

Initramfs does not seem to work when passing in an external initramfs image with the default kernel configuration. It seems to work fine with initframfs when the image is built into the kernel. A work-around exists by removing CONFIG_BLK_DEV_RAM from the kernel configuration and rebuild the kernel. The root issue is not understood at this time.

This is not a good idea. With CONFIG_BLK_DEV_RAM=n, the inird would be interpreted only as an initramfs and the extraction would fail. A good config is

 

CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=16384

5 Replies
Visitor jaredcasper
Visitor
5,204 Views
Registered: ‎10-29-2009

Re: Booting a compiled linux 3.6 from git sources in qemu

mullerch,

 

I wonder if you are still using QEMU to emulate zynq.  I'm trying to get some version of qemu that I can get the source tree of  to boot any kernel I can get the source tree of.   I'm currently trying to use the latest version of qemu from xilinx-master branch at git.xilinx.com (it seems qemu-xarm no longer exists?). It'll boot the zc706 release image and devicetree, but I don't know how to get the source tree/config of that kernel.  Any of my own kernel/devicetree builds fail in various ways.

 

Since, from Xilinx's response in your thread last month (and their silence on the web case I have open), Xilinx doesn't seem to care about customers trying to use QEMU.  I'm wondering if you would be so kind as to update this post with your latest setup (if you have a newer one).

 

It looks like Peter Crosthwaite updated the wiki with some instructions to use the xilinx-master branch and a new machine "arm-generic-fdt" then reverted those changes.  I can't get that machine to work with anything, I'm guessing it is still under development?  Peter, are you out there?  Care to comment? :)

0 Kudos
Visitor pcrost
Visitor
5,191 Views
Registered: ‎04-22-2013

Re: Booting a compiled linux 3.6 from git sources in qemu

Hi Jared, Mullerch,

 

Responses inline below.

 

I wonder if you are still using QEMU to emulate zynq.  I'm trying to get some version of qemu that I can get the source tree of  to boot any kernel I can get the source tree of.   I'm currently trying to use the latest version of qemu from xilinx-master branch at git.xilinx.com (it seems qemu-xarm no longer exists?).

 

QEMU Xarm is obsolete and will not boot any modern kernel/dtb. Mullerch, please update to use the new tree/branch.

 

It'll boot the zc706 release image and devicetree, but I don't know how to get the source tree/config of that kernel.

 

Curious - are you using the old machine model or fdt-generic? Post cmd line if you can.

 

 Any of my own kernel/devicetree builds fail in various ways.

 

It sounds like your grief is more kernel side?

 

Since, from Xilinx's response in your thread last month (and their silence on the web case I have open), Xilinx doesn't seem to care about customers trying to use QEMU.  I'm wondering if you would be so kind as to update this post with your latest setup (if you have a newer one).

 

It looks like Peter Crosthwaite updated the wiki with some instructions to use the xilinx-master branch and a new machine "arm-generic-fdt" then reverted those changes.

 

Fixed. I have restored those Wiki changes and finished the job. I have also briefly reverified the instrucitons:

 

Kernel commit 6a0bedad60e2bca8d9b50bf81b9895e29e31a6d7
QEMU commit 31075a0ddbc5e3b0d195f7941cc397ee415baf54

 

Kernel build:


$make ARCH=arm xilinx_zynq_defconfig
$make -j ARCH=arm UIMAGE_LOADADDR=0x8000 uImage
$make ARCH=arm dtbs

QEMU:

 

$./configure --target-list="arm-softmmu,microblazeel-softmmu" --enable-fdt --disable-kvm

$make -j

 

 I can't get that machine to work with anything, I'm guessing it is still under development?  

 

No, its actually quite mature, and is officially supported by Xilinx via the PetaLinux distribution.

 

$./arm-softmmu/qemu-system-arm -M arm-generic-fdt -nographic -serial mon:stdio -dtb ../linux-xlnx/arch/arm/boot/dts/zynq-zc702.dtb -kernel ../linux-xlnx/arch/arm/boot/zImage -machine linux=on -smp 2 -initrd ../ramdisk.img

 

Works for me.

 

Peter, are you out there?  Care to comment? :)

 

Regards,
Peter

Visitor jaredcasper
Visitor
5,184 Views
Registered: ‎10-29-2009

Re: Booting a compiled linux 3.6 from git sources in qemu

Peter, 

 

Thank you so much for the quick reply! You've restored my faith in Xilinx regarding QEMU after Austin's response to Mullerch's previous inquire. I have things up and going now... some responses in line.

 

It'll boot the zc706 release image and devicetree, but I don't know how to get the source tree/config of that kernel.

Curious - are you using the old machine model or fdt-generic? Post cmd line if you can.

 

Using the old xilinx-zynq-a9 machine model:

 

../qemu/arm-softmmu/qemu-system-arm -M xilinx-zynq-a9 -m 1024 -serial null -serial mon:stdio -dtb zc706/devicetree.dtb -smp 2 -nographic -kernel zc706/uImage -initrd filesystem/ramdisk.img

 

seems to work.  However, this devicetree/kernel image hangs during boot for me using the new arm-generic-fdt machine.

 

It sounds like your grief is more kernel side?

 

Well, depends on which side you blame. :)  I had/have kernels that boot on my 706 hardware which I haven't gotten to boot in qemu.  It appers to just be a matter of getting the two to agree on everything.

 

Fixed. I have restored those Wiki changes and finished the job. I have also briefly reverified the instrucitons:

 

Thank you so much for that work; I've got things up and going now.   I'm thinking the main issues I was having resulted from using the old xilinx-zynq-a9 machine with new kernels/devicetrees.  With the new arm-generic-fdt machine I had gotten segfaults and assertion failures, so assumed it wasn't the one to use.   Using the right command line (at the least, I was missing "-machine linux=on -smp 2") it seems to be working.  For example, taking out "-smp 2" with a zc706 device tree results in a seemingly unrelated assertion failure.  I can't remember where I was seeing the segfaults, but it was somewhere in some uart code someplace presumably trying to write to a terminal that didn't exist or something, if I can reproduce I'd be glad to file a bug report.  Is there a place you would like bug reports submitted?

 

As a note, on one of my boxes (with the right combination of dev libraries installed), I had to apply the patch here, and commit 93b48c201eb6c0404d15550a0eaa3c0f7937e35e in the repository ("virtio-9p: Fix virtio-9p no longer building after hw-dirs branch merge") to get the xilinx-master branch to build. 

 

0 Kudos
Visitor pcrost
Visitor
5,175 Views
Registered: ‎04-22-2013

Re: Booting a compiled linux 3.6 from git sources in qemu

Hi Jared,

 

Fixing that -smp=2 segfault issue is a known failure and is on my radar.

 

Regarding your cherry-pick, I think that will just come out in the wash next time I do a fast forward of the the xilinx-master using the latest mainline. I do this every couple of weeks, so I am not going to bother with a one-off cherry-pick.

 

Bug reports to all OSL components (including QEMU) go to git@xilinx.com.

 

Regards,

Peter

Visitor mullerch
Visitor
5,102 Views
Registered: ‎12-07-2012

Re: Booting a compiled linux 3.6 from git sources in qemu

Hi pcrost,

 

I actually have a functional version of the old sources put together (with qemu-xarm). Can you tell me if you there is an up-to-date changelog of what's new in the latest versions. I took a look to the git log but it's quite complicated to understand the finality of the changes. What are the major benefits of updating to the new qemu versions?

 

Regards,

Christian

0 Kudos