Skip to content

Commit

Permalink
Adjust the header installation path
Browse files Browse the repository at this point in the history
  • Loading branch information
ophub committed Jun 16, 2022
1 parent ab7b95e commit 5803923
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions rebuild
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ refactor_files() {
# Replace the kernel
build_boot="$(ls ${kernel_path}/${kernel}/boot-${kernel}-*.tar.gz 2>/dev/null | head -n 1)"
build_dtb="$(ls ${kernel_path}/${kernel}/dtb-amlogic-${kernel}-*.tar.gz 2>/dev/null | head -n 1)"
build_modules="$(ls ${kernel_path}/${kernel}/modules-${kernel}-*.tar.gz 2>/dev/null | head -n 1)"
build_header="$(ls ${kernel_path}/${kernel}/header-${kernel}-*.tar.gz 2>/dev/null | head -n 1)"
build_modules="$(ls ${kernel_path}/${kernel}/modules-${kernel}-*.tar.gz 2>/dev/null | head -n 1)"
[[ -n "${build_boot}" && -n "${build_dtb}" && -n "${build_modules}" && -n "${build_header}" ]] || error_msg "The 4 kernel missing."

# 01. For /boot five files
Expand All @@ -452,14 +452,16 @@ refactor_files() {
# 02. For /boot/dtb/amlogic/*
tar -xzf ${build_dtb} -C ${tag_bootfs}/dtb/amlogic && sync

# 03. For /usr/lib/modules/*
# 03. For /usr/src/linux-5.x.y
header_path="$(echo ${kernel} | awk -F "." '{print "linux-"$1"."$2".y"}')"
rm -rf "/usr/src/linux-*" 2>/dev/null && mkdir -p "/usr/src/${header_path}" && sync
tar -xzf ${build_header} -C ${tag_rootfs}/usr/src/${header_path} && sync

# 04. For /usr/lib/modules/*
tar -xzf ${build_modules} -C ${tag_rootfs}/usr/lib/modules && sync
(cd ${tag_rootfs}/usr/lib/modules/${kernel}-*/ && rm -f build source 2>/dev/null && sync)
(cd ${tag_rootfs}/usr/lib/modules/${kernel}-*/ && rm -f build source && ln -sf /usr/src/${header_path} build && ln -sf /usr/src/${header_path} source)
[[ "$(ls ${tag_rootfs}/usr/lib/modules/${kernel}-* -l 2>/dev/null | grep "^d" | wc -l)" -eq "1" ]] || error_msg "Missing kernel."

# 04. For /usr/include/*
tar -xzf ${build_header} -C ${tag_rootfs}/usr && sync

# Set the type of file system
if [[ "${ROOTFS_TYPE}" == "btrfs" ]]; then
uenv_mount_string="UUID=${ROOTFS_UUID} rootflags=compress=zstd:6 rootfstype=btrfs"
Expand Down

0 comments on commit 5803923

Please sign in to comment.