Difference between revisions of "Cutom tinycore"

From RobotinoWiki
(Setup permissions)
(Build extension)
Line 133: Line 133:
 
==Build extension==
 
==Build extension==
 
<pre>
 
<pre>
mksquashfs /tmp/robotinorestore/ tmp/robotinorestore.tcz
+
mksquashfs /tmp/robotinorestore/ /tmp/robotinorestore.tcz
 
</pre>
 
</pre>

Revision as of 16:10, 21 September 2021

Overview

Based on [1]

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

Mount the image

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

Unmount the image

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 waitusb=5 superuser
    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

qemu networking

echo "allow virbr0" > /etc/qemu/bridge.conf

sudo qemu-system-i386 core-image.img -net bridge,br=virbr0 -net nic,model=virtio

Use nm-connection-editor to configure virbr0

robotinorestore

tce-load -wi compiletc squashfs-tools submitqc

Setup permissions

cd /tmp/robotinorestore
chown -R root:root .
chown tc:staff usr/local/tce.installed/robotinorestore
chmod 755 usr/local/etc/profile.d/robotinorestore.sh
chmod 755 usr/local/tce.installed/robotinorestore
find -L . \
  \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
    -o -perm 511 \) -exec chmod 755 {} \; -o \
  \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
    -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
chown root:staff usr/local/tce.installed
chmod 775 usr/local/tce.installed

Build extension

mksquashfs /tmp/robotinorestore/ /tmp/robotinorestore.tcz