diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml index 75a4beae0feee..660c07e031c01 100644 --- a/.github/workflows/mirror.yml +++ b/.github/workflows/mirror.yml @@ -167,9 +167,18 @@ jobs: fi # build ############################################################## cd "${TOOLS_DIR}" - echo "| STATUS | BRANCH | VERSION | TYPE | USED PATCHES | COMPILER |" >> ${SUMMARY_FILE} - echo "| ------ | ------ | ------- | ---- | ------------ | -------- |" >> ${SUMMARY_FILE} - if time ./tools/make-kernel.bash ./config/linux-for-hp-integrities-v2 ia64 ${BUILD_DIR}; then + echo "| STATUS | BRANCH | VERSION | TYPE | USED PATCHES | COMPILER | DOWNLOAD |" >> ${SUMMARY_FILE} + echo "| ------ | ------ | ------- | ---- | ------------ | -------- | -------- |" >> ${SUMMARY_FILE} + BUILD_COMMAND="time ./tools/make-kernel.bash ./config/linux-for-hp-integrities-v3 ia64 ${BUILD_DIR} gha tar-pkg" + if ${BUILD_COMMAND}; then + mkdir build-artifacts && mv $( cat ${BUILD_DIR}/LINUX_BUILD_LOG ) $( cat ${BUILD_DIR}/LINUX_TARBALL ) build-artifacts/ + pushd build-artifacts/ + sha256sum * > SHA256 + popd + # exports ########################################################## + echo "BUILD_ARTIFACTS=${PWD}/build-artifacts" >> $GITHUB_ENV + echo "KERNEL_VERSION=${KERNEL_VERSION}" >> $GITHUB_ENV + #################################################################### echo "| :white_check_mark: | ${BRANCH} | ${KERNEL_VERSION} | regular | ${USED_PATCHES} | ${CROSS_COMPILER_AND_VERSION} |" >> ${SUMMARY_FILE} echo "${KERNEL_VERSION}" > ${GITHUB_WORKSPACE}/${BRANCH}-last-kernel-version true @@ -178,6 +187,18 @@ jobs: true fi + - uses: actions/upload-artifact@v4 + id: artifact-upload-step + with: + name: ${{ env.KERNEL_VERSION }} + path: ${{ env.BUILD_ARTIFACTS }}/ + compression-level: 0 + retention-days: 2 + + - name: Output artifact ID + run: | + echo '||||||| [build artifacts](${{ steps.artifact-upload-step.outputs.artifact-url }}) |' >> ${SUMMARY_FILE} + # - uses: actions/upload-artifact@v4 # with: # name: ${{ matrix.branch }}-last-kernel-version @@ -213,7 +234,7 @@ jobs: echo "EXIT_EARLY=1" >> $GITHUB_ENV true fi - HP_SIM_KERNEL="${BUILD_DIR}/../vmlinux-ski" + HP_SIM_KERNEL="${BUILD_DIR}/vmlinux" # exports ############################################################ echo "HP_SIM_KERNEL=${HP_SIM_KERNEL}" >> $GITHUB_ENV diff --git a/tools/make-kernel.bash b/tools/make-kernel.bash index b4ac78dcb8538..0cc303aa70559 100755 --- a/tools/make-kernel.bash +++ b/tools/make-kernel.bash @@ -2,6 +2,9 @@ # Frank Scheiner +# 2024-08-03 - 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 []" + echo "Usage: $0 [ [tar-pkg]]" 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,204 @@ 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} ${_extraMakeOption}" + date + time make -j${_threads} LOCALVERSION="${_localversion}" ARCH=${_arch} ${_crossCompileOption} ${_extraMakeOption} + _makeReturned=$? + echo ${_makeReturned} + date - echo "done" -else - echo "failed" - exit 1 -fi -) 2>&1 | tee -a "$_tempLogFile" + if [[ ${_makeReturned} -eq 0 ]]; then + echo "done" + else + echo "failed" + exit 1 + fi + ) 2>&1 | tee -a "$_tempLogFile" -# save artifacts ############################################################### -_kernelRelease=$( make -s LOCALVERSION="${_localversion}" kernelrelease ) -cp vmlinux /boot/vmlinux-${_kernelRelease} + if [[ ! $? -eq 0 ]]; then + + exit 1 + fi -_uncompressedKernel="/boot/vmlinux-${_kernelRelease}" + # 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" -if [[ "${_arch}" == "alpha" ]]; then + rm -f tar-install/boot/*kbuild* - # 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 [[ -e ${_tarball} ]]; then -elif [[ "${_arch}" == "x86_64" ]]; then + rm -f ${_tarball} + fi - _compressedKernel="/boot/vmlinuz-${_kernelRelease}" - cp arch/x86/boot/bzImage "${_compressedKernel}" + # 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 - _compressedKernel="/boot/vmlinuz-${_kernelRelease}" - cp vmlinux.gz "${_compressedKernel}" -fi + # 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" -_configuration="/boot/config-${_kernelRelease}" -cp .config ${_configuration} + if [[ ! $? -eq 0 ]]; then -_systemMap="/boot/System.map-${_kernelRelease}" -cp System.map ${_systemMap} + exit 1 + fi -cd /lib/modules + if [[ "$_flavor" == "ski" ]]; then -if [[ "${_arch}" == "alpha" ]]; then + # If building a kernel to run in ski exit here already + exit + fi - # 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} + # 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 - _kernelModules=( "/lib/modules/${_kernelRelease}-non-stripped.tar" "/lib/modules/${_kernelRelease}-stripped.tar" ) -else - tar -cf ${_kernelRelease}.tar ${_kernelRelease} + if [[ ${_makeReturned} -eq 0 ]]; then - _kernelModules=( "/lib/modules/${_kernelRelease}.tar" ) -fi + echo "done" + else + echo "failed" + exit 1 + fi + ) 2>&1 | tee -a "$_tempLogFile" -_finalLogFile="/boot/build.log-${_kernelRelease}" + if [[ ! $? -eq 0 ]]; then -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" + exit 1 + fi + # save artifacts ############################################################### + cp vmlinux /boot/vmlinux-${_kernelRelease} -mv "$_tempLogFile" "$_finalLogFile" + _uncompressedKernel="/boot/vmlinux-${_kernelRelease}" -compressLogFile "$_finalLogFile" & + if [[ "${_arch}" == "alpha" ]]; 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}" + + elif [[ "${_arch}" == "x86_64" ]]; then + + _compressedKernel="/boot/vmlinuz-${_kernelRelease}" + cp arch/x86/boot/bzImage "${_compressedKernel}" + else + _compressedKernel="/boot/vmlinuz-${_kernelRelease}" + cp vmlinux.gz "${_compressedKernel}" + fi + + _configuration="/boot/config-${_kernelRelease}" + cp .config ${_configuration} + + _systemMap="/boot/System.map-${_kernelRelease}" + cp System.map ${_systemMap} + + cd /lib/modules + + 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} + + _kernelModules=( "/lib/modules/${_kernelRelease}-non-stripped.tar" "/lib/modules/${_kernelRelease}-stripped.tar" ) + else + tar -cf ${_kernelRelease}.tar ${_kernelRelease} + + _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