boots to DE.
This commit is contained in:
1
build.sh
1
build.sh
@@ -4,6 +4,7 @@ dir=$(dirname "$0")
|
||||
echo $dir
|
||||
cd $dir
|
||||
./build_kernel.sh
|
||||
./build_filesystem.sh
|
||||
sudo ./create_image.sh
|
||||
|
||||
|
||||
|
||||
0
containerfile → build_containerfile
Normal file → Executable file
0
containerfile → build_containerfile
Normal file → Executable file
@@ -3,8 +3,9 @@ set -e
|
||||
cd "$(dirname "$0")"
|
||||
dir=$(dirname "$0")
|
||||
echo $dir
|
||||
podman run --rm -d --name ubuntu ubuntu:latest /bin/bash -c "while true; do sleep 1; done"
|
||||
podman export -o ./ubuntu.tar ubuntu
|
||||
cat ./filesystem_containerfile | /usr/bin/podman build -f - -t patronagefs:latest
|
||||
podman run --rm -d --name patronagefs patronagefs:latest /bin/bash -c "while true; do sleep 1; done"
|
||||
podman export -o ./patronagefs.tar patronagefs
|
||||
echo 'exported.'
|
||||
podman stop ubuntu
|
||||
podman stop patronagefs
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ dir=$(dirname "$0")
|
||||
echo $dir
|
||||
#mkdir -p /tmp/linux
|
||||
[[ -d ./linux ]] || git clone --depth 1 https://github.com/torvalds/linux.git ./linux
|
||||
cat ./containerfile | /usr/bin/podman build --volume /lib/modules:/lib/modules:z -f - -t kernelbuild:latest .
|
||||
cat ./build_containerfile | /usr/bin/podman build --volume /lib/modules:/lib/modules:z -f - -t patronagekernel:latest .
|
||||
#rsync -av ./linux /mnt/tmpfs
|
||||
nice -n 20 /usr/bin/podman run -it --volume /lib/modules:/lib/modules:z --volume ./linux:/linux kernelbuild:latest
|
||||
#nice -n 20 /usr/bin/podman run -it --volume /lib/modules:/lib/modules:z --volume ./linux:/linux patronagekernel:latest
|
||||
cd $dir
|
||||
rm -rf initram/
|
||||
mkdir -p initram
|
||||
@@ -26,6 +26,7 @@ cp $dir/init.sh $dir/initram/init
|
||||
cp $dir/linux/arch/x86_64/boot/bzImage $dir/bzImage.efi
|
||||
chmod +x $dir/initram/init
|
||||
cd $dir/initram/
|
||||
find .
|
||||
echo $dir
|
||||
find . -print0 | cpio --null -ov --format=newc | gzip -9 > $dir/initramfs.cpio.gz
|
||||
|
||||
echo "created iniramfs"
|
||||
|
||||
0
container_cmd.sh
Normal file → Executable file
0
container_cmd.sh
Normal file → Executable file
@@ -17,34 +17,38 @@ disk="boot_image.img"
|
||||
mnt="/mnt"
|
||||
efi_part="1"
|
||||
root_part="2"
|
||||
dd if=/dev/zero of=boot_image.img count=1024 bs=1M
|
||||
dd if=/dev/zero of=boot_image.img count=6000 bs=1M
|
||||
parted -s "$disk" mklabel gpt
|
||||
parted -s --align=optimal "$disk" mkpart ESP fat32 1MiB 50Mib
|
||||
parted -s "$disk" set "$efi_part" esp on
|
||||
parted -s --align=optimal "$disk" mkpart ext2 100MiB 100%
|
||||
parted -s --align=optimal "$disk" mkpart ext4 100MiB 100%
|
||||
parted -s "$disk" set "$root_part" boot on
|
||||
parted -s "$disk" print
|
||||
kpartx -d "$disk"
|
||||
kpartx -avs "$disk"
|
||||
|
||||
loop="$(kpartx -l boot_image.img | grep -ow 'loop[0-9]*' | head -n 1)"
|
||||
disk_efi="${loop}p1"
|
||||
disk_sys="${loop}p2"
|
||||
echo "${loop}"
|
||||
echo "${disk_efi}"
|
||||
echo "${disk_sys}"
|
||||
|
||||
mkfs.fat -F32 -n EFI /dev/mapper/${disk_efi}
|
||||
mkfs.ext2 -L ROOT /dev/mapper/${disk_sys}
|
||||
mkfs.ext4 -L ROOT /dev/mapper/${disk_sys}
|
||||
rm -rf $dir/mnt/
|
||||
mkdir -p $dir/mnt/
|
||||
mkdir -p $dir/mnt/{efi,sys,grub}
|
||||
mount -t vfat /dev/mapper/${disk_efi} $dir/mnt/efi
|
||||
mount -t ext4 /dev/mapper/${disk_sys} $dir/mnt/sys
|
||||
tar -xvf ./ubuntu.tar --directory ./mnt/sys/
|
||||
rm ./ubuntu.tar
|
||||
echo 'copying filesystem to mounted image'
|
||||
tar -xvf ./patronagefs.tar --directory $dir/mnt/sys/
|
||||
echo 'copied...'
|
||||
echo "${loop}"
|
||||
echo "${disk_efi}"
|
||||
echo "${disk_sys}"
|
||||
|
||||
#--grub-mkdevicemap=$dir/mnt/device.map
|
||||
#echo "(hd0) /dev/${disk_grub}" > $dir/mnt/device.map
|
||||
#--efi-directory=$dir/mnt/efi --boot-directory=$dir/mnt/grub --root-directory=$dir/mnt/sys
|
||||
grub-install --target=x86_64-efi --recheck --no-floppy --efi-directory=$dir/mnt/efi --root-directory=$dir/mnt/sys --bootloader-id=patronage /dev/$loop
|
||||
grub-install --target=x86_64-efi --recheck --no-floppy --efi-directory=$dir/mnt/efi --boot-directory=$dir/mnt/efi --root-directory=$dir/mnt/sys --bootloader-id=patronage /dev/$loop
|
||||
#umount $dir/mnt/image
|
||||
#lsblk -f
|
||||
mkdir -p $dir/mnt/efi/boot/
|
||||
|
||||
19
filesystem_containerfile
Executable file
19
filesystem_containerfile
Executable file
@@ -0,0 +1,19 @@
|
||||
from ubuntu:latest
|
||||
run apt-get update
|
||||
run apt-get upgrade -y
|
||||
run apt-get install -y python3 htop opensnitch
|
||||
run apt-get install -y qemu-system python3-bpfcc python3-pip bpfcc-tools ipset
|
||||
run pip install --break-system-packages dnslib psutil
|
||||
run apt-get install -y ufw ubuntu-gnome-desktop ubuntu-gnome-default-settings
|
||||
run apt-get install -y doas lm-sensors gnome-shell-extension-prefs gnome-software-plugin-flatpak gnome-tweaks flatpak snapd net-tools iputils-ping
|
||||
run apt-get install -y bluetooth gnome-bluetooth pulseaudio-module-bluetooth pulseaudio
|
||||
run apt-get install -y systemd-resolved
|
||||
run flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
run echo "permit persist :sudo as root" >> /etc/doas.conf
|
||||
run usermod -a -G sudo ubuntu
|
||||
run yes defaultpass | passwd ubuntu
|
||||
#run systemctl start snapd.service
|
||||
#run systemctl start flatpak.service
|
||||
#run snap install brave
|
||||
#run flatpak install flathub org.keepassxc.KeePassXC
|
||||
cmd ["/usr/bin/bash"]
|
||||
3
grub.cfg
Normal file → Executable file
3
grub.cfg
Normal file → Executable file
@@ -7,11 +7,10 @@ insmod gzio
|
||||
set root='(hd0,gpt1)'
|
||||
menuentry "PatronageOS" {
|
||||
ls (hd0,gpt1)/EFI/patronage/
|
||||
linux /EFI/patronage/bzImage quiet splash debug=yes ramdisk_size=500000,1 boot=/init
|
||||
linux /EFI/patronage/bzImage boot=/init
|
||||
echo 'loaded kernel...'
|
||||
initrd /EFI/patronage/initramfs.cpio.gz
|
||||
echo 'loaded initial ramdisk...'
|
||||
set debug=all
|
||||
boot
|
||||
echo 'done.'
|
||||
}
|
||||
|
||||
2
init.sh
Normal file → Executable file
2
init.sh
Normal file → Executable file
@@ -9,5 +9,5 @@
|
||||
#depmod -a
|
||||
#/bin/busybox modprobe nbd max_part=2
|
||||
|
||||
exec switch_root /newroot /bin/bash
|
||||
exec switch_root /newroot /bin/systemd
|
||||
#exec /bin/busybox sh
|
||||
|
||||
1
test_image.sh
Normal file
1
test_image.sh
Normal file
@@ -0,0 +1 @@
|
||||
qemu-system-x86_64 -bios /usr/share/ovmf/OVMF.fd -drive format=raw,file='./boot_image.img' -usbdevice tablet -m 4G -smp 2 -vga virtio -enable-kvm -machine type=pc-q35-3.1,accel=kvm,kernel_irqchip=on
|
||||
Reference in New Issue
Block a user