Skip to content

Commit

Permalink
Reduce rootfs size
Browse files Browse the repository at this point in the history
Update kernel to 6.10.2
  • Loading branch information
KyonLi committed Jul 29, 2024
1 parent fcabb8f commit 17981d8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Prepare
run: |
sudo apt-get -y update
sudo apt-get -y install debootstrap binfmt-support qemu-user-static android-sdk-libsparse-utils mkbootimg
sudo apt-get -y install debootstrap binfmt-support qemu-user-static android-sdk-libsparse-utils
- name: Checkout
uses: actions/checkout@v4
Expand Down
Empty file added kernel/.gitkeep
Empty file.
48 changes: 0 additions & 48 deletions kernel/build-boot-img.sh

This file was deleted.

30 changes: 15 additions & 15 deletions rootfs/build.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
#/bin/bash

DIST=bookworm
K_IMAGE_URL="https://github.com/KyonLi/ufi003-kernel/releases/download/6.10.0-1/Image.gz"
K_IMAGE_DEB_URL="https://github.com/KyonLi/ufi003-kernel/releases/download/6.10.0-1/linux-image-6.10.0-gb7e4049f0eb1_6.10.0-gb7e4049f0eb1-1_arm64.deb"
K_HEADERS_DEB_URL="https://github.com/KyonLi/ufi003-kernel/releases/download/6.10.0-1/linux-headers-6.10.0-gb7e4049f0eb1_6.10.0-gb7e4049f0eb1-1_arm64.deb"
BOOT_URL="https://github.com/KyonLi/ufi003-kernel/releases/download/6.10.2-1/boot.img"
BOOT_NO_MODEM_URL="https://github.com/KyonLi/ufi003-kernel/releases/download/6.10.2-1/boot-no-modem.img"
BOOT_NO_MODEM_OC_URL="https://github.com/KyonLi/ufi003-kernel/releases/download/6.10.2-1/boot-no-modem-oc.img"
K_IMAGE_DEB_URL="https://github.com/KyonLi/ufi003-kernel/releases/download/6.10.2-1/linux-image-6.10.2-g8ffeadb57e59_6.10.2-g8ffeadb57e59-1_arm64.deb"
K_DEV_URL="https://github.com/KyonLi/ufi003-kernel/releases/tag/6.10.2-1"
UUID=62ae670d-01b7-4c7d-8e72-60bcd00410b7

if [ `id -u` -ne 0 ]
then echo "Please run as root"
exit
fi

wget -P ../kernel "$K_IMAGE_URL"
rm -rf ../kernel/* > /dev/null 2>&1
wget -P ../kernel "$BOOT_URL"
wget -P ../kernel "$BOOT_NO_MODEM_URL"
wget -P ../kernel "$BOOT_NO_MODEM_OC_URL"
wget -P ../kernel "$K_IMAGE_DEB_URL"
wget -P ../kernel "$K_HEADERS_DEB_URL"

mkdir debian build
debootstrap --arch=arm64 --foreign $DIST debian https://deb.debian.org/debian/
LANG=C LANGUAGE=C LC_ALL=C chroot debian /debootstrap/debootstrap --second-stage
cp ../deb-pkgs/*.deb ../kernel/*.deb chroot.sh debian/tmp/
cp ../deb-pkgs/*.deb ../kernel/linux-image-*.deb chroot.sh debian/tmp/
mv ../kernel/linux-image-*.deb debian/tmp/
mount --bind /proc debian/proc
mount --bind /dev debian/dev
mount --bind /dev/pts debian/dev/pts
mount --bind /sys debian/sys
LANG=C LANGUAGE=C LC_ALL=C chroot debian /tmp/chroot.sh
mv debian/tmp/info.md ./
rm -rf debian/tmp/* debian/root/.bash_history > /dev/null 2>&1
cp debian/etc/debian_version ./
cp debian/boot/initrd.img* ../kernel/initrd.img
cp debian/usr/lib/linux-image*/qcom/*ufi003*.dtb ../kernel/
umount debian/proc
umount debian/dev/pts
umount debian/dev
umount debian/sys
cp debian/etc/debian_version ./
mv debian/tmp/info.md ./
echo -e "\n🔗 [linux-headers & linux-libc-dev]($K_DEV_URL)" >> info.md
rm -rf debian/tmp/* debian/root/.bash_history > /dev/null 2>&1

echo -e "\n\nNow you can make additional modifications to rootfs.\nPress ENTER to continue"
head -n 1 >/dev/null
Expand All @@ -45,7 +49,3 @@ rsync -aH debian/ build/
umount build
img2simg debian-ufi003.img rootfs.img
rm -rf debian-ufi003.img debian build > /dev/null 2>&1

cd ../kernel
./build-boot-img.sh
rm -rf initrd.img *.dtb *.deb Image.gz > /dev/null 2>&1
12 changes: 6 additions & 6 deletions rootfs/chroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ PARTUUID=$PARTUUID / ext4 defaults,noatime,commit=600,errors=remount-ro 0 1
tmpfs /tmp tmpfs defaults,nosuid 0 0
EOF

apt update
apt full-upgrade -y
apt install -y locales network-manager initramfs-tools openssh-server chrony fake-hwclock zram-tools rmtfs qrtr-tools
apt install -y /tmp/*.deb
apt-get update
apt-get full-upgrade -y
apt-get install -y locales network-manager openssh-server chrony fake-hwclock zram-tools rmtfs qrtr-tools
apt-get install -y /tmp/*.deb
sed -i -e "s/# $LANG_TARGET UTF-8/$LANG_TARGET UTF-8/" /etc/locale.gen
dpkg-reconfigure --frontend=noninteractive locales
update-locale LANG=$LANG_TARGET LC_ALL=$LANG_TARGET LANGUAGE=$LANG_TARGET
Expand All @@ -40,9 +40,9 @@ sed -i 's/^.\?PermitRootLogin.*$/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/^.\?ALGO=.*$/ALGO=lzo-rle/g' /etc/default/zramswap
sed -i 's/^.\?PERCENT=.*$/PERCENT=300/g' /etc/default/zramswap

initrd_name=$(basename /boot/initrd.img*)
vmlinuz_name=$(basename /boot/vmlinuz-*)
cat <<EOF > /tmp/info.md
- 内核版本${initrd_name#*-}
- 内核版本: ${vmlinuz_name#*-}
- 默认用户名: root
- 默认密码: $PASSWORD
- WiFi名称: openstick-failsafe
Expand Down

0 comments on commit 17981d8

Please sign in to comment.