Ben Stienstra

Linux, Unix, network, radio and more...

User Tools

Site Tools


qemu_kvm_tinycore_image

Qemu / KVM TinyCore 8.2.1 image

  • Download the TinyCore Linux ISO:
    curl -O https://mirrors.dotsrc.org/tinycorelinux/8.x/x86/release/TinyCore-8.2.1.iso</code.
      * Create mount points<code>sudo mkdir -p /mnt/{image,iso}
  • Create disk image
    qemu-img create -f raw tc.raw 64M
  • Mount image as blockdevice
    sudo losetup /dev/loop0 tc.raw
    sudo kpartx -a /dev/loop0
  • Create partition table on disk image
    sudo parted --script /dev/loop0 \
        mklabel msdos \
        mkpart primary 1MiB 100% \
        toggle 1 boot
  • Create filesystem
    sudo mkfs.ext2 /dev/mapper/loop0p1
  • Mount image and ISO
    sudo mount /dev/mapper/loop0p1 /mnt/image
    sudo mount -o loop TinyCore-8.2.1.iso /mnt/iso
  • Create directories
    sudo mkdir -p /mnt/image/{boot,tce,tce/optional}
  • Copy TinyCore to disk image
    sudo cp /mnt/iso/boot/core.gz /mnt/image/boot/
    sudo cp /mnt/iso/boot/vmlinuz /mnt/image/boot/
    sudo cp /mnt/iso/cde/onboot.lst /mnt/image/tce/
    sudo cp /mnt/iso/cde/optional/* /mnt/image/tce/optional/
  • Install GRUB (grub2-… on Fedora/RedHat)
    sudo grub2-install --target=i386-pc --boot-directory=/mnt/image/boot /dev/loop0
  • Configure grub
    sudo bash -c "cat > /mnt/image/boot/grub2/grub.cfg" <<'EOF'
    set timeout=5
    set root='hd0,msdos1'
    menuentry 'TinyCore 8.2.1' {
        linux /boot/vmlinuz quiet noswap
        initrd /boot/core.gz
    }
    EOF
  • Test boot image
    cd; sudo umount /mnt/{iso,image}
    
    qemu-system-x86_64 \
        -vga qxl \
        -soundhw ac97 \
        -enable-kvm \
        -m 2G \
        -hda tc.raw \
        -boot c \
        -usb \
        -device usb-ehci,id=ehci \
        -device usb-tablet,bus=usb-bus.0
qemu_kvm_tinycore_image.txt · Last modified: 2018/01/07 17:44 by admin