Skip to content

Commit

Permalink
Adjust decompression command parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ophub committed May 27, 2023
1 parent 64a2995 commit 07e8527
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions build-armbian/armbian-files/common-files/usr/sbin/armbian-update
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ get_textoffset() {
temp_dir="$(mktemp -d)"
(
cd ${temp_dir}
tar -xzf "${boot_tgz_file}" --touch "${vmlinuz_name}"
tar -mxzf "${boot_tgz_file}" "${vmlinuz_name}"
)
# With TEXT_OFFSET patch is [ 0108 ], without TEXT_OFFSET patch is [ 0000 ] and need to ues [ UBOOT_OVERLOAD ] file.
[[ "$(hexdump -n 15 -x "${temp_dir}/${vmlinuz_name}" 2>/dev/null | head -n 1 | awk '{print $7}')" == "0108" ]] && need_overload="no"
Expand Down Expand Up @@ -318,7 +318,7 @@ download_kernel() {
echo -e "${INFO} Download kernel to: [ ${kernel_path} ]"
wget "${kernel_down_from}" -q -P "${kernel_path}"
[[ "${?}" -ne "0" ]] && error_msg "Failed to download kernel."
tar -xzf "${kernel_path}/${inputs_kernel}.tar.gz" --touch -C "${kernel_path}"
tar -mxzf "${kernel_path}/${inputs_kernel}.tar.gz" -C "${kernel_path}"
[[ "${?}" -ne "0" ]] && error_msg "Failed to extract kernel [ ${inputs_kernel} ], stop updating."
kernel_path="${kernel_path}/${inputs_kernel}"
else
Expand Down Expand Up @@ -453,7 +453,7 @@ update_kernel() {
rm -rf /boot/uInitrd /boot/Image /boot/zImage /boot/dtb-*

# 01. For /boot five files
tar -xzf boot-${kernel_name}.tar.gz --touch -C /boot
tar -mxzf boot-${kernel_name}.tar.gz -C /boot
[[ "${PLATFORM}" == "amlogic" ]] && (cd /boot && cp -f uInitrd-${kernel_name} uInitrd && cp -f vmlinuz-${kernel_name} zImage)
[[ "${PLATFORM}" == "rockchip" ]] && (cd /boot && ln -sf uInitrd-${kernel_name} uInitrd && ln -sf vmlinuz-${kernel_name} Image)
[[ "${PLATFORM}" == "allwinner" ]] && (cd /boot && cp -f uInitrd-${kernel_name} uInitrd && cp -f vmlinuz-${kernel_name} Image)
Expand All @@ -462,21 +462,21 @@ update_kernel() {

# 02. For /boot/dtb/${PLATFORM}/*
[[ -d "/boot/dtb/${PLATFORM}" ]] || mkdir -p /boot/dtb/${PLATFORM}
tar -xzf dtb-${PLATFORM}-${kernel_name}.tar.gz --touch -C /boot/dtb/${PLATFORM}
tar -mxzf dtb-${PLATFORM}-${kernel_name}.tar.gz -C /boot/dtb/${PLATFORM}
[[ "${PLATFORM}" == "rockchip" ]] && ln -sf dtb /boot/dtb-${kernel_name}
[[ "$(ls /boot/dtb/${PLATFORM} -l 2>/dev/null | grep "^-" | wc -l)" -ge "2" ]] || error_msg "/boot/dtb/${PLATFORM} files is missing."
echo -e "${INFO} (2/4) Unpacking [ dtb-${PLATFORM}-${kernel_name}.tar.gz ] succeeded."

# 03. For /usr/src/linux-headers-${kernel_name}
header_path="linux-headers-${kernel_name}"
rm -rf /usr/src/linux-headers-* && mkdir -p "/usr/src/${header_path}"
tar -xzf header-${kernel_name}.tar.gz --touch -C /usr/src/${header_path}
tar -mxzf header-${kernel_name}.tar.gz -C /usr/src/${header_path}
[[ -d "/usr/src/${header_path}/include" ]] || error_msg "/usr/src/${header_path}/include folder is missing."
echo -e "${INFO} (3/4) Unpacking [ header-${kernel_name}.tar.gz ] succeeded."

# 04. For /usr/lib/modules/${kernel_name}
rm -rf /usr/lib/modules/*
tar -xzf modules-${kernel_name}.tar.gz --touch -C /usr/lib/modules
tar -mxzf modules-${kernel_name}.tar.gz -C /usr/lib/modules
(cd /usr/lib/modules/${kernel_name}/ && rm -f build source && ln -sf /usr/src/${header_path} build)
[[ -d "/usr/lib/modules/${kernel_name}" ]] || error_msg "/usr/lib/modules/${kernel_name} kernel folder is missing."
echo -e "${INFO} (4/4) Unpacking [ modules-${kernel_name}.tar.gz ] succeeded."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ copy_rootfs() {
echo -e "${INFO} Copy the [ ${src} ] directory."
tar -cf - ${src} | (
cd ${DIR_INSTALL}
tar -xf - --touch
tar -mxf -
)
done
# Create relevant symbolic link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ copy_rootfs() {
echo -e "${INFO} Copying [ ${src} ] ..."
tar -cf - ${src} | (
cd ${DIR_INSTALL}
tar -xf - --touch
tar -mxf -
)
done
# Create relevant symbolic link
Expand Down
10 changes: 5 additions & 5 deletions rebuild
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ download_kernel() {
wget "${kernel_down_from}" -q -P "${kernel_path}/${kd}"
[[ "${?}" -ne "0" ]] && error_msg "Failed to download the kernel files from the server."

tar -xzf "${kernel_path}/${kd}/${kernel_var}.tar.gz" --touch -C "${kernel_path}/${kd}"
tar -mxzf "${kernel_path}/${kd}/${kernel_var}.tar.gz" -C "${kernel_path}/${kd}"
[[ "${?}" -ne "0" ]] && error_msg "[ ${kernel_var} ] kernel decompression failed."
else
echo -e "${INFO} (${x}.${i}) [ ${k} - ${kernel_var} ] Kernel is in the local directory."
Expand Down Expand Up @@ -761,7 +761,7 @@ replace_kernel() {
[[ -s "${kernel_boot}" && -s "${kernel_dtb}" && -s "${kernel_modules}" && -s "${kernel_header}" ]] || error_msg "The 4 kernel missing."

# 01. For /boot five files
tar -xzf ${kernel_boot} --touch -C ${tag_bootfs}
tar -mxzf ${kernel_boot} -C ${tag_bootfs}
[[ "${PLATFORM}" == "amlogic" ]] && (cd ${tag_bootfs} && cp -f uInitrd-${kernel_name} uInitrd && cp -f vmlinuz-${kernel_name} zImage)
[[ "${PLATFORM}" == "rockchip" ]] && (cd ${tag_bootfs} && ln -sf uInitrd-${kernel_name} uInitrd && ln -sf vmlinuz-${kernel_name} Image)
[[ "${PLATFORM}" == "allwinner" ]] && (cd ${tag_bootfs} && cp -f uInitrd-${kernel_name} uInitrd && cp -f vmlinuz-${kernel_name} Image)
Expand All @@ -770,18 +770,18 @@ replace_kernel() {

# 02. For /boot/dtb/${PLATFORM}/*
[[ -d "${tag_bootfs}/dtb/${PLATFORM}" ]] || mkdir -p ${tag_bootfs}/dtb/${PLATFORM}
tar -xzf ${kernel_dtb} --touch -C ${tag_bootfs}/dtb/${PLATFORM}
tar -mxzf ${kernel_dtb} -C ${tag_bootfs}/dtb/${PLATFORM}
[[ "${PLATFORM}" == "rockchip" ]] && ln -sf dtb ${tag_bootfs}/dtb-${kernel_name}
[[ "$(ls ${tag_bootfs}/dtb/${PLATFORM} -l 2>/dev/null | grep "^-" | wc -l)" -ge "2" ]] || error_msg "/boot/dtb/${PLATFORM} files is missing."

# 03. For /usr/src/linux-headers-${kernel_name}
header_path="linux-headers-${kernel_name}"
rm -rf ${tag_rootfs}/usr/src/linux-headers-* 2>/dev/null && mkdir -p "${tag_rootfs}/usr/src/${header_path}"
tar -xzf ${kernel_header} --touch -C ${tag_rootfs}/usr/src/${header_path}
tar -mxzf ${kernel_header} -C ${tag_rootfs}/usr/src/${header_path}
[[ -d "${tag_rootfs}/usr/src/${header_path}/include" ]] || error_msg "/usr/src/${header_path}/include folder is missing."

# 04. For /usr/lib/modules/${kernel_name}
tar -xzf ${kernel_modules} --touch -C ${tag_rootfs}/usr/lib/modules
tar -mxzf ${kernel_modules} -C ${tag_rootfs}/usr/lib/modules
(cd ${tag_rootfs}/usr/lib/modules/${kernel_name}/ && rm -f build source 2>/dev/null && ln -sf /usr/src/${header_path} build)
[[ "$(ls ${tag_rootfs}/usr/lib/modules/${kernel_name} -l 2>/dev/null | grep "^d" | wc -l)" -eq "1" ]] || error_msg "/usr/lib/modules kernel folder is missing."
}
Expand Down

0 comments on commit 07e8527

Please sign in to comment.