Skip to content
Snippets Groups Projects
Commit 19fe8fd4 authored by minute's avatar minute
Browse files

new userland scripts

parent f5f0cd69
No related branches found
No related tags found
1 merge request!12RC1 of MNT Reform System Image and Rescue Image
#!/bin/bash
set -e
ETC=./template-etc
SKEL=./template-skel
mmdebstrap --architectures=arm64 --variant="minbase" sid target-userland http://ftp.de.debian.org/debian
mmdebstrap --architectures=arm64 --components=main --variant="minbase" bullseye target-userland http://ftp.de.debian.org/debian
# install kernel
cp linux/arch/arm64/boot/Image target-userland/
# FIXME
cp linux/arch/arm64/boot/dts/freescale/imx8mq-mnt-reform2.dtb target-userland/imx8mq-mnt-reform2-lcdif.dtb
# install DTBs
cp linux/arch/arm64/boot/dts/freescale/imx8mq-mnt-reform2.dtb target-userland/imx8mq-mnt-reform2-single-display.dtb
cp linux/arch/arm64/boot/dts/freescale/imx8mq-mnt-reform2-hdmi.dtb target-userland/imx8mq-mnt-reform2-dual-display.dtb
cp linux/arch/arm64/boot/dts/freescale/imx8mq-mnt-reform2-hdmi.dtb target-userland/imx8mq-mnt-reform2.dtb
# default audio settings, or PCM will be muted
mkdir -p target-userland/var/lib/alsa
cp $ETC/asound.state target-userland/var/lib/alsa/
# install boot loader script
cp $ETC/reform-init target-userland/sbin/reform-init
# populate root user and skel
cp -RavT $SKEL target-userland/root/
cp -RavT $SKEL target-userland/etc/skel/
......@@ -28,6 +34,10 @@ cp $ETC/motd* target-userland/etc
cp $ETC/reform* target-userland/etc
cp $ETC/hostname target-userland/etc
# mesa etc. patches
mkdir -p target-userland/root/src
cp -Rv template-userland/patches-mesa target-userland/root/src/patches-mesa
chroot target-userland /bin/bash <<EOF
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
......@@ -37,30 +47,53 @@ export LANG=C
echo "root:root" | chpasswd
# mount /proc if it doesn't exist
if [[ ! -e /proc/version ]]; then
mount -t proc none /proc
fi
ln --force --symbolic /usr/share/zoneinfo/Europe/Berlin /etc/localtime
echo "locales locales/default_environment_locale select en_US.UTF-8" | debconf-set-selections
echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | debconf-set-selections
dpkg --configure -a
apt update
apt install -y apt apt-utils gnupg ca-certificates
apt install -y bsdmainutils init-system-helpers cron netbase iproute2 ifupdown isc-dhcp-client iptables iputils-ping locales less net-tools curl wget nano micro vim coreutils parted file git sudo console-setup console-data unicode-data kbd gpm systemd libpam-systemd systemd-sysv ca-certificates bash-completion ncurses-term alsa-utils brightnessctl usbutils pciutils apt-utils
apt install -y --no-install-recommends sway grim slurp xwayland xterm xfce4-terminal rofi arc-theme thunar policykit-1
# install build dependencies
apt install -y --no-install-recommends zlib1g-dev patch expat bison flex libunwind-dev libwayland-dev wayland-protocols libwayland-egl-backend-dev libx11-dev libx11-xcb-dev libxdamage-dev libxfixes-dev libxcb-dri3-dev libxcb-xfixes0-dev libxcb-sync-dev libxrandr-dev libxext-dev libxcb-glx0-dev libxcb-present-dev libxcb-dri2-0-dev gettext autopoint libpixman-1-dev libbsd-dev libxkbfile-dev libxcb-composite0-dev libxcb-xinput-dev libxcb-icccm4-dev libxfont-dev nettle-dev libdbus-1-dev libsystemd-dev libpciaccess-dev llvm-dev libudev-dev libmtdev-dev libevdev-dev libxshmfence-dev xutils-dev libdrm-dev libxxf86vm-dev meson gcc g++ python3-setuptools python3-mako xfonts-utils libepoxy-dev libjson-c-dev libpcre3-dev libpango1.0-dev libxkbcommon-dev libinput-dev autoconf make libtool intltool libxml2-dev libxfce4ui-2-dev libgarcon-1-dev xfce4-dev-tools libdbusmenu-gtk3-dev libfmt-dev libgirepository1.0-dev libgtkmm-3.0-dev libjsoncpp-dev libmpdclient-dev libnl-3-dev libnl-genl-3-dev libpulse-dev libsigc++-2.0-dev libspdlog-dev
apt install -y cpio bsdmainutils init-system-helpers procps gpgv debian-archive-keyring readline-common cron netbase iproute2 ifupdown isc-dhcp-client iptables iputils-ping locales less net-tools curl wget nano micro vim coreutils parted file git sudo console-setup console-data unicode-data kbd gpm systemd libpam-systemd systemd-sysv bash-completion ncurses-term alsa-utils brightnessctl usbutils pciutils fbset netcat-traditional nfacct traceroute wpasupplicant htop ncdu ntpdate ntp screen tmux telnet lm-sensors rfkill
# disable built-in sleep targets in favor of reform-standby script
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
# disable apparmor (it slows down boot and spews messages)
systemctl disable apparmor
# add MNT Research/Reform apt repository
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 376511EB67AD7BAF
cat >>/etc/apt/sources.list <<IEOF
deb https://mntre.com/reform-debian sid/
IEOF
echo "deb https://mntre.com/reform-debian sid/" >>/etc/apt/sources.list
apt update
apt install -y sway grim slurp xwayland xterm xfce4-terminal rofi arc-theme thunar policykit-1 libblockdev-dm2 libblockdev-crypto2 gnome-disk-utility cryptsetup gnome-system-monitor eog evince mpv gedit engrampa connman-gtk gnome-icon-theme breeze-icon-theme fonts-noto-color-emoji lxpolkit mesa-utils w3m man-db pulseaudio pavucontrol python3-psutil
# install applications
apt install -y libreoffice libreoffice-gtk3 inkscape firefox-esr emacs gimp
apt install -y chromium evolution freecad ardour sxiv neverball scummvm dosbox wf-recorder wev linphone-desktop
# install patched software from mntre
apt install -y kicad minetest libjsoncpp1 blender=2.79b+mntreform
# install a minimal gnome3
apt install -y --no-install-recommends gnome-control-center gnome-session
# install build dependencies
apt install -y zlib1g-dev patch expat bison flex libunwind-dev libwayland-dev wayland-protocols libwayland-egl-backend-dev libx11-dev libx11-xcb-dev libxdamage-dev libxfixes-dev libxcb-dri3-dev libxcb-xfixes0-dev libxcb-sync-dev libxrandr-dev libxext-dev libxcb-glx0-dev libxcb-present-dev libxcb-dri2-0-dev gettext autopoint libpixman-1-dev libbsd-dev libxkbfile-dev libxcb-composite0-dev libxcb-xinput-dev libxcb-icccm4-dev libxfont-dev nettle-dev libdbus-1-dev libsystemd-dev libpciaccess-dev llvm-dev libudev-dev libmtdev-dev libevdev-dev libxshmfence-dev xutils-dev libdrm-dev libxxf86vm-dev meson gcc g++ python3-setuptools python3-mako xfonts-utils libepoxy-dev libjson-c-dev libpcre3-dev libpango1.0-dev libxkbcommon-dev libinput-dev autoconf make libtool intltool libxml2-dev libxfce4ui-2-dev libgarcon-1-dev xfce4-dev-tools libdbusmenu-gtk3-dev libfmt-dev libgirepository1.0-dev libgtkmm-3.0-dev libjsoncpp-dev libmpdclient-dev libnl-3-dev libnl-genl-3-dev libpulse-dev libsigc++-2.0-dev libspdlog-dev libsdl2-gfx-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev libsdl2-dev libsdl2-image-dev libflac-dev libmpg123-dev libpng-dev libmpeg2-4-dev
# remove some unnecessary stuff
apt remove -y ofono foot
# disable built-in sleep targets in favor of reform-standby script
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
EOF
......@@ -10,11 +10,13 @@ mkdir -p src
cd src
git clone --depth 1 https://gitlab.freedesktop.org/mesa/drm.git
git clone --depth 1 https://gitlab.freedesktop.org/mesa/mesa.git
git clone --depth 1 https://github.com/swaywm/wlroots.git
git clone --depth 1 https://github.com/swaywm/sway.git
git clone --depth 1 --branch mesa-20.3.4 https://gitlab.freedesktop.org/mesa/mesa.git
git clone --depth 1 https://github.com/wayland-project/wayland.git
git clone https://github.com/swaywm/wlroots.git
git clone https://github.com/swaywm/sway.git
git clone --depth 1 https://gitlab.freedesktop.org/xorg/xserver.git
git clone --depth 1 https://github.com/Alexays/Waybar.git
git clone --depth 1 https://github.com/any1/wayvnc.git
cd drm
meson build -Detnaviv=true -Dradeon=false -Damdgpu=false -Dvmwgfx=false -Dfreedreno=false -Dvc4=false -Dnouveau=false
......@@ -43,17 +45,24 @@ patch -p1 <<ENDPATCH
ENDPATCH
# apply other mesa patches
for p in ../patches-mesa/*.patch
do
patch -p1 <<$p
end
patch -p1 <../patches-mesa/7603.patch
patch -p1 <../patches-mesa/8618.patch
patch -p1 <../patches-mesa/9214.patch
ninja -C build install
cd ..
ldconfig
cd wayland
meson build -Ddocumentation=false
ninja -C build install
cd ..
ldconfig
cd wlroots
git checkout 0.12.0
meson build
ninja -C build install
cd ..
......@@ -61,6 +70,7 @@ cd ..
ldconfig
cd sway
git checkout 1.5.1
meson build
ninja -C build install
chmod +s /usr/local/bin/sway
......@@ -95,4 +105,14 @@ meson build
ninja -C build install
cd ..
cd wayvnc
mkdir subprojects
cd subprojects
git clone https://github.com/any1/neatvnc.git
git clone https://github.com/any1/aml.git
cd ..
meson build
ninja -C build install
cd ..
EOF
                     [?25h[?1;5;2004lWelcome to Debian GNU/Linux
on the MNT Reform 2.0
on MNT Reform
https://mntre.com/reform
https://www.debian.org
......
#!/bin/busybox sh
echo "MNT Reform: reform-init checking boot media..."
/bin/mount -t proc /proc /proc
BOOTPREF=$(cat /reform-boot-medium)
if [ "x$BOOTPREF" == "x" ]
then
echo "Defaulting to SD card."
BOOTPREF="sd"
fi
echo "Your boot preference is: $BOOTPREF"
# Boot from SD card (already mounted by kernel)
if [ "$BOOTPREF" == "sd" ]
then
echo "Booting from SD card."
exec /sbin/init
fi
# Boot from USB (/dev/sda1)
if [ "$BOOTPREF" == "usb" ]
then
echo "Trying to boot from USB storage (/dev/sda1)."
/bin/mount /dev/sda1 /mnt
if [ "$?" != "0" ]
then
echo "Could not mount /dev/sda1. Falling back to SD card."
sleep 1
exec /sbin/init
fi
if [ ! -e /mnt/sbin/init ]
then
echo "No /sbin/init found on mounted disk. Falling back to SD card."
umount /mnt
sleep 1
exec /sbin/init
fi
cd /mnt
mount --move . /
exec chroot . /sbin/init
fi
# The remaining option is NVMe.
# In the future, this could check multiple partitions.
NVMEPART=/dev/nvme0n1p1
if [ ! -e $NVMEPART ]
then
echo "NVMe not found. Falling back to SD card."
sleep 1
exec /sbin/init
fi
blkid | grep $NVMEPART | grep crypto_LUKS
LUKS=$?
if $LUKS
then
sleep 1
clear
# try to mount encrypted NVMe SSD
while :
do
/sbin/cryptsetup --allow-discards --persistent luksOpen $NVMEPART cryptroot && break
done
/bin/mount /dev/mapper/cryptroot /mnt
else
echo "Attempting to mount unencrypted NVMe."
/bin/mount $NVMEPART /mnt
fi
if [ ! -e /mnt/sbin/init ]
then
echo "No /sbin/init found on mounted disk. Falling back to SD card."
umount /mnt
sleep 1
exec /sbin/init
fi
# move root mount over to encrypted drive
cd /mnt
mount --move . /
exec chroot . /sbin/init
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment