!PSmBFWNKoXmlQBzUQf:helsinki-systems.de

Stage 1 systemd

82 Members
systemd in NixOs's stage 1, replacing the current bash tooling https://github.com/NixOS/nixpkgs/projects/5126 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
10 Mar 2023
@elvishjerricco:matrix.org@elvishjerricco:matrix.org *
  addSections = pkgs.writeShellScriptBin "add-sections" ''
    set -euo pipefail
    stub="$1"
    image="$2"

    stub_line=$(${pkgs.binutils}/bin/objdump -h "$stub" | tail -2 | head -1)
    stub_size=0x$(echo "$stub_line" | awk '{print $3}')
    stub_offs=0x$(echo "$stub_line" | awk '{print $4}')
    next_offs=$((stub_size + stub_offs))
    args=()

    while read sectionName contentsFile; do
      contentsFile="$(readlink -f "$contentsFile")"
      args+=(--add-section "$sectionName"="$contentsFile")
      args+=(--change-section-vma "$sectionName"=$(printf 0x%x $next_offs))
      next_offs=$((next_offs + $(stat -c%s "$contentsFile")))
    done

    set -x
    exec ${pkgs.binutils}/bin/objcopy "''${args[@]}" "$stub" "$image"
  '';
  stub = pkgs.runCommand "stub" {nativeBuildInputs = [addSections];} ''
    mkdir $out
    add-sections ${nixosConfig}/systemd/lib/systemd/boot/efi/linuxx64.efi.stub $out/foo-unsigned.efi <<EOF
      .osrel ${osRelease}
      .linux ${nixosConfig}/kernel
      .initrd ${nixosConfig}/initrd
    EOF
  '';
16:20:44
@elvishjerricco:matrix.org@elvishjerricco:matrix.org But also systemd now has theukify tool to do it, which can easily be used in a nix derivation. It just requires an os-release for whatever reason 16:22:00
@k900:0upti.meK900I know it's not hard, I just wanted to get it into nixpkgs16:25:24

Show newer messages


Back to Room ListRoom Version: 6