Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #263 from marcov/kernel-multiarch
obs-packaging: multi-arch kernel build support
- Loading branch information
Showing
4 changed files
with
113 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters