53 lines
1 KiB
Bash
53 lines
1 KiB
Bash
|
set -ex -o pipefail
|
||
|
|
||
|
mkdir -p $out/repart.d $out/boot
|
||
|
pushd $out
|
||
|
|
||
|
# Don't seem to work just to create a symlink to rootfs derivation?
|
||
|
# ln -sf $rootfs rootfs
|
||
|
mkdir rootfs
|
||
|
cp -prP $rootfs/* rootfs/
|
||
|
find rootfs/ -type d -exec chmod 755 {} \;
|
||
|
|
||
|
$systemd/usr/bin/ukify build \
|
||
|
--os-release rootfs/etc/os-release \
|
||
|
--linux $kernel/bzImage \
|
||
|
--initrd $initrd/initrd.xz \
|
||
|
--cmdline "console=ttyS0" \
|
||
|
-o boot/patos-x64.efi
|
||
|
|
||
|
cp ${systemd}/usr/lib/systemd/boot/efi/systemd-bootx64.efi boot/
|
||
|
|
||
|
cat <<EOF > repart.d/10-esp.conf
|
||
|
[Partition]
|
||
|
Type=esp
|
||
|
Format=vfat
|
||
|
SizeMinBytes=96M
|
||
|
SizeMaxBytes=96M
|
||
|
SplitName=-
|
||
|
CopyFiles=/boot/patos-x64.efi:/EFI/Linux/patos-x64.efi
|
||
|
CopyFiles=/boot/systemd-bootx64.efi:/EFI/BOOT/BOOTX64.EFI
|
||
|
EOF
|
||
|
|
||
|
cat <<EOF > repart.d/10-root.conf
|
||
|
[Partition]
|
||
|
Type=root
|
||
|
Format=erofs
|
||
|
CopyFiles=/rootfs:/
|
||
|
Minimize=best
|
||
|
SplitName=root
|
||
|
EOF
|
||
|
|
||
|
$systemd/usr/bin/systemd-repart \
|
||
|
--no-pager \
|
||
|
--empty=create \
|
||
|
--size=1G \
|
||
|
--definitions=./repart.d \
|
||
|
--root=$out \
|
||
|
patos-$version.raw
|
||
|
|
||
|
rm -rf rootfs
|
||
|
rm -rf boot
|
||
|
|
||
|
popd
|