Commit 99f57585 authored by mntmn's avatar mntmn
Browse files

Merge branch 'sysimage-v2' into 'main'

MNT Reform System Image v2

See merge request !25
parents 38965a37 a000b28e
Pipeline #311 passed with stage
in 55 minutes and 2 seconds
# Gitlab CI file to generate the system image .img file.
#image: debian:bullseye-slim
image: source.mnt.re:5050/reform/build-base-image-docker:latest
image: debian:bullseye-slim
build:
script:
- sed -i 's|http://deb.|http://ftp.de.|g' /etc/apt/sources.list
- apt update
- apt-get -y install sudo gzip libext2fs2 pigz
- apt-get -y install bc parted multistrap udisks2 gcc-aarch64-linux-gnu make device-tree-compiler qemu-user-static binfmt-support build-essential bison flex libssl-dev bash git
- cd reform2-imx8mq/
- apt-get -y install bc parted multistrap udisks2 gcc-aarch64-linux-gnu make device-tree-compiler qemu-user-static binfmt-support build-essential bison flex libssl-dev bash git qemu-system-aarch64
- cd reform2-imx8mq
- bash mkimage.sh
- pigz reform-system.img
- pigz reform-rescue-system.img
artifacts:
paths:
- "reform2-imx8mq/linux/arch/arm64/boot/Image"
- "reform2-imx8mq/linux/arch/arm64/boot/dts/freescale/imx8mq-mnt-reform2.dtb"
- "reform2-imx8mq/linux/arch/arm64/boot/dts/freescale/imx8mq-mnt-reform2-hdmi.dtb"
- "reform2-imx8mq/u-boot/flash.bin"
- "reform2-imx8mq/u-boot/flash-rescue.bin"
- "reform2-imx8mq/reform-system.img.gz"
- "reform2-imx8mq/reform-rescue-system.img.gz"
......@@ -4,20 +4,12 @@ set -x
set -e
export ARCH=arm64
#export LOADADDR=0x40480000
export CROSS_COMPILE=aarch64-linux-gnu-
if [ ! -d linux ]
then
echo "Cloning Linux..."
mkdir linux
cd linux
git init
git remote add origin https://github.com/torvalds/linux.git
# temporary linux 5.11rc7 commit
git fetch --depth 1 origin e0756cfc7d7cd08c98a53b6009c091a3f6a50be6
git checkout FETCH_HEAD
cd ..
git clone --depth 1 --branch v5.12 https://github.com/torvalds/linux.git
fi
cp ./template-kernel/*.dts ./linux/arch/arm64/boot/dts/freescale/
......@@ -25,6 +17,10 @@ cp ./template-kernel/kernel-config ./linux/.config
cd linux
echo "== kernel config =="
cat .config
echo "== end kernel config =="
for PATCHFILE in ../template-kernel/patches/*.patch
do
echo PATCH: $PATCHFILE
......
......@@ -6,7 +6,7 @@ set -e
if [ ! -d u-boot ]
then
echo "Cloning U-Boot..."
git clone --depth 1 https://source.mntmn.com/MNT/reform-boundary-uboot.git u-boot
git clone --depth 1 https://source.mnt.re/reform/reform-boundary-uboot.git u-boot
fi
cd u-boot
......
#!/bin/bash
set -e
set -x
ETC=./template-etc
SKEL=./template-skel
mmdebstrap --architectures=arm64 --components=main --variant="minbase" sid target-userland http://ftp.de.debian.org/debian
mmdebstrap --architectures=arm64 --components=main --variant="minbase" --include="apt apt-utils gnupg ca-certificates 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 brightness-udev usbutils pciutils fbset netcat-traditional nfacct traceroute wpasupplicant htop ncdu ntpdate ntp screen tmux telnet lm-sensors rfkill dosfstools e2fsprogs dialog rsync busybox pulseaudio sway grim slurp xwayland xterm xfce4-terminal rofi arc-theme thunar policykit-1 libblockdev-dm2 libblockdev-crypto2 gnome-disk-utility cryptsetup openjdk-11-jre-headless 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 pavucontrol python3-psutil ircii elinks 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" sid target-userland http://ftp.de.debian.org/debian
# install kernel
cp linux/arch/arm64/boot/Image target-userland/
......@@ -36,7 +37,6 @@ mkdir -p target-userland/etc/skel/Videos
# populate /etc
cp $ETC/ld.so.conf target-userland/etc # or our libraries won't be picked up
cp $ETC/resolv.conf target-userland/etc
mkdir -p target-userland/etc/dhcp
cp $ETC/dhclient.conf target-userland/etc/dhcp
cp $ETC/motd-rescue target-userland/etc/motd # we start with the rescue system
......@@ -48,9 +48,8 @@ cp $ETC/reform-* target-userland/etc
# copy pulse config files that will be moved inside the target fs later
cp $ETC/pulse/* target-userland/
# mesa etc. patches
# custom built libraries
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
......@@ -59,23 +58,18 @@ export LC_ALL=C
export LANGUAGE=C
export LANG=C
set -x
set -e
echo "root:root" | chpasswd
passwd -d root # remove root password
# 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 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 brightness-udev usbutils pciutils fbset netcat-traditional nfacct traceroute wpasupplicant htop ncdu ntpdate ntp screen tmux telnet lm-sensors rfkill dosfstools e2fsprogs
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/default/locale
# add MNT Research/Reform apt repository
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 376511EB67AD7BAF
......@@ -86,8 +80,6 @@ apt update
# install essential MNT Reform system management scripts and docs
apt install -y reform-tools reform-handbook
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 ircii
# move pulse config in place
# FIXME: this is brittle and should go into a .deb
mv /analog-input-reform.conf /usr/share/pulseaudio/alsa-mixer/paths/
......@@ -97,11 +89,7 @@ mv /default.conf /usr/share/pulseaudio/alsa-mixer/profile-sets/
mv /etc/reform-hw-setup.service /etc/systemd/system/
systemctl enable reform-hw-setup.service
# 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 (apparmor slows down boot)
apt remove -y ofono foot apparmor
# disable built-in sleep targets in favor of reform-standby script
......
......@@ -5,77 +5,71 @@ export LC_ALL=C
export LANGUAGE=C
export LANG=C
set -e
set -x
cd /root
mkdir -p src
cd src
git clone --depth 1 https://gitlab.freedesktop.org/mesa/drm.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 --depth 1 --branch libdrm-2.4.106 https://gitlab.freedesktop.org/mesa/drm.git
# there's no tag yet for 21.1.3 which will probably include all patches we need
# so fetch the most recent commit at the time of putting this script together.
mkdir -p mesa
cd mesa
git init
git remote add origin https://gitlab.freedesktop.org/mesa/mesa.git
git fetch origin 2ebf4e984b51825c37562e0221bde327188e3eaf
git reset --hard FETCH_HEAD
cd ..
mkdir -p xserver
cd xserver
git init
git remote add origin https://gitlab.freedesktop.org/xorg/xserver.git
git fetch origin f3eb1684fa5008ad7c881f798a5efb7441b23035
git reset --hard FETCH_HEAD
cd ..
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
git clone --depth 1 https://github.com/Hjdskes/cage.git
git clone --depth 1 --branch 0.9.7 https://github.com/Alexays/Waybar.git
git clone --depth 1 --branch v0.4.0 https://github.com/any1/wayvnc.git
git clone --depth 1 --branch v0.1.3 https://github.com/Hjdskes/cage.git
cd drm
meson build -Detnaviv=true -Dradeon=false -Damdgpu=false -Dvmwgfx=false -Dfreedreno=false -Dvc4=false -Dnouveau=false
ninja -C build install
cd ..
rm -rf drm
ldconfig
cd mesa
meson build -Dplatforms=x11,wayland -Ddri3=true -Dgallium-drivers=swrast,etnaviv,kmsro,virgl -Dgbm=enabled -Degl=enabled -Dbuildtype=release -Db_ndebug=true
# patch that disables broken MSAA in etnaviv (not yet upstreamed for some reason)
patch -p1 <<ENDPATCH
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -445,6 +445,10 @@ etna_screen_is_format_supported(struct pipe_screen *pscreen,
struct etna_screen *screen = etna_screen(pscreen);
unsigned allowed = 0;
+ /* HACK to disable all MSAA, as is causes GPU crashes */
+ if (sample_count > 1)
+ return false;
+
if (!gpu_supports_texture_target(screen, target))
return false;
ENDPATCH
# apply other mesa patches
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 ..
rm -rf mesa
ldconfig
cd wlroots
git checkout 0.12.0
git checkout 0.13.0
meson build
ninja -C build install
cd ..
rm -rf wlroots
ldconfig
cd sway
git checkout 1.5.1
git checkout 1.6
meson build
ninja -C build install
chmod +s /usr/local/bin/sway
cd ..
rm -rf sway
cd xserver
......@@ -100,6 +94,7 @@ ENDPATCH
meson build -Dxorg=true -Dxwayland=true -Dglamor=true -Dxwayland_eglstream=false -Dxnest=false -Ddmx=false -Dxvfb=true -Dxwin=false -Dxephyr=false -Ddri3=true
ninja -C build install
cd ..
rm -rf xserver
# overwrite /usr/bin/Xwayland with symlink to our Xwayland (FIXME: brittle)
......@@ -110,6 +105,7 @@ cd Waybar
meson build
ninja -C build install
cd ..
rm -rf Waybar
cd wayvnc
mkdir subprojects
......@@ -120,10 +116,12 @@ cd ..
meson build
ninja -C build install
cd ..
rm -rf wayvnc
cd cage
meson build
ninja -C build install
cd ..
rm -rf cage
EOF
......@@ -18,6 +18,9 @@ export LC_ALL=C
export LANGUAGE=C
export LANG=C
set -x
set -e
# install applications
apt install -y libreoffice libreoffice-gtk3 inkscape firefox-esr emacs gimp wmaker x11-utils
......@@ -25,7 +28,7 @@ apt install -y chromium evolution freecad ardour sxiv neverball scummvm dosbox w
# install patched software from mntre
apt install -y kicad minetest libjsoncpp1 blender=2.79b+mntreform-2
apt install -y kicad=5.1.9+dfsg1-1.1 minetest libjsoncpp1 blender=2.79b+mntreform-2
# install a minimal gnome3
......
#!/bin/bash
irc -c '#reform' -p 6697 reform$RANDOM SSLIRC/irc.freenode.org
Package: reform-tools
Version: 1.0-6
Version: 1.0-7
Section: base
Priority: required
Architecture: arm64
......
......@@ -5,8 +5,10 @@ echo "MNT Reform: reform-init checking boot media..."
/bin/mount -t proc /proc /proc
BOOTPREF=$(cat /reform-boot-medium) # Read config file from reform-boot-config script
BOOTPART="/dev/mmcblk1p1" # SD card
# Read config file generated by reform-boot-config script
BOOTPREF=$(cat /reform-boot-medium)
# Default to SD card
BOOTPART="/dev/mmcblk1p1"
if [ "x$BOOTPREF" == "x" ]
then
......@@ -14,32 +16,31 @@ then
BOOTPREF="sd"
fi
echo "Your boot preference is: '$BOOTPREF'"
echo "Your boot preference is: \"$BOOTPREF\""
# Check config
if [ "$BOOTPREF" == "usb" ]; then
echo "Booting from USB storage device, after 3sec."
sleep 3
echo "Booting from USB storage in 3 seconds."
BOOTPART="/dev/sda1"
elif [ "$BOOTPREF" == "nvme" ]; then
echo "Booting from NVMe SSD."
BOOTPART="/dev/nvme0n1p1"
else
# Default. Boot from SD card (already mounted by kernel).
echo "Booting from SD card."
echo "Booting from SD card (or eMMC)."
exec /sbin/init
fi
# Check if partition exists
if [ ! -e $BOOTPART ]; then
echo "Partition '$BOOTPART' not found. Falling back to SD card."
echo "Partition \"$BOOTPART\" not found. Falling back to SD card."
read -r -p "Press ENTER to continue."
exec /sbin/init
fi
# Check if partition is encrypted
if blkid | grep "$BOOTPART" | grep "crypto_LUKS"; then
echo "Attempting to mount encrypted partition '$BOOTPART'."
echo "Attempting to mount encrypted partition \"$BOOTPART\"."
while :
do
/sbin/cryptsetup luksOpen "$BOOTPART" cryptroot && break
......@@ -48,7 +49,7 @@ if blkid | grep "$BOOTPART" | grep "crypto_LUKS"; then
fi
# Mount
echo "Trying to boot from partition '$BOOTPART'."
echo "Trying to boot from partition \"$BOOTPART\"."
if ! /bin/mount "$BOOTPART" "/mnt"; then
echo "Could not mount '$BOOTPART'. Falling back to SD card."
read -r -p "Press ENTER to continue."
......@@ -63,8 +64,7 @@ if [ ! -e /mnt/sbin/init ]; then
exec /sbin/init
fi
# move root mount over to encrypted drive
# Move root mount over to encrypted drive
cd /mnt || exit 9
mount --move . /
exec chroot . /sbin/init
#!/bin/bash
irc -c '#mnt-reform' -p 6697 reform$RANDOM SSLIRC/irc.libera.chat
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment