From c2d6ac72615de452fbc62cbda41cd7feca0d0711 Mon Sep 17 00:00:00 2001 From: "Lukas F. Hartmann" <lukas@mntre.com> Date: Wed, 24 Feb 2021 11:29:58 +0100 Subject: [PATCH] WIP mmdebstrap experiment --- reform2-imx8mq/mkimage.sh | 18 +++++---- reform2-imx8mq/mkuserland-new.sh | 66 ++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 7 deletions(-) create mode 100755 reform2-imx8mq/mkuserland-new.sh diff --git a/reform2-imx8mq/mkimage.sh b/reform2-imx8mq/mkimage.sh index dd563dc..97f85b4 100755 --- a/reform2-imx8mq/mkimage.sh +++ b/reform2-imx8mq/mkimage.sh @@ -5,20 +5,25 @@ set -e # make sure build tools are installed # tested with bare Ubuntu 20.04 server -sudo apt-get -y install parted multistrap udisks2 gcc-aarch64-linux-gnu make device-tree-compiler qemu-user-static binfmt-support build-essential bison flex libssl-dev +sudo apt-get -y install parted multistrap udisks2 gcc-aarch64-linux-gnu make device-tree-compiler qemu-user-static binfmt-support build-essential bison flex libssl-dev mmdebstrap # build the linux kernel -./mkkernel.sh +#./mkkernel.sh # build u-boot -./mkuboot.sh +#./mkuboot.sh # build the debian userland and configure it -sudo ./mkuserland.sh +#sudo ./mkuserland.sh # chroot into the userland and build custom packages (mesa, xserver...) -sudo ./mkuserland2.sh +#sudo ./mkuserland2.sh + +sudo ./mkuserland-new.sh + +#SIZE=8188M +SIZE=2048M # create ext4 partition from target root directory directly at 4MiB offset, 8192MiB (8GiB) image size -sudo /sbin/mke2fs -v -L 'MNTREFORM' -N 0 -O 64bit -E offset=4194304 -d target-userland -m 5 -r 1 -t ext4 reform-system.img 8188M +sudo /sbin/mke2fs -v -L 'MNTREFORM' -N 0 -O 64bit -E offset=4194304 -d target-userland -m 5 -r 1 -t ext4 reform-system.img $SIZE sudo /sbin/parted -s reform-system.img "mklabel msdos" sudo /sbin/parted -s reform-system.img "mkpart primary ext4 4MiB -1s" @@ -29,4 +34,3 @@ sudo /sbin/parted -s reform-system.img print sudo dd if=./u-boot/flash.bin of=reform-system.img conv=notrunc bs=1k seek=33 echo Reform system image created: reform-system.img - diff --git a/reform2-imx8mq/mkuserland-new.sh b/reform2-imx8mq/mkuserland-new.sh new file mode 100755 index 0000000..7f29ccd --- /dev/null +++ b/reform2-imx8mq/mkuserland-new.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +ETC=./template-etc +SKEL=./template-skel + +mmdebstrap --architectures=arm64 --variant="minbase" sid 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 +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/ + +# populate root user and skel +cp -RavT $SKEL target-userland/root/ +cp -RavT $SKEL target-userland/etc/skel/ + +# 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* target-userland/etc +cp $ETC/reform* target-userland/etc +cp $ETC/hostname target-userland/etc + +chroot target-userland /bin/bash <<EOF +export DEBIAN_FRONTEND=noninteractive +export DEBCONF_NONINTERACTIVE_SEEN=true +export LC_ALL=C +export LANGUAGE=C +export LANG=C + +echo "root:root" | chpasswd + +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 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 + +# disable built-in sleep targets in favor of reform-standby script +systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target + +# 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 + +apt update + +EOF -- GitLab