debian: 尝试支持 256M 内存安装

This commit is contained in:
bin456789 2024-03-31 01:07:33 +08:00
parent ffa7b63d93
commit f53f45b41f
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
2 changed files with 39 additions and 3 deletions

View File

@ -107,7 +107,7 @@ d-i partman/early_command string \
anna-install fdisk-udeb; \
cp $postinst $postinst.orig; \
echo "fallocate -l 256M $swapfile; mkswap $swapfile; swapon $swapfile; $postinst.orig" >$postinst; \
echo "fallocate -l 384M $swapfile; mkswap $swapfile; swapon $swapfile; $postinst.orig" >$postinst; \
echo "swapoff $swapfile; rm $swapfile" >/usr/lib/finish-install.d/95swapoff; \
chmod a+x /usr/lib/finish-install.d/95swapoff; \

View File

@ -835,8 +835,7 @@ check_ram() {
ram_standard=$(
case "$distro" in
netboot.xyz) echo 0 ;;
alpine | dd) echo 256 ;; # 192 无法启动 netboot
debian) echo 384 ;;
alpine | debian | dd) echo 256 ;;
arch | gentoo | windows) echo 512 ;;
centos | alma | rocky | fedora | ubuntu) echo 1024 ;;
opensuse) echo max ;; # 没有安装模式
@ -1504,6 +1503,9 @@ EOF
sed "s|@mac_addr|$mac_addr|" |
sed "s|@netconf|$netconf|" >var/lib/dpkg/info/netcfg.postinst
# 将 use_level 2 9 修改为 use_level 1
sed -i 's/use_level=[29]/use_level=1/' lib/debian-installer-startup.d/S15lowmem
# hack 3
# 修改 trans.sh
# 1. 直接调用 create_ifupdown_config
@ -1663,6 +1665,40 @@ mod_initrd() {
mod_initrd_$nextos_distro
# 删除 initrd 里面没用的文件/驱动
if is_virt && ! is_alpine_live; then
rm -rf bin/brltty
rm -rf etc/brltty
rm -rf sbin/wpa_supplicant
rm -rf usr/lib/libasound.so.*
(
cd lib/modules/*/kernel/drivers/net/ethernet/
for item in *; do
case "$item" in
intel | amazon | google) ;;
*) rm -rf $item ;;
esac
done
)
(
cd lib/modules/*/kernel
for item in \
drivers/mmc \
drivers/net/bonding \
drivers/net/usb \
drivers/net/wireless \
drivers/pcmcia \
drivers/staging \
drivers/usb/serial \
drivers/usb/storage \
net/bluetooth \
net/mac80211 \
net/wireless; do
rm -rf $item
done
)
fi
# 重建
# 注意要用 cpio -H newc 不要用 cpio -c ,不同版本的 -c 作用不一样,很坑
# -c Use the old portable (ASCII) archive format