Skip to content

Commit

Permalink
Add swap, using PARTUUID for fstab
Browse files Browse the repository at this point in the history
  • Loading branch information
nekorouter authored and RevySR committed Feb 2, 2024
1 parent 5019405 commit 09f8aab
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
29 changes: 24 additions & 5 deletions addons/opt/firstboot.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
#!/bin/bash
#!/bin/sh

# whiptail --infobox "Resizing filesystem..." 20 60

# use all emmc free space for rootfs
parted -s /dev/mmcblk0 "resizepart 3 -0"
# resize root filesystem
parted -s /dev/mmcblk0 "resizepart 4 -0"

# refresh filesystem usable size
resize2fs /dev/mmcblk0p2
resize2fs /dev/mmcblk0p3
resize2fs /dev/mmcblk0p4

# whiptail --infobox "Enable SWAP partition..." 20 60

# formatand enable swap partition
mkswap /dev/mmcblk0p3
swapon -a

# regenerate fstab
genfstab -t PARTUUID / > /etc/fstab
update-initramfs -u

# whiptail --infobox "Generating SSH Host keys..." 20 60

# regenerate openssh host keys
dpkg-reconfigure openssh-server
dpkg-reconfigure openssh-server

# whiptail --infobox "Firstboot Done. Rebooting in 3 seconds..." 20 60
# sleep 3
# reboot
4 changes: 2 additions & 2 deletions mkrootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ KERNEL_console="linux-headers-5.10.113-lpi4a linux-image-5.10.113-lpi4a linux-pe
KERNEL_lpi4amain="linux-headers-6.7.1-lpi4a linux-image-6.7.1-lpi4a th1520-mainline-opensbi"
KERNEL=$(eval echo '$'"KERNEL_${BOARD}")

BASE_TOOLS="binutils file tree sudo bash-completion u-boot-menu initramfs-tools openssh-server network-manager dnsmasq-base libpam-systemd ppp wireless-regdb wpasupplicant libengine-pkcs11-openssl iptables systemd-timesyncd vim usbutils libgles2 parted exfatprogs systemd-sysv mesa-vulkan-drivers pkexec"
BASE_TOOLS="binutils file tree sudo bash-completion u-boot-menu initramfs-tools openssh-server network-manager dnsmasq-base libpam-systemd ppp wireless-regdb wpasupplicant libengine-pkcs11-openssl iptables systemd-timesyncd vim usbutils libgles2 parted exfatprogs systemd-sysv mesa-vulkan-drivers pkexec arch-install-scripts"
XFCE_DESKTOP="xorg xserver-xorg-video-thead xinput xfce4 desktop-base lightdm xfce4-terminal tango-icon-theme xfce4-notifyd xfce4-power-manager network-manager-gnome xfce4-goodies pulseaudio pulseaudio-module-bluetooth alsa-utils dbus-user-session rtkit pavucontrol thunar-volman eject gvfs gvfs-backends udisks2 dosfstools e2fsprogs libblockdev-crypto2 ntfs-3g polkitd blueman xarchiver"
GNOME_DESKTOP="gnome-core avahi-daemon desktop-base file-roller gnome-tweaks gstreamer1.0-libav gstreamer1.0-plugins-ugly libgsf-bin libproxy1-plugin-networkmanager network-manager-gnome"
KDE_DESKTOP="kde-plasma-desktop"
Expand Down Expand Up @@ -121,7 +121,7 @@ make_bootable()
chroot "$CHROOT_TARGET" sh -c "echo 'U_BOOT_PARAMETERS=\"console=ttyS0,115200 rootwait rw earlycon clk_ignore_unused loglevel=7 eth=$ethaddr rootrwoptions=rw,noatime rootrwreset=yes\"' >> /etc/default/u-boot"
fi
chroot "$CHROOT_TARGET" sh -c "echo 'U_BOOT_FDT_DIR=\"/dtbs/linux-image-\"' >> /etc/default/u-boot"
chroot "$CHROOT_TARGET" sh -c "echo 'U_BOOT_ROOT=\"root=/dev/mmcblk0p3\"' >> /etc/default/u-boot"
chroot "$CHROOT_TARGET" sh -c "echo 'U_BOOT_ROOT=\"root=PARTUUID=80a5a8e9-c744-491a-93c1-4f4194fd690a\"' >> /etc/default/u-boot"

# Update extlinux config
chroot "$CHROOT_TARGET" sh -c "u-boot-update"
Expand Down

0 comments on commit 09f8aab

Please sign in to comment.