mirror of
https://github.com/AuxXxilium/arc-c.git
synced 2024-11-23 23:11:08 +07:00
db7cea48b4
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
34 lines
1.3 KiB
Bash
Executable File
34 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
[[ -z "${ARC_PATH}" || ! -d "${ARC_PATH}/include" ]] && ARC_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
|
|
. ${ARC_PATH}/include/functions.sh
|
|
|
|
set -o pipefail # Get exit code from process piped
|
|
|
|
# Sanity check
|
|
[ -f "${ORI_ZIMAGE_FILE}" ] || (die "${ORI_ZIMAGE_FILE} not found!" | tee -a "${LOG_FILE}")
|
|
|
|
rm -f "${MOD_ZIMAGE_FILE}"
|
|
|
|
KERNEL="$(readConfigKey "arc.kernel" "${USER_CONFIG_FILE}")"
|
|
if [ "${KERNEL}" = "custom" ]; then
|
|
echo -e "Using customized zImage"
|
|
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
|
|
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
|
|
PLATFORM="$(readModelKey "${MODEL}" "platform")"
|
|
KVER="$(readModelKey "${MODEL}" "productvers.[${PRODUCTVER}].kver")"
|
|
if [ "${PLATFORM}" = "epyc7002" ]; then
|
|
KVER="${PRODUCTVER}-${KVER}"
|
|
fi
|
|
# Extract bzImage
|
|
gzip -dc "${CUSTOM_PATH}/bzImage-${PLATFORM}-${KVER}.gz" >"${MOD_ZIMAGE_FILE}"
|
|
else
|
|
echo -e "Patching zImage"
|
|
# Extract vmlinux
|
|
${ARC_PATH}/bzImage-to-vmlinux.sh "${ORI_ZIMAGE_FILE}" "${TMP_PATH}/vmlinux" >"${LOG_FILE}" 2>&1 || dieLog
|
|
# Patch boot params and ramdisk check
|
|
${ARC_PATH}/kpatch "${TMP_PATH}/vmlinux" "${TMP_PATH}/vmlinux-mod" >"${LOG_FILE}" 2>&1 || dieLog
|
|
# rebuild zImage
|
|
${ARC_PATH}/vmlinux-to-bzImage.sh "${TMP_PATH}/vmlinux-mod" "${MOD_ZIMAGE_FILE}" >"${LOG_FILE}" 2>&1 || dieLog
|
|
fi |