diff --git a/HACKING.md b/HACKING.md index 0da872d0..97a165e1 100644 --- a/HACKING.md +++ b/HACKING.md @@ -30,6 +30,7 @@ - ```ARCH``` uses kernel's naming, ```arm```, ```arm64``` etc. - ```ARCH_UNAME``` is what appears in uname -m, ```armv7l```, ```aarch64``` etc. - ```ARCH_DEB``` is whatever debian calls the architecture of device, ```armhf```, ```arm64``` +- ```ARCH_FED``` is what fedora calls the architecture of device, ```armhfp```, ```aarch64``` - YES ALL THIS ARCH STUFF IS A GIANT MESS - ```CROSS_COMPILE``` is self-explanatory - ```SOC``` - self explanatory diff --git a/README.md b/README.md index 7003ea5f..541e3e61 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ Once you have this out, continue with instructions: - Recent Linux distribution - Binfmt when Debian rootfs is used - ```debootstrap``` when Debian rootfs is used +- ```dnf``` when Fedora rootfs is used (add repos and GPG keys with ```fedora-repos``` and ```fedora-gpg-keys``` RPMs) - ```qemu-user-static``` when build machine can't run binaries for target machine - ```vboot-utils u-boot-tools``` (vbutil_kernel, cgpt and mkimage) to pack kernel into format understandable by depthcharge - ```gcc-aarch64-linux-gnu``` for compiling to ARM64 or ```gcc-arm-linux-gnueabihf``` for compiling to ARMv7 diff --git a/baseboard/gru/boardinfo b/baseboard/gru/boardinfo index 5bec526f..80fecd04 100644 --- a/baseboard/gru/boardinfo +++ b/baseboard/gru/boardinfo @@ -4,6 +4,7 @@ export ARCH=arm64 export ARCH_UNAME=aarch64 export ARCH_DEB=arm64 +export ARCH_FED=aarch64 export CROSS_COMPILE=aarch64-linux-gnu- export EMMC_OFFSET=0 diff --git a/baseboard/kukui/boardinfo b/baseboard/kukui/boardinfo index ceaf7a4d..9ebf34ca 100644 --- a/baseboard/kukui/boardinfo +++ b/baseboard/kukui/boardinfo @@ -4,6 +4,7 @@ export ARCH=arm64 export ARCH_UNAME=aarch64 export ARCH_DEB=arm64 +export ARCH_FED=aarch64 export CROSS_COMPILE=aarch64-linux-gnu- export EMMC_OFFSET=0 diff --git a/baseboard/lemote2f/boardinfo b/baseboard/lemote2f/boardinfo index f9f05049..c7ee5c78 100644 --- a/baseboard/lemote2f/boardinfo +++ b/baseboard/lemote2f/boardinfo @@ -4,6 +4,7 @@ export ARCH=mips export ARCH_UNAME=mips64el export ARCH_DEB=mips64el +export ARCH_FED=0 export CROSS_COMPILE=mips64el-linux-gnuabi64- export EMMC_OFFSET=0 diff --git a/baseboard/trogdor/boardinfo b/baseboard/trogdor/boardinfo index 4aa4da88..f2b225dd 100644 --- a/baseboard/trogdor/boardinfo +++ b/baseboard/trogdor/boardinfo @@ -4,6 +4,7 @@ export ARCH=arm64 export ARCH_UNAME=aarch64 export ARCH_DEB=arm64 +export ARCH_FED=aarch64 export CROSS_COMPILE=aarch64-linux-gnu- export EMMC_OFFSET=0 diff --git a/baseboard/veyron/boardinfo b/baseboard/veyron/boardinfo index 2c4bd69b..ac7f2327 100644 --- a/baseboard/veyron/boardinfo +++ b/baseboard/veyron/boardinfo @@ -4,6 +4,7 @@ export ARCH=arm export ARCH_UNAME=armv7l export ARCH_DEB=armhf +export ARCH_FED=armhfp export CROSS_COMPILE=arm-linux-gnueabihf- export EMMC_OFFSET=16384 diff --git a/config b/config index aa61216c..98d8039a 100644 --- a/config +++ b/config @@ -11,7 +11,7 @@ else fi # RootFS type -# One of: debian, void, void-musl, ubuntu +# One of: debian, fedora, void, void-musl, ubuntu ROOTFS=debian # FS type diff --git a/fs/build b/fs/build index 642cfe54..f6278867 100755 --- a/fs/build +++ b/fs/build @@ -83,6 +83,40 @@ case "$ROOTFS" in chroot root/ $qemu /bin/apt install -y vim network-manager debootstrap parted f2fs-tools libudev-dev build-essential git firmware-ath9k-htc kmscube weston [ $BOOTFW = depthcharge ] && chroot root/ $qemu /bin/apt install -y vboot-utils ;; + fedora) + echo "Installing Fedora Linux" + case "$ARCH_FED" in # TODO: option to choose Fedora release in config + armhfp) + IMAGE_URL="https://download.fedoraproject.org/pub/fedora/linux/releases/35/Spins/armhfp/images/Fedora-Minimal-35-1.2.armhfp.raw.xz" + ;; + aarch64) + IMAGE_URL="https://download.fedoraproject.org/pub/fedora-secondary/releases/35/Spins/aarch64/images/Fedora-Minimal-35-1.2.aarch64.raw.xz" + ;; + 0) + echo "Fedora is not supported for $SOC devices" + return 1 + esac + if [ ! -f "fedora-$ARCH_FED.rootfs" ]; then + wget $IMAGE_URL -O fedora-$ARCH_FED.raw.xz + xz -vd fedora-$ARCH_FED.raw.xz + IMAGE_LOOP=$(losetup -f -P fedora-$ARCH_FED.raw --show) + dd if=${IMAGE_LOOP}p3 of=fedora-$ARCH_FED.rootfs + losetup -d $IMAGE_LOOP + fi + # rootfs is 3rd partiton of raw image + mkdir -p fedorarootfsimg + mount fedora-$ARCH_FED.rootfs fedorarootfsimg/ + rsync -aHAX fedorarootfsimg/* $CADMIUMROOT/tmp/root + for x in {1..3}; do sed -i '$d' root/etc/fstab; sleep 1; done # remove / , /boot, /boot/efi from fstab + cp fedora-$ARCH_FED.rootfs root/fedora-$ARCH_FED.rootfs + # disable inital-setup and unlock root account + unlink root/etc/systemd/system/graphical.target.wants/initial-setup.service + unlink root/etc/systemd/system/multi-user.target.wants/initial-setup.service + chroot root/ $qemu /bin/passwd -f -u root + # FIXME: installing NetworkManager-tui breaks wifi?? use nmcli in the meantime + dnf install -y --installroot=$CADMIUMROOT/tmp/root/ --forcearch=aarch64 --releasever=35 vboot-utils parted f2fs-tools make git rsync + umount fedorarootfsimg/ + ;; # let's explain this: when void is set, $V is set to -v, so it does 'grep -v musl', printing link without musl # when $V is not set, grep is 'grep musl', printing only link with musl void) @@ -113,7 +147,7 @@ case "$ROOTFS" in esac # remove root password, this is install medium so it's ok, not needed in ubports -[ ! "$ROOTFS" = "ubports" ] && chroot root/ $qemu /bin/passwd -d root +[ ! "$ROOTFS" = "ubports" ] && chroot root/ $qemu /bin/passwd -f -d root # workaround bad touchpad experience on certain boards mkdir -p $CADMIUMROOT/tmp/root/etc/libinput diff --git a/fs/fedora/install-to-emmc-middle b/fs/fedora/install-to-emmc-middle new file mode 100644 index 00000000..72faef60 --- /dev/null +++ b/fs/fedora/install-to-emmc-middle @@ -0,0 +1,16 @@ +# start of install-to-emmc-middle + +export SYSTEMD=1 +export EUDEV=0 +export SKIP_CD_USER_SETUP=1 + +mkdir -p fedorarootfsimg +mount /fedora-$ARCH_FED.rootfs fedorarootfsimg/ + +rsync -aHAX fedorarootfsimg/* /mnt/ +for x in {1..3}; do sed -i '$d' /mnt/etc/fstab; sleep 1; done # remove / , /boot, /boot/efi from fstab + +umount fedorarootfsimg +rm -rf fedorarootfsimg + +# end of install-to-emmc-middle diff --git a/fs/install-to-emmc-begin b/fs/install-to-emmc-begin index d49b8f94..c909b27d 100755 --- a/fs/install-to-emmc-begin +++ b/fs/install-to-emmc-begin @@ -18,9 +18,12 @@ if [ "$BASEBOARD" = "trogdor" ]; then fi # we need internet, TODO: make this run on voidlinux +# FIXME: installing NetworkManager-tui breaks wifi on the Fedora installer nmcli device wifi rescan -sleep 4 # wait for it to show up -nmtui connect +nmcli device wifi list +read -p "Enter SSID: "; SSID=$REPLY +read -p "Enter password: "; WIFI_PASS=$REPLY +nmcli device wifi connect $SSID password $WIFI_PASS # a fancy hack MMCDEV=$(ls /dev/mmcblk* | grep -F boot0 | sed 's/boot0//') @@ -106,13 +109,6 @@ fi mount $ROOTPART /mnt -mkdir -p /mnt/lib/firmware/ -cp -r /lib/firmware/* /mnt/lib/firmware/ - -# copy modules over -mkdir -p /mnt/lib/modules/$(uname -r)/ -cp -r /lib/modules/$(uname -r)/* /mnt/lib/modules/$(uname -r)/ - # copy kernel from usb pendrive/hdd to internal emmc dd if=/dev/zero of=$KERNPART >/dev/null 2>&1 || true diff --git a/fs/install-to-emmc-end b/fs/install-to-emmc-end index 2945f8b9..a97e9dde 100755 --- a/fs/install-to-emmc-end +++ b/fs/install-to-emmc-end @@ -2,20 +2,32 @@ mount proc /mnt/proc -t proc # just in case something((gdm)) wants it -echo "Enter root password:" -until chroot /mnt passwd; do +if [ ! "$SKIP_CD_USER_SETUP" = "1" ]; then + + echo "Enter root password:" -done + until chroot /mnt passwd; do + echo "Enter root password:" + done -read -p "Enter username, no spaces or big letters: " -chroot /mnt useradd -G sudo,video,audio,render -s /bin/bash -m $REPLY + read -p "Enter username, no spaces or big letters: " + chroot /mnt useradd -G sudo,video,audio,render -s /bin/bash -m $REPLY -echo "Enter user password:" -until chroot /mnt passwd $REPLY; do echo "Enter user password:" -done + until chroot /mnt passwd $REPLY; do + echo "Enter user password:" + done + + export USERNAME=$REPLY + +fi + +mkdir -p /mnt/lib/firmware/ +cp -r /lib/firmware/* /mnt/lib/firmware/ -export USERNAME=$REPLY +# copy modules over +mkdir -p /mnt/lib/modules/$(uname -r)/ +cp -r /lib/modules/$(uname -r)/* /mnt/lib/modules/$(uname -r)/ # default libinput config for touchpad is bad # let's override it @@ -42,12 +54,12 @@ fi cp -r /CdFiles /mnt/CdFiles if [ $BASEBOARD = trogdor ]; then - chroot /mnt make -C /CdFiles/qmic clean - chroot /mnt make -C /CdFiles/qrtr clean - chroot /mnt make -C /CdFiles/rmtfs clean - chroot /mnt make -C /CdFiles/qmic prefix=/usr install - chroot /mnt make -C /CdFiles/qrtr prefix=/usr install - chroot /mnt make -C /CdFiles/rmtfs prefix=/usr install + make -C /mnt/CdFiles/qmic clean + make -C /mnt/CdFiles/qrtr clean + make -C /mnt/CdFiles/rmtfs clean + make -C /CdFiles/qmic prefix=/mnt/usr install + make -C /CdFiles/qrtr prefix=/mnt/usr install + make -C /CdFiles/rmtfs prefix=/mnt/usr install chroot /mnt systemctl enable rmtfs fi @@ -62,6 +74,7 @@ export INST_EMMC=1 source ~/ui/install # copy over ucm files +mkdir -p /mnt/usr/share/alsa/ucm2/ cp -r /ucm/* /mnt/usr/share/alsa/ucm2/