Compare commits

..

1 commit

Author SHA1 Message Date
3e702092e4
silly uki image with the systemd-ukify tooling 2025-02-17 16:59:20 +01:00
2 changed files with 18 additions and 8 deletions

View file

@ -22,22 +22,32 @@
default = self.packages.${system}.image;
image = pkgs.writeShellScriptBin "image" ''
echo "make UKI..."
${self.packages.${system}.systemd.out}/bin/ukify build \
echo ${self.packages.${system}.kernel.kernel}/bzImage
${self.packages.${system}.systemd.out}/usr/bin/ukify build \
--linux ${self.packages.${system}.kernel.kernel}/bzImage \
--initrd ./out/initrd.gz \
--initrd ./initrd.gz \
--cmdline "console=ttyS0" \
-o patos.uki
-o patos.efi
'';
kernel = pkgs.callPackage ./kernel { };
initrd = pkgs.writeShellScriptBin "mkinitrd" ''
echo "make initrd..."
mkdir -p out/lib
mkdir -p out
# copy systemd
cp -r ${self.packages.${system}.systemd.out}/* out/
pushd out
chmod 755 etc
chmod 755 etc usr/lib
mkdir -p dev proc sys tmp root
ln -sf usr/bin bin
ln -sf usr/sbin sbin
ln -sf usr/lib lib
ln -sf usr/lib lib64
ln -sf ../proc/self/mounts etc/mtab
ln -sf usr/lib/systemd/systemd init
echo patos > ./etc/hostname
cat <<EOF > ./etc/os-release
@ -99,10 +109,10 @@
chmod 644 ./etc/group
# get shared libs
find . -type f -executable | xargs ldd | awk '{print $3}' | grep -v systemd | sort -u | xargs cp -t lib
find . -type f -executable | xargs ldd | awk '{print $3}' | grep -v systemd | sort -u | xargs cp -t usr/lib
# gen initrd
find . -print0 | ${pkgs.lib.getExe pkgs.cpio} --null --owner=root:root -o --format=newc | ${pkgs.lib.getExe pkgs.gzip} -9 > initrd.gz
find . -print0 | ${pkgs.lib.getExe pkgs.cpio} --null --owner=root:root -o --format=newc | ${pkgs.lib.getExe pkgs.gzip} -9 > ../initrd.gz
'';
systemd = pkgs.callPackage ./systemd { };
};

View file

@ -171,7 +171,7 @@ stdenv.mkDerivation (finalAttrs: {
"--sysconfdir=/etc"
"--localstatedir=/var"
"--libdir=/usr/lib"
"--bindir=/bin"
"--bindir=/usr/bin"
"--includedir=/usr/include"
"--localedir=/usr/share/locale"