Skip to content

Commit

Permalink
Reordering the package list to reduce packages installed with lpi4amain
Browse files Browse the repository at this point in the history
  • Loading branch information
nekorouter committed Mar 11, 2024
1 parent 09f8aab commit 640fad2
Showing 1 changed file with 39 additions and 20 deletions.
59 changes: 39 additions & 20 deletions mkrootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@ BOOT_MOUNTPOINT=""
ROOT_MOUNTPOINT=""

# == kernel variables ==
KERNEL_lpi4a="linux-headers-5.10.113-lpi4a linux-image-5.10.113-lpi4a linux-perf-thead"
KERNEL_ahead="linux-headers-5.10.113-ahead linux-image-5.10.113-ahead linux-perf-thead"
KERNEL_console="linux-headers-5.10.113-lpi4a linux-image-5.10.113-lpi4a linux-perf-thead"
KERNEL_lpi4amain="linux-headers-6.7.1-lpi4a linux-image-6.7.1-lpi4a th1520-mainline-opensbi"
KERNEL_lpi4a="linux-headers-5.10.113-lpi4a linux-image-5.10.113-lpi4a linux-perf-thead th1520-boot-firmware"
KERNEL_ahead="linux-headers-5.10.113-ahead linux-image-5.10.113-ahead linux-perf-thead th1520-boot-firmware"
KERNEL_console="linux-headers-5.10.113-lpi4a linux-image-5.10.113-lpi4a linux-perf-thead th1520-boot-firmware"
KERNEL_lpi4amain="linux-headers-6.7.1-lpi4a linux-image-6.7.1-lpi4a th1520-mainline-opensbi th1520-boot-firmware"
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 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"
PACKAGE_LIST=""
KEYRINGS="ca-certificates debian-ports-archive-keyring revyos-keyring"
GPU_DRIVER="thead-gles-addons"
BASE_TOOLS="locales 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 dosfstools parted exfatprogs systemd-sysv pkexec arch-install-scripts"
GRAPHIC_TOOLS="libgles2 mesa-vulkan-drivers glmark2-es2 mesa-utils vulkan-tools"
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 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"
BENCHMARK_TOOLS="glmark2-es2 mesa-utils vulkan-tools iperf3 stress-ng"
BENCHMARK_TOOLS="iperf3 stress-ng"
#FONTS="fonts-crosextra-caladea fonts-crosextra-carlito fonts-dejavu fonts-liberation fonts-liberation2 fonts-linuxlibertine fonts-noto-core fonts-noto-cjk fonts-noto-extra fonts-noto-mono fonts-noto-ui-core fonts-sil-gentium-basic"
FONTS="fonts-noto-core fonts-noto-cjk fonts-noto-mono fonts-noto-ui-core"
INCLUDE_APPS="chromium libqt5gui5-gles vlc gimp gimp-data-extras gimp-plugin-registry gimp-gmic"
Expand Down Expand Up @@ -77,17 +81,25 @@ pre_mkrootfs()

make_rootfs()
{
if [ "${BOARD}" == "lpi4amain" ]; then
PACKAGE_LIST="$KEYRINGS $GPU_DRIVER $BASE_TOOLS $EXTRA_TOOLS"
else
PACKAGE_LIST="$KEYRINGS $GPU_DRIVER $BASE_TOOLS $GRAPHIC_TOOLS $XFCE_DESKTOP $BENCHMARK_TOOLS $FONTS $INCLUDE_APPS $EXTRA_TOOLS $LIBREOFFICE"
fi

mmdebstrap --architectures=riscv64 \
--include="ca-certificates debian-ports-archive-keyring revyos-keyring thead-gles-addons th1520-boot-firmware locales dosfstools \
$BASE_TOOLS $XFCE_DESKTOP $BENCHMARK_TOOLS $FONTS $INCLUDE_APPS $EXTRA_TOOLS $LIBREOFFICE" \
--include="$PACKAGE_LIST" \
sid "$CHROOT_TARGET" \
"deb https://mirror.iscas.ac.cn/revyos/revyos-gles-21/ revyos-gles-21 main" \
"deb https://mirror.iscas.ac.cn/revyos/revyos-base/ sid main contrib non-free non-free-firmware" \
"deb https://mirror.iscas.ac.cn/revyos/revyos-kernels/ revyos-kernels main" \
"deb https://mirror.iscas.ac.cn/revyos/revyos-addons/ revyos-addons main"

# move /boot contents to other place
mv -v "$CHROOT_TARGET"/boot/* "$CHROOT_TARGET"/mnt/
if [ ! -z "$(ls -A "$CHROOT_TARGET"/boot/)" ]; then
mkdir "$CHROOT_TARGET"/mnt/boot
mv -v "$CHROOT_TARGET"/boot/* "$CHROOT_TARGET"/mnt/boot/
fi

# Mount chroot path
mount "$BOOT_IMG" "$CHROOT_TARGET"/boot
Expand All @@ -101,7 +113,10 @@ make_rootfs()
mount -t tmpfs tmpfs "$CHROOT_TARGET"/var/cache/apt/archives/

# move boot contents back to /boot
mv -v "$CHROOT_TARGET"/mnt/* "$CHROOT_TARGET"/boot/
if [ ! -z "$(ls -A "$CHROOT_TARGET"/mnt/boot/)" ]; then
mv -v "$CHROOT_TARGET"/mnt/boot/* "$CHROOT_TARGET"/boot/
rmdir "$CHROOT_TARGET"/mnt/boot
fi

# apt update
chroot "$CHROOT_TARGET" sh -c "apt update"
Expand Down Expand Up @@ -170,16 +185,18 @@ after_mkrootfs()

# Chromium add "--no-sandbox --use-gl=egl" flags
# replace "Exec=/usr/bin/chromium %U" to "Exec=/usr/bin/chromium --no-sandbox --use-gl=egl %U"
sed -i "s/Exec=\/usr\/bin\/chromium/Exec=\/usr\/bin\/chromium --no-sandbox --use-gl=egl/gi" "$CHROOT_TARGET"/usr/share/applications/chromium.desktop
if [ "${BOARD}" == "lpi4a" ] || [ "${BOARD}" == "console" ]; then
sed -i "s/Exec=\/usr\/bin\/chromium/Exec=\/usr\/bin\/chromium --no-sandbox --use-gl=egl/gi" "$CHROOT_TARGET"/usr/share/applications/chromium.desktop

# Temp add HDMI audio output on Volume control
echo "load-module module-alsa-sink device=hw:0,2 tsched=0" >> "$CHROOT_TARGET"/etc/pulse/default.pa
# Temp add HDMI audio output on Volume control
echo "load-module module-alsa-sink device=hw:0,2 tsched=0" >> "$CHROOT_TARGET"/etc/pulse/default.pa

# Change xfce4-panel default web-browser icon to chromium
sed -i 's/xfce4-web-browser.desktop/chromium.desktop/g' "$CHROOT_TARGET"/etc/xdg/xfce4/panel/default.xml
# Change xfce4-panel default web-browser icon to chromium
sed -i 's/xfce4-web-browser.desktop/chromium.desktop/g' "$CHROOT_TARGET"/etc/xdg/xfce4/panel/default.xml

# Fix cann't connect bluetooth headphone
sed -i 's/load-module module-bluetooth-policy/load-module module-bluetooth-policy auto_switch=false/g' "$CHROOT_TARGET"/etc/pulse/default.pa
# Fix cann't connect bluetooth headphone
sed -i 's/load-module module-bluetooth-policy/load-module module-bluetooth-policy auto_switch=false/g' "$CHROOT_TARGET"/etc/pulse/default.pa
fi

# Using on chip 2D accelerator for quicker window & menu drawing
if [ "${BOARD}" == "lpi4a" ] || [ "${BOARD}" == "ahead" ]; then
Expand Down Expand Up @@ -257,8 +274,10 @@ EOF

if [ "${BOARD}" == "lpi4amain" ]; then
echo "lpi4amain No GPU: Disable lightdm"
# lpi4a-main No GPU
chroot "$CHROOT_TARGET" sh -c "systemctl disable lightdm"
# lpi4a-main No GPU
if ( ! systemctl list-unit-files lightdm.service ); then
chroot "$CHROOT_TARGET" sh -c "systemctl disable lightdm"
fi
# Install perf-th1520 (new perf for c9xx pmu)
cp -rp addons/lpi4amain/perf-th1520 rootfs/bin
fi
Expand Down

0 comments on commit 640fad2

Please sign in to comment.