Files
kata-containers/obs-packaging/linux-container/kata-multiarch.sh
Marco Vedovati e2fb50411f obs-packaging: multi-arch kernel build support
Update the kernel package to allow building for multiple architectures with
a single set of sources.
Changes:
- Add kernel configs for all architectures
- Detect at runtime the correct target architecture and kernel
compressed image location. This is done  with the script kata-multiarch.sh

Note that debian control files still need to be updated to handle Multi-Arch,
so that they are not tied to the architecture on which
`linux-container/update.sh` is run.

Fixes: #262

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
2018-11-30 12:02:16 +01:00

61 lines
1.1 KiB
Bash

#!/usr/bin/env bash
set -e
# Convert architecture to the name used by the Linux kernel build system
arch_to_kernel() {
local -r arch="$1"
case "${arch}" in
aarch64) echo "arm64";;
ppc64le) echo "powerpc";;
s390|s390x) echo "s390";;
x86_64) echo "${arch}";;
*) echo "unsupported architecture: ${arch}" >&2; exit 1;;
esac
}
# Convert architecture to the location of the compressed linux image
arch_to_image() {
local -r arch="$1"
case "${arch}" in
aarch64)
echo "arch/arm64/boot/Image"
;;
ppc64le)
# No compressed image
;;
s390|s390x)
echo "arch/s390/boot/image"
;;
*)
echo "arch/${arch}/boot/bzImage"
;;
esac
}
usage() {
echo "$(basename $0) FLAG ARCHITECTURE"
echo "Allowed flags:"
echo " -a : Print kernel architecture"
echo " -i : Print kernel compressed image location (may be empty)"
}
if [ "$#" != "2" ]; then
echo -e "Invalid options\n\n$(usage)" >&2
exit 1
fi
case "$1" in
-a)
arch_to_kernel $2
;;
-i)
arch_to_image $2
;;
*)
echo -e "Invalid options\n\n$(usage)" >&2
exit 1
;;
esac