-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make regular kernel build artifacts available for download
* artifact zip file contains: * zstd compressed build log * zstd compressed tarball of kernel images and modules * `SHA256` with hash values of the files above * retention time is 2 days > **NOTICE:** unfortunately only registered users can download artifacts (GH limitation)
- Loading branch information
1 parent
e281c97
commit 674e26d
Showing
2 changed files
with
195 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
|
||
# Frank Scheiner <[email protected]> | ||
|
||
# 2024-08-02 - v0.9.0 | ||
# make kernel tarball if needed | ||
|
||
# 2024-05-15 - v0.7.0 | ||
# Add env var EMPTY_LOCALVERSION to compile with empty localversion | ||
|
||
|
@@ -36,7 +39,7 @@ _flavor="" | |
|
||
usageMsg() | ||
{ | ||
echo "Usage: $0 <KERNEL_CONFIG> <ARCH> <KERNEL_TREE> [<FLAVOR>]" | ||
echo "Usage: $0 <KERNEL_CONFIG> <ARCH> <KERNEL_TREE> [<FLAVOR> [<EXTRA_MAKE_OPTION>]]" | ||
|
||
return | ||
} | ||
|
@@ -95,6 +98,12 @@ if [[ "$1" != "" ]]; then | |
|
||
_flavor="-${1}" | ||
shift | ||
|
||
if [[ "$1" != "" ]]; then | ||
|
||
_extraMakeOption="$1" | ||
shift | ||
fi | ||
fi | ||
|
||
#### | ||
|
@@ -186,6 +195,11 @@ else | |
fi | ||
) | tee -a "$_tempLogFile" | ||
|
||
if [[ ! $? -eq 0 ]]; then | ||
|
||
exit 1 | ||
fi | ||
|
||
_oldPWD="$PWD" | ||
cd ${_kernelTree} || ( echo "$0: cannot cd to \"${_kernelTree}\"."; exit 1 ) | ||
|
||
|
@@ -221,119 +235,191 @@ else | |
fi | ||
) 2>&1 | tee -a "$_tempLogFile" | ||
|
||
if [[ ! $? -eq 0 ]]; then | ||
|
||
# make all ##################################################################### | ||
( | ||
echo "Making kernel..." | ||
debug "time make -j${_threads} LOCALVERSION=\"${_localversion}\" ARCH=${_arch} ${_crossCompileOption} all" | ||
date | ||
time make -j${_threads} LOCALVERSION="${_localversion}" ARCH=${_arch} ${_crossCompileOption} all | ||
_makeReturned=$? | ||
echo ${_makeReturned} | ||
date | ||
|
||
if [[ ${_makeReturned} -eq 0 ]]; then | ||
|
||
echo "done" | ||
else | ||
echo "failed" | ||
exit 1 | ||
fi | ||
) 2>&1 | tee -a "$_tempLogFile" | ||
|
||
# copy kernels to the expected place | ||
cp vmlinux "../vmlinux${_flavor}" | ||
cp vmlinux.gz "../vmlinux.gz${_flavor}" | ||
_kernelRelease=$( make -s LOCALVERSION="${_localversion}" kernelrelease ) | ||
|
||
# exit early for CI run | ||
exit | ||
_tarball="linux-${_kernelRelease}.tar" | ||
_finalLogFileName="build.log-${_kernelRelease}" | ||
|
||
# make modules_install ######################################################### | ||
( | ||
echo "Installing modules..." | ||
debug "time make LOCALVERSION=\"${_localversion}\" ARCH=${_arch} ${_crossCompileOption} modules_install" | ||
date | ||
time make LOCALVERSION="${_localversion}" ARCH=${_arch} ${_crossCompileOption} modules_install | ||
_makeReturned=$? | ||
echo ${_makeReturned} | ||
date | ||
if [[ "$_extraMakeOption" != "" ]]; then | ||
|
||
if [[ ${_makeReturned} -eq 0 ]]; then | ||
# make tarball ##################################################################### | ||
( | ||
echo "Making kernel tarball..." | ||
debug "time make -j${_threads} LOCALVERSION=\"${_localversion}\" ARCH=${_arch} ${_crossCompileOption} dir-pkg" | ||
date | ||
time make -j${_threads} LOCALVERSION="${_localversion}" ARCH=${_arch} ${_crossCompileOption} dir-pkg | ||
_makeReturned=$? | ||
echo ${_makeReturned} | ||
date | ||
|
||
echo "done" | ||
if [[ ${_makeReturned} -eq 0 ]]; then | ||
|
||
echo "done" | ||
else | ||
echo "failed" | ||
exit 1 | ||
fi | ||
) 2>&1 | tee -a "$_tempLogFile" | ||
|
||
if [[ ! $? -eq 0 ]]; then | ||
|
||
exit 1 | ||
fi | ||
|
||
# replace vmlinuz (which is just a copy of the unstripped and uncompressed vmlinux) with vmlinux.gz | ||
_vmlinuz="tar-install/boot/vmlinuz-${_kernelRelease}" | ||
echo "cp vmlinux.gz \"$_vmlinuz\"" | tee -a "$_tempLogFile" | ||
cp vmlinux.gz "$_vmlinuz" | ||
|
||
# make actual tarball | ||
pushd tar-install &>/dev/null | ||
( | ||
echo "time tar -cf ../${_tarball} boot lib" | ||
date | ||
time tar -cf ../${_tarball} boot lib | ||
date | ||
) 2>&1 | tee -a "$_tempLogFile" | ||
popd &>/dev/null | ||
|
||
# compress tarball | ||
( | ||
echo "zstd -T0 -9 ${_tarball}" | ||
date | ||
time zstd -T0 -9 ${_tarball} &>/dev/null | ||
date | ||
) 2>&1 | tee -a "$_tempLogFile" | ||
|
||
( | ||
echo "Build artifacts:" | ||
echo "$PWD/${_finalLogFileName}.zst" | ||
echo "$PWD/${_tarball}.zst" | ||
echo "END: $( date )" | ||
) | tee -a "$_tempLogFile" | ||
|
||
zstd -T0 -9 "$_tempLogFile" -o "${_finalLogFileName}.zst" &>/dev/null && rm "$_tempLogFile" | ||
|
||
echo "$PWD/${_finalLogFileName}.zst" > LINUX_BUILD_LOG | ||
echo "$PWD/${_tarball}.zst" > LINUX_TARBALL | ||
else | ||
echo "failed" | ||
exit 1 | ||
fi | ||
) 2>&1 | tee -a "$_tempLogFile" | ||
# make all ##################################################################### | ||
( | ||
echo "Making kernel..." | ||
debug "time make -j${_threads} LOCALVERSION=\"${_localversion}\" ARCH=${_arch} ${_crossCompileOption} all" | ||
date | ||
time make -j${_threads} LOCALVERSION="${_localversion}" ARCH=${_arch} ${_crossCompileOption} all | ||
_makeReturned=$? | ||
echo ${_makeReturned} | ||
date | ||
|
||
if [[ ${_makeReturned} -eq 0 ]]; then | ||
|
||
echo "done" | ||
else | ||
echo "failed" | ||
exit 1 | ||
fi | ||
) 2>&1 | tee -a "$_tempLogFile" | ||
|
||
if [[ ! $? -eq 0 ]]; then | ||
|
||
# save artifacts ############################################################### | ||
_kernelRelease=$( make -s LOCALVERSION="${_localversion}" kernelrelease ) | ||
cp vmlinux /boot/vmlinux-${_kernelRelease} | ||
exit 1 | ||
fi | ||
|
||
_uncompressedKernel="/boot/vmlinux-${_kernelRelease}" | ||
# make modules_install ######################################################### | ||
( | ||
echo "Installing modules..." | ||
debug "time make LOCALVERSION=\"${_localversion}\" ARCH=${_arch} ${_crossCompileOption} modules_install" | ||
date | ||
time make LOCALVERSION="${_localversion}" ARCH=${_arch} ${_crossCompileOption} modules_install | ||
_makeReturned=$? | ||
echo ${_makeReturned} | ||
date | ||
|
||
if [[ "${_arch}" == "alpha" ]]; then | ||
if [[ ${_makeReturned} -eq 0 ]]; then | ||
|
||
# Due to aboot being unable to handle arbitrary large kernel and initrd images (total max size roughly 13 MiB or so!) | ||
alpha-linux-strip vmlinux | ||
gzip -c -9 vmlinux > vmlinuz | ||
_compressedKernel="/boot/vmlinuz-${_kernelRelease}-stripped" | ||
cp vmlinuz "${_compressedKernel}" | ||
echo "done" | ||
else | ||
echo "failed" | ||
exit 1 | ||
fi | ||
) 2>&1 | tee -a "$_tempLogFile" | ||
|
||
elif [[ "${_arch}" == "x86_64" ]]; then | ||
if [[ ! $? -eq 0 ]]; then | ||
|
||
_compressedKernel="/boot/vmlinuz-${_kernelRelease}" | ||
cp arch/x86/boot/bzImage "${_compressedKernel}" | ||
else | ||
_compressedKernel="/boot/vmlinuz-${_kernelRelease}" | ||
cp vmlinux.gz "${_compressedKernel}" | ||
fi | ||
exit 1 | ||
fi | ||
# save artifacts ############################################################### | ||
cp vmlinux /boot/vmlinux-${_kernelRelease} | ||
|
||
_configuration="/boot/config-${_kernelRelease}" | ||
cp .config ${_configuration} | ||
_uncompressedKernel="/boot/vmlinux-${_kernelRelease}" | ||
|
||
_systemMap="/boot/System.map-${_kernelRelease}" | ||
cp System.map ${_systemMap} | ||
if [[ "${_arch}" == "alpha" ]]; then | ||
|
||
cd /lib/modules | ||
# Due to aboot being unable to handle arbitrary large kernel and initrd images (total max size roughly 13 MiB or so!) | ||
alpha-linux-strip vmlinux | ||
gzip -c -9 vmlinux > vmlinuz | ||
_compressedKernel="/boot/vmlinuz-${_kernelRelease}-stripped" | ||
cp vmlinuz "${_compressedKernel}" | ||
|
||
if [[ "${_arch}" == "alpha" ]]; then | ||
elif [[ "${_arch}" == "x86_64" ]]; then | ||
|
||
# same here (see above) | ||
tar -cf ${_kernelRelease}-non-stripped.tar ${_kernelRelease} | ||
cd ${_kernelRelease} | ||
find . -name "*.ko" -exec alpha-linux-strip --strip-debug '{}' \; | ||
cd .. | ||
tar -cf ${_kernelRelease}-stripped.tar ${_kernelRelease} | ||
_compressedKernel="/boot/vmlinuz-${_kernelRelease}" | ||
cp arch/x86/boot/bzImage "${_compressedKernel}" | ||
else | ||
_compressedKernel="/boot/vmlinuz-${_kernelRelease}" | ||
cp vmlinux.gz "${_compressedKernel}" | ||
fi | ||
|
||
_kernelModules=( "/lib/modules/${_kernelRelease}-non-stripped.tar" "/lib/modules/${_kernelRelease}-stripped.tar" ) | ||
else | ||
tar -cf ${_kernelRelease}.tar ${_kernelRelease} | ||
_configuration="/boot/config-${_kernelRelease}" | ||
cp .config ${_configuration} | ||
|
||
_kernelModules=( "/lib/modules/${_kernelRelease}.tar" ) | ||
fi | ||
_systemMap="/boot/System.map-${_kernelRelease}" | ||
cp System.map ${_systemMap} | ||
|
||
_finalLogFile="/boot/build.log-${_kernelRelease}" | ||
cd /lib/modules | ||
|
||
cd ${_oldPWD} | ||
( | ||
echo "Build artifacts:" | ||
echo "${_finalLogFile}.zst" | ||
echo "${_configuration}" | ||
echo "${_systemMap}" | ||
echo "${_uncompressedKernel}" | ||
echo "${_compressedKernel}" | ||
for _tarball in "${_kernelModules[@]}"; do | ||
|
||
echo "${_tarball}" | ||
done | ||
echo "END: $( date )" | ||
) | tee -a "$_tempLogFile" | ||
if [[ "${_arch}" == "alpha" ]]; then | ||
|
||
# same here (see above) | ||
tar -cf ${_kernelRelease}-non-stripped.tar ${_kernelRelease} | ||
cd ${_kernelRelease} | ||
find . -name "*.ko" -exec alpha-linux-strip --strip-debug '{}' \; | ||
cd .. | ||
tar -cf ${_kernelRelease}-stripped.tar ${_kernelRelease} | ||
|
||
mv "$_tempLogFile" "$_finalLogFile" | ||
_kernelModules=( "/lib/modules/${_kernelRelease}-non-stripped.tar" "/lib/modules/${_kernelRelease}-stripped.tar" ) | ||
else | ||
tar -cf ${_kernelRelease}.tar ${_kernelRelease} | ||
|
||
compressLogFile "$_finalLogFile" & | ||
_kernelModules=( "/lib/modules/${_kernelRelease}.tar" ) | ||
fi | ||
|
||
_finalLogFile="/boot/build.log-${_kernelRelease}" | ||
|
||
cd ${_oldPWD} | ||
( | ||
echo "Build artifacts:" | ||
echo "${_finalLogFile}.zst" | ||
echo "${_configuration}" | ||
echo "${_systemMap}" | ||
echo "${_uncompressedKernel}" | ||
echo "${_compressedKernel}" | ||
for _tarball in "${_kernelModules[@]}"; do | ||
|
||
echo "${_tarball}" | ||
done | ||
echo "END: $( date )" | ||
) | tee -a "$_tempLogFile" | ||
|
||
mv "$_tempLogFile" "$_finalLogFile" | ||
|
||
compressLogFile "$_finalLogFile" | ||
|
||
fi | ||
|
||
exit |