mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Compare commits
3 Commits
v25.08
...
tweak-kern
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
809b8cda9f | ||
|
|
ad81c77110 | ||
|
|
1c9ec236bd |
@@ -274,21 +274,14 @@ function kernel_package_callback_linux_image() {
|
||||
test -d ${debian_kernel_hook_dir}/${script}.d && run-parts --arg="${kernel_version_family}" --arg="/${installed_image_path}" ${debian_kernel_hook_dir}/${script}.d
|
||||
KERNEL_HOOK_DELEGATION
|
||||
|
||||
if [[ "${script}" == "preinst" ]]; then
|
||||
cat <<- HOOK_FOR_REMOVE_VFAT_BOOT_FILES
|
||||
if is_boot_dev_vfat; then
|
||||
rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/$image_name /boot/uImage
|
||||
fi
|
||||
HOOK_FOR_REMOVE_VFAT_BOOT_FILES
|
||||
fi
|
||||
|
||||
# @TODO: only if u-boot, only for postinst. Gotta find a hook scheme for these...
|
||||
if [[ "${script}" == "postinst" ]]; then
|
||||
cat <<- HOOK_FOR_LINK_TO_LAST_INSTALLED_KERNEL # image_name="${NAME_KERNEL}", above
|
||||
touch /boot/.next
|
||||
if is_boot_dev_vfat; then
|
||||
echo "Armbian: FAT32 /boot: move last-installed kernel to '$image_name'..."
|
||||
mv -v /${installed_image_path} /boot/${image_name}
|
||||
echo "Armbian: FAT32 /boot: copy last-installed kernel to '$image_name'..."
|
||||
cp -vf "/${installed_image_path}" "/boot/${image_name}.new"
|
||||
mv -vf "/boot/${image_name}.new" "/boot/${image_name}"
|
||||
else
|
||||
echo "Armbian: update last-installed kernel symlink to '$image_name'..."
|
||||
ln -sfv $(basename "${installed_image_path}") /boot/$image_name
|
||||
@@ -346,8 +339,10 @@ function kernel_package_callback_linux_dtb() {
|
||||
echo "Armbian: DTB: symlinking /boot/dtb to /boot/dtb-${kernel_version_family}..."
|
||||
ln -sfTv "dtb-${kernel_version_family}" dtb
|
||||
else
|
||||
echo "Armbian: DTB: FAT32: moving /boot/dtb-${kernel_version_family} to /boot/dtb ..."
|
||||
mv -v "dtb-${kernel_version_family}" dtb
|
||||
echo "Armbian: DTB: FAT32: copying /boot/dtb-${kernel_version_family} to /boot/dtb ..."
|
||||
rm -rf "dtb.new"
|
||||
cp -r "dtb-${kernel_version_family}" "dtb.new"
|
||||
mv "dtb.new" "dtb"
|
||||
fi
|
||||
EOT
|
||||
)
|
||||
|
||||
@@ -8,8 +8,9 @@ mkimage -A $INITRD_ARCH -O linux -T ramdisk -C gzip -n uInitrd -d $2 $tempname
|
||||
|
||||
echo "update-initramfs: Armbian: Symlinking ${tempname} to /boot/uInitrd" >&2
|
||||
ln -sfv $(basename $tempname) /boot/uInitrd || {
|
||||
echo "update-initramfs: Symlink failed, moving ${tempname} to /boot/uInitrd" >&2
|
||||
mv -v $tempname /boot/uInitrd
|
||||
echo "update-initramfs: Symlink failed, copying ${tempname} to /boot/uInitrd" >&2
|
||||
cp -vf "$tempname" "/boot/uInitrd.new"
|
||||
mv -vf "/boot/uInitrd.new" "/boot/uInitrd"
|
||||
}
|
||||
|
||||
echo "update-initramfs: Armbian: done." >&2
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
# echo "DEBUG: postinst: initramfs-clean: cmd: $@" >&2
|
||||
# avoid running multiple times
|
||||
# This script should be run after the initramfs-tools script
|
||||
# and under the same conditions.
|
||||
if [ -n "$DEB_MAINT_PARAMS" ]; then
|
||||
eval set -- "$DEB_MAINT_PARAMS"
|
||||
if [ -z "$1" ] || [ "$1" != "configure" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
files="$(find /boot -maxdepth 1 -name 'initrd.img-*' -o -name 'uInitrd-*')"
|
||||
|
||||
for f in $files; do
|
||||
if [ ! -d /lib/modules/"${f#*-}" ]; then
|
||||
echo "Remove unused generated file: $f"; rm $f
|
||||
fi
|
||||
done
|
||||
|
||||
check_boot_dev (){
|
||||
available_size_boot_device=$(findmnt --noheadings --output AVAIL --target /boot)
|
||||
echo "Free space after deleting the package $DPKG_MAINTSCRIPT_PACKAGE in /boot: $available_size_boot_device" >&2
|
||||
}
|
||||
mountpoint -q /boot && check_boot_dev
|
||||
|
||||
exit 0
|
||||
20
packages/bsp/common/etc/kernel/postrm.d/initramfs-remove-uInitrd
Executable file
20
packages/bsp/common/etc/kernel/postrm.d/initramfs-remove-uInitrd
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Remove /boot/uInitrd-${version} created by /etc/initramfs/post-update.d/99-uboot
|
||||
# Unfortunately, `update-initramfs` only support `post-update.d`, doesn't have something like `post-delete.d`
|
||||
# So let's clean it when we remove a kernel.
|
||||
|
||||
version="$1"
|
||||
|
||||
# avoid running multiple times
|
||||
# Use the same conditions as `initramfs-tools`.
|
||||
if [ -n "$DEB_MAINT_PARAMS" ]; then
|
||||
eval set -- "$DEB_MAINT_PARAMS"
|
||||
if [ -z "$1" ] || [ "$1" != "remove" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f "/boot/uInitrd-${version}"
|
||||
|
||||
exit 0
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
# echo "DEBUG: POSTRM: initramfs-clean: cmd: $@" >&2
|
||||
# avoid running multiple times
|
||||
# This script should be run after the initramfs-tools script
|
||||
# and under the same conditions.
|
||||
if [ -n "$DEB_MAINT_PARAMS" ]; then
|
||||
eval set -- "$DEB_MAINT_PARAMS"
|
||||
if [ -z "$1" ] || [ "$1" != "remove" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
files="$(find /boot -maxdepth 1 -name 'initrd.img-*' -o -name 'uInitrd-*')"
|
||||
|
||||
for f in $files; do
|
||||
if [ ! -d /lib/modules/"${f#*-}" ]; then
|
||||
echo "Remove unused generated file: $f"; rm $f
|
||||
fi
|
||||
done
|
||||
|
||||
check_boot_dev (){
|
||||
available_size_boot_device=$(findmnt --noheadings --output AVAIL --target /boot)
|
||||
echo "Free space after deleting the package $DPKG_MAINTSCRIPT_PACKAGE in /boot: $available_size_boot_device" >&2
|
||||
}
|
||||
mountpoint -q /boot && check_boot_dev
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user