Cutom tinycore

From RobotinoWiki
Revision as of 10:08, 21 September 2021 by Verbeek (talk | contribs)
sudo apt install qemu-utils qemu-system-x86 grub-pc-bin

mkdir tinycore
cd tinycore
wget http://tinycorelinux.net/12.x/x86/release/TinyCore-current.iso

qemu-img create -f qcow2 core-image.img 64M

sudo modprobe nbd max_part=8
sudo qemu-nbd -c /dev/nbd0 core-image.img

sudo mkdir /media/cdrom
sudo mount TinyCore-current.iso /media/cdrom

sudo fdisk /dev/nbd0
n
p
1
enter
enter
p
w

sudo mkfs.ext2 /dev/nbd0p1

sudo mkdir /media/image
sudo mount /dev/nbd0p1 /media/image

sudo mkdir /media/image/boot
sudo mkdir -p /media/image/tce/optional

sudo cp /media/cdrom/boot/core.gz /media/image/boot/
sudo cp /media/cdrom/boot/vmlinuz /media/image/boot/
sudo touch /media/image/tce/onboot.lst

sudo grub-install --boot-directory=/media/image/boot /dev/nbd0

sudo umount /dev/nbd0p1
sudo qemu-nbd -d /dev/nbd0

qemu-system-i386 core-image.img

linux (hd0,msdos1)/boot/vmlinuz
initrd (hd0,msdos1)/boot/core.gz
boot

sudo qemu-nbd -c /dev/nbd0 core-image.img
sudo mount /dev/nbd0p1 /media/image

sudo bash -c "cat <<EOF > /media/image/boot/grub/grub.cfg
set timeout=3
set root='hd0,msdos1'
menuentry 'Boot TinyCore' {
    linux /boot/vmlinuz
    initrd /boot/core.gz
}
EOF"

If you want to pass the boot process some arguments, append them after the path to the linux kernel. TinyCore supports a bunch of those, here are some of the more useful:

Parameter Usage Example Effect
waitusb waitusb=5 Wait for USB devices to become ready before mounting. This might help if the image fails to load its extensions.
norestore norestore Do not restore from persistence file (explained later in this guide)
lst lst=ext.lst Load extensions specified by ext.lst
superuser superuser Start with a root shell
quiet quiet Suppress much of the debug information during boot