This is the old SliTaz forum - Please use the main forum.slitaz.org

SliTaz LiveUSB in QEMU
  • guitarMan666guitarMan666 November 2009
    I have created a SliTaz LiveUSB (latest cooking from 2009, November 4) from the LiveCD using the tazusb tool. I am trying to get it to optionally boot inside QEMU which is small and portable and would allow me to use it from a host environment in situations where booting it natively is not an option. This method is used by Damn Small Linux (DSL) in their dsl-embedded package. The command line I am using to start QEMU is:
    $ qemu -m 384 -kernel bzImage -append "root=rootfs.gz"

    The issue however is that QEMU does not seem to be able to use a bootloader and must start the kernel directly. However doing this, the kernel panics. With:

    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
    Pid: 1, comm: swapper Not tainted 2.6.30.6-slitaz #1

    There is also a call trace that I will give if requested (it's a little lengthy to add to the post). Is there a way to do this properly so that it loads in QEMU just like it would load from a BIOS?
  • sporkspork November 2009
    What I did with mine was:

    qemu -m 512 -cdrom slitaz-cooking.iso

    Of course, you may want to change the memory, and Slitaz booting from the ISO will not be able to save anything.
  • guitarMan666guitarMan666 November 2009
    Yeah, that's the thing. I want it to be the same as booting from the USB stick normally. I really just need to know what options the kernel looks for so that I can point QEMU to the right files, particularly troublesome are the home directories and the root file system.
  • bellardbellard November 2009
    You can try :

    qemu -m 384 -kernel bzImage -initrd rootfs.gz -hda /dev/null
  • guruguru December 2009
    i have create a qemu img , and install slitaz cooking iso to the qemu img,
    boot to openbox ok,

    1 check #lsmod output
    (0 module)

    2 no eth0 device
  • erniaernia February 2010
    @guru
    qemu default is to emulate a realtek 8139c network card in user mode, wich seems not supported by slitaz cooking.
    by lanching qemu with the options -net nic,model=ne2k_pci -net user (or some else qemu supported network card) you change the emulated network card and you can use eth0.
  • erniaernia February 2010
    @guitarMan666
    i'm using a standard liveusb install with a little (ugly) hack to use it keeping my home both in liveusb and emulated modes.
    to boot in qemu i'm using the commandline posted by bellard but using as hda a file called home.img wich is created with qemu-img and formatted as ext3.
    to mount the file in slitaz you need to change the busybox mount because it doesn't support
     -o loop,offset=32256
    , wich is required to mount the file.
    i've downloaded the debian lenny mount and libselinux (wich is required from mount), converted in tazpkg format with
    tazpkg convert
    and installed.
    after that i've changed, in the rootfs of slitaz, /etc/init.d/local.sh like that:

    #!/bin/sh
    # /etc/init.d/local.sh - Local startup commands.
    #
    # All commands here will be executed at boot time.
    #
    . /etc/init.d/rc.functions

    echo "Starting local startup commands... "

    echo "cheking if booting from a real system or from qemu"

    if cat /proc/ide/hd*/model | grep -q "QEMU"
    then
    mount -t ext3 /dev/disk/by-uuid/12345678-1234-1234-1234-123456781234 /home
    else
    mkdir /mnt/chiaveusb
    sleep 5
    mount -t vfat /dev/disk/by-uuid/1234-5678 /mnt/chiaveusb
    sleep 5
    mount -t ext3 -o loop,offset=32256 /mnt/chiaveusb/home.img /home
    fi

    where 1234-5678 is the uuid of the vfat filesystem on the usbkey and 12345678-1234-1234-1234-123456781234 is the uuid of the ext3 filesystem in home.img.
    This way i can have my ext3 home booting in qemu under linux and windows and as liveusb too. Under linux you can mount home.img with the -o loop,offset=32256 to copy there the file you need. Before to mount home.img as /home for the first time mount it somewhere else and copy all required files in it.
    If you have found a better solution let me know ;)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

SliTaz Social