LukeShortCloud / rootpages

Root Pages is a collection of easy-to-reference tutorials and guides primarily for Linux and other UNIX-like systems.
Other
55 stars 6 forks source link

[linux_distributions][chromium_os] How to build a custom Termina virtual machine #624

Open LukeShortCloud opened 2 years ago

LukeShortCloud commented 2 years ago

Originally posted by @LukeShortCloud in https://github.com/LukeShortCloud/rootpages/issues/621#issuecomment-1001742838

LukeShortCloud commented 2 years ago

Currently I am testing an Arch Linux installation with these packages (along with yay):

$ sudo pacstracp -i ./arch-install base base-devel git vim
LukeShortCloud commented 2 years ago

These steps are confirmed to be working for a minimal crosvm without GUI access or any integration:

truncate -s 20G termina.ext4
mkfs.ext4 termina.ext4
mkdir rootfs
sudo mount termina.ext4 rootfs/

sudo pacstrap -i ./rootfs/ base base-devel bzip2 git gzip iproute2 vim xz
echo "tmpfs /tmp tmpfs defaults 0 0" | sudo tee -a rootfs/etc/fstab
echo "tmpfs /var/log tmpfs defaults 0 0" | sudo tee -a  rootfs/etc/fstab
echo "tmpfs /root tmpfs defaults 0 0" | sudo tee -a rootfs/etc/fstab
echo "sysfs /sys sysfs defaults 0 0" | sudo tee -a rootfs/etc/fstab 
echo "proc /proc proc defaults 0 0" | sudo tee -a rootfs/etc/fstab
sudo chroot rootfs/
    [root@localhost /]# passwd root
    [root@localhost /]# exit
umount ./rootfs
git clone --depth 1 -b chromeos-5.15 https://chromium.googlesource.com/chromiumos/third_party/kernel kernel-chromeos-5.15
cd kernel-chromeos-5.15
make chromiumos-container-vm-x86_64_defconfig
make -j $(nproc) bzImage
cp arch/x86/boot/bzImage ../bzImage-chromeos-5.15
crosvm run --disable-sandbox --rwroot "$(pwd)/termina.ext4" --rwdisk "$(pwd)/disk.img" -p init=/bin/bash bzImage-chromeos-5.15

https://google.github.io/crosvm/running_crosvm/basic_usage.html