o/build/mkpayload: port to llvm-objcopy
GNU and LLVM objcopy have some material differences in how they work.
LLVM is able to automatically assign VMAs, but needs --set-section-flags
for it. Use that and drop all the explicit VMAs.
Also with the new toolchain cc.objcopy_excutable is not populated, so we
need to get the executable path using the new action-based way.
Currently contains a hack to force static on to get our custom toolchain
for both host and cross-builds as GNU objcopy is not compatible.
Change-Id: I0a5ef1cbeb3f94326a2cef099c23c046df166bdd
Reviewed-on: https://review.monogon.dev/c/monogon/+/4214
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
Tested-by: Jenkins CI
diff --git a/osbase/build/mkpayload/mkpayload.go b/osbase/build/mkpayload/mkpayload.go
index c1433f3..f486134 100644
--- a/osbase/build/mkpayload/mkpayload.go
+++ b/osbase/build/mkpayload/mkpayload.go
@@ -39,15 +39,14 @@
// as command line parameters.
sections = map[string]struct {
descr string
- vma string
required bool
file *string
}{
- "linux": {"Linux kernel image", "0x2000000", true, nil},
- "initrd": {"initramfs", "0x5000000", false, nil},
- "osrel": {"OS release file in text format", "0x20000", false, nil},
- "cmdline": {"a file containting additional kernel command line parameters", "0x30000", false, nil},
- "splash": {"a splash screen image in BMP format", "0x40000", false, nil},
+ "linux": {"Linux kernel image", true, nil},
+ "initrd": {"initramfs", false, nil},
+ "osrel": {"OS release file in text format", false, nil},
+ "cmdline": {"a file containting additional kernel command line parameters", false, nil},
+ "splash": {"a splash screen image in BMP format", false, nil},
}
initrdList stringList
objcopy = flag.String("objcopy", "", "objcopy executable")
@@ -151,7 +150,7 @@
if *c.file != "" {
args = append(args, []string{
"--add-section", fmt.Sprintf(".%s=%s", name, *c.file),
- "--change-section-vma", fmt.Sprintf(".%s=%s", name, c.vma),
+ fmt.Sprintf("--set-section-flags=.%s=data", name),
}...)
}
}