Creating a filesystem for Real Time Linux using QEMU
I have been able to use buildroot (buildroot-20091114.tar.bz2) in order to build a filesystem for Real Time Linux. I have been able to boot Linux in QEMU with the following command:
qemu -kernel $LOCATION/bzImage \
-hda $LOCATION/rootfs.i686.ext2 \
-append "root=/dev/sda"However, the file system is detected as read only, which could be a problem since I need to make my changes.
Someone else suggested to use a different approach, based on initramfs option (in build root menu) which loads the filesystem into RAM, but in this case the changes are not permanent.
Could you advise please ?
Quoted 15 lines · Bogdan Cristea
I have been able to use buildroot (buildroot-20091114.tar.bz2) in order to build a filesystem for Real Time Linux. I have been able to boot Linux in QEMU with the following command:
qemu -kernel $LOCATION/bzImage \ -hda $LOCATION/rootfs.i686.ext2 \ -append "root=/dev/sda"However, the file system is detected as read only, which could be a problem since I need to make my changes.
Someone else suggested to use a different approach, based on initramfs option (in build root menu) which loads the filesystem into RAM, but in this case the changes are not permanent.
Quoted 7 lines
Could you advise please ?
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Hi
Add "rw" to your append command.
So change it to -append "root=/dev/sda rw"
Hedwin Koning
Quoted 4 lines · On Monday 16 November 2009 10:51:33 you wrote:
Add "rw" to your append command.
So change it to -append "root=/dev/sda rw"
Thanks for the tip, it allows me to write to the virtual hard disk, but still the changes are not permanent.
It depends what you want to do. Normally (in the way I use it) buildroot generates a root file system which I can then load onto an embedded (or emulated) target. I generally leave this as my software image for that device, that way I can guarantee what the device boots up with.
The contents of the generated file system are determined by what I've configured buildroot to install for me. Any additions/changes to the contents of that image I make by changing my buildroot config and recompiling. I generally consider that file system readonly or at the very least not persistent.
If I want to store something on my target I do this on some other mounted media (usually flash). Others might write the image into the devices flash and allow changes to be saved into flash. Both approaches have their pros and cons.
When using qemu you can use the qemu-img utility to generate a fake hard drive and feed it to qemu.
On your host PC do this once to create a new image
qemu-img create -f raw flash.img 32M
Invoke qemu feeding it the -hdb option for a second hard drive
qemu -kernel $LOCATION/bzImage \
-hda $LOCATION/rootfs.i686.ext2 \
-hdb flash.img \
-append "root=/dev/sda"On the emulated target you can mount it
mount -t ext2 /dev/hdb /mnt/writeable
You can play with various files in buildroot to have it mounted automatically e.g. target/generic/target_skeleton/etc/fstab or target/device/<company>/<board>/target_skeleton/etc/fstab
It may also be worth looking at qemu's copy-on-write or snapshot capabilities. I've never used it but it sounds neat and will probably allow you to start with an image generated by buildroot and make modifications to that image from the emulated target.
---
Regards,
Chris
Quoted 12 lines · Bogdan Cristea
Quoted 5 lines · On Monday 16 November 2009 10:51:33 you wrote:
Add "rw" to your append command.
So change it to -append "root=/dev/sda rw"
Thanks for the tip, it allows me to write to the virtual hard disk, but still the changes are not permanent.
Hi,
Hmm weird.
This is what I use to start qemu for 386:
qemu -kernel bzImage.1 -hda hd.img -append "root=/dev/sda rw
init=./init"
And this is what I use for mips emulation:
../repos/mipsel-softmmu/qemu-system-mipsel -M malta --kernel
./vmlinux -hda hda256m-img -append "root=/dev/hda rw" -m 128 -nographic
In both cases any changes I make in the file system during emulation is persistent.
Did you also check the file permission of the virtual disk drive you are using? But if rw the you should have seen that the kernel is complaining when trying to write anything to the disk.
Hedwin Koning.
Quoted 24 lines · On Tuesday 17 November 2009 02:18:41 you wrote:
Quoted 7 lines · Bogdan Cristea
Quoted 3 lines · On Monday 16 November 2009 10:51:33 you wrote:
Add "rw" to your append command.
So change it to -append "root=/dev/sda rw"
Thanks for the tip, it allows me to write to the virtual hard disk, but still the changes are not permanent.
Hi,
Hmm weird.
This is what I use to start qemu for 386:
qemu -kernel bzImage.1 -hda hd.img -append "root=/dev/sda rw
init=./init"And this is what I use for mips emulation:
../repos/mipsel-softmmu/qemu-system-mipsel -M malta --kernel./vmlinux -hda hda256m-img -append "root=/dev/hda rw" -m 128 -nographic
Quoted 9 lines
In both cases any changes I make in the file system during emulation is persistent.
Did you also check the file permission of the virtual disk drive you are using? But if rw the you should have seen that the kernel is complaining when trying to write anything to the disk.
Hedwin Koning.
Well, I have tried to change the root password and add a new user and it seems that the changes are not always recorded.
However I have just begun to play with RT Linux in QEMU, but with the latest file system I have managed to compile I have been able to add a new user and change the fstab file. So thank you all for your help.