aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2021-01-26 19:56:04 +0100
committerDmitry Vyukov <dvyukov@google.com>2021-01-26 20:20:50 +0100
commita0ebf917e7319ae8ef71cd2f36c488db8a6b384e (patch)
tree3fb5a2221d66c9e246e000c1ff3d408c07d30732
parent71b9768d69177ae23b2b710a6c2009fafa764f99 (diff)
pkg/build: support all arches for linux
-rw-r--r--pkg/build/linux.go30
1 files changed, 17 insertions, 13 deletions
diff --git a/pkg/build/linux.go b/pkg/build/linux.go
index b7868c026..c35e5795e 100644
--- a/pkg/build/linux.go
+++ b/pkg/build/linux.go
@@ -13,6 +13,7 @@ import (
"io"
"io/ioutil"
"os"
+ "path"
"path/filepath"
"runtime"
"time"
@@ -65,15 +66,6 @@ func (linux linux) buildKernel(params *Params) error {
if err := osutil.CopyFile(configFile, outputConfig); err != nil {
return err
}
- // We build only zImage/bzImage as we currently don't use modules.
- var target string
- switch params.TargetArch {
- case targets.I386, targets.AMD64, targets.S390x:
- target = "bzImage"
- case targets.PPC64LE:
- target = "zImage"
- }
-
// Ensure CONFIG_GCC_PLUGIN_RANDSTRUCT doesn't prevent ccache usage.
// See /Documentation/kbuild/reproducible-builds.rst.
const seed = `const char *randstruct_seed = "e9db0ca5181da2eedb76eba144df7aba4b7f9359040ee58409765f2bdc4cb3b8";`
@@ -92,6 +84,7 @@ func (linux linux) buildKernel(params *Params) error {
return err
}
}
+ target := path.Base(kernelBin(params.TargetArch))
if err := runMake(params, target); err != nil {
return err
}
@@ -207,15 +200,26 @@ func LinuxMakeArgs(target *targets.Target, compiler, ccache, buildDir string) []
}
func kernelBin(arch string) string {
+ // We build only zImage/bzImage as we currently don't use modules.
switch arch {
- case targets.I386, targets.AMD64:
+ case targets.AMD64:
+ return "arch/x86/boot/bzImage"
+ case targets.I386:
return "arch/x86/boot/bzImage"
- case targets.PPC64LE:
- return "arch/powerpc/boot/zImage.pseries"
case targets.S390x:
return "arch/s390/boot/bzImage"
+ case targets.PPC64LE:
+ return "arch/powerpc/boot/zImage.pseries"
+ case targets.ARM:
+ return "arch/arm/boot/zImage"
+ case targets.ARM64:
+ return "arch/arm64/boot/Image"
+ case targets.RiscV64:
+ return "arch/riscv/boot/Image"
+ case targets.MIPS64LE:
+ return "vmlinux"
default:
- panic(fmt.Sprintf("unsupported arch %v", arch))
+ panic(fmt.Sprintf("pkg/build: unsupported arch %v", arch))
}
}