systemd: fix ukify (to cross compile)
This commit is contained in:
parent
b4c0a4370e
commit
dc42ccec87
@ -82,6 +82,9 @@
|
||||
, bpftools
|
||||
, libbpf
|
||||
|
||||
# Needed to produce a ukify that works for cross compiling UKIs.
|
||||
, targetPackages
|
||||
|
||||
, withAcl ? true
|
||||
, withAnalyze ? true
|
||||
, withApparmor ? true
|
||||
@ -242,6 +245,16 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# BPF does not work with stack protector
|
||||
substituteInPlace src/core/bpf/meson.build \
|
||||
--replace "clang_flags = [" "clang_flags = [ '-fno-stack-protector',"
|
||||
'' + lib.optionalString withUkify ''
|
||||
substituteInPlace src/ukify/ukify.py \
|
||||
--replace \
|
||||
"'readelf'" \
|
||||
"'${targetPackages.stdenv.cc.bintools.targetPrefix}readelf'"
|
||||
# The objcopy dependency is removed in v254
|
||||
substituteInPlace src/ukify/ukify.py \
|
||||
--replace \
|
||||
"'objcopy'" \
|
||||
"'${targetPackages.stdenv.cc.bintools.targetPrefix}objcopy'"
|
||||
'' + (
|
||||
let
|
||||
# The following patches references to dynamic libraries to ensure that
|
||||
@ -731,6 +744,11 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
done
|
||||
'' + lib.optionalString withEfi ''
|
||||
mv $out/dont-strip-me $out/lib/systemd/boot/efi
|
||||
'' + lib.optionalString withUkify ''
|
||||
# To cross compile a derivation that builds a UKI with ukify, we need to wrap
|
||||
# ukify with the correct binutils. When wrapping, no splicing happens so we
|
||||
# have to explicitly pull binutils from targetPackages.
|
||||
wrapProgram $out/lib/systemd/ukify --set PATH ${lib.makeBinPath [ targetPackages.stdenv.cc.bintools ] }
|
||||
'';
|
||||
|
||||
disallowedReferences = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform)
|
||||
|
Loading…
Reference in New Issue
Block a user