Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) RPi support #223

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions conf/turnkey.d/arm.d/rpi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash -e

systemctl enable rpi-reconfigure-raspi-firmware.service

cp /usr/lib/linux-image-*-arm64/broadcom/bcm*rpi*.dtb /boot/firmware/

sed -i 's/root=/console=ttyS1,115200 root=/' /boot/firmware/cmdline.txt
sed -i 's#root=/dev/mmcblk0p2#root=LABEL=RASPIROOT#' /boot/firmware/cmdline.txt
sed -i 's/^#ROOTPART=.*/ROOTPART=LABEL=RASPIROOT/' /etc/default/raspi*-firmware

sed -i 's/cma=64M //' /boot/firmware/cmdline.txt

File renamed without changes.
2 changes: 1 addition & 1 deletion mk/turnkey.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ RELEASE ?= debian/$(shell lsb_release -s -c)
CDROOT ?= gfxboot-turnkey
HOSTNAME ?= $(shell basename "$(shell pwd)")

CONF_VARS += HOSTNAME ROOT_PASS NONFREE PHP_VERSION TKL_TESTING BACKPORTS
CONF_VARS += HOSTNAME ROOT_PASS NONFREE PHP_VERSION TKL_TESTING BACKPORTS ARCH_FAMILY
CONF_VARS += WEBMIN_THEME WEBMIN_FW_TCP_INCOMING WEBMIN_FW_TCP_INCOMING_REJECT WEBMIN_FW_UDP_INCOMING WEBMIN_FW_NAT_EXTRA WEBMIN_FW_MANGLE_EXTRA
# these are needed to control styling of credits (e.g., conf/apache-credit)
CONF_VARS += CREDIT_STYLE CREDIT_STYLE_EXTRA CREDIT_ANCHORTEXT CREDIT_LOCATION
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Reconfigure raspi-firmware to regenerate config.txt matching actual hardware
Before=sysinit.target
DefaultDependencies=no
RequiresMountsFor=/boot/firmware

[Service]
Type=oneshot
TimeoutSec=infinity
ExecStart=/usr/sbin/dpkg-reconfigure raspi-firmware
ExecStart=/bin/systemctl --no-reload disable %n

[Install]
RequiredBy=sysinit.target
4 changes: 4 additions & 0 deletions overlays/turnkey.d/arm.d/fstab/etc/fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# The root file system has fs_passno=1 as per fstab(5) for automatic fsck.
LABEL=RASPIROOT / ext4 rw 0 1
# All other file systems have fs_passno=2 as per fstab(5) for automatic fsck.
LABEL=RASPIFIRM /boot/firmware vfat rw 0 2
17 changes: 17 additions & 0 deletions overlays/turnkey.d/arm.d/interfaces/etc/network/interfaces
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# UNCONFIGURED INTERFACES
# remove the above line if you edit this file

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

allow-hotplug eth1
iface eth1 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid my-network-ssid
wpa-psk s3kr3t_P4ss

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
set -e

#
# List the soft prerequisites here. This is a space separated list of
# names, of scripts that are in the same directory as this one, that
# must be run before this one can be.
#
PREREQS=""
case $1 in
prereqs) echo "$PREREQS"; exit 0;;
esac

. /usr/share/initramfs-tools/hook-functions

# XXX: tail and realpath are included by default, right?
#copy_exec /usr/bin/realpath
#copy_exec /usr/bin/tail
copy_exec /sbin/blkid
copy_exec /bin/lsblk
copy_exec /sbin/parted
copy_exec /sbin/partprobe
copy_exec /sbin/resize2fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/sh
set -e

#
# List the soft prerequisites here. This is a space separated list of
# names, of scripts that are in the same directory as this one, that
# must be run before this one can be.
#
PREREQS=""
case $1 in
prereqs) echo "$PREREQS"; exit 0;;
esac

. /scripts/functions

# Given the root partition, get the underlying device and partition number
rootpart=$(realpath $ROOT)
rootpart_nr=$(blkid -sPART_ENTRY_NUMBER -o value -p $rootpart)
rootdev="/dev/$(lsblk -no pkname "$rootpart")"

# Parted will detect if the GPT label is messed up and fix it
# automatically, we just need to tell it to do so.
parted -s $rootdev print 2>&1 | grep -z "fix the GPT" && {
echo "Fix" | parted ---pretend-input-tty $rootdev print
}

# Check if there's free space at the end of the device
free_space="$(parted -m -s $rootdev print free | tail -n1 | grep free)"
if test -z "$free_space"; then
# Great, we already resized; nothing left to do!
exit 0
fi

log_begin_msg "$0 resizing $ROOT"

# Unmount for safety
umount "${rootmnt}"

# Expand the partition size to fill the entire device
parted -s $rootdev resizepart $rootpart_nr 100%

wait_for_udev 5

# Now resize the filesystem
partprobe $rootdev
resize2fs $rootpart

# Remount root
if ! mount -r ${FSTYPE:+-t "${FSTYPE}"} ${ROOTFLAGS} "${ROOT}" "${rootmnt?}"; then
panic "Failed to mount ${ROOT} as root file system."
fi

log_end_msg
10 changes: 9 additions & 1 deletion plans/boot
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ systemd /* even in CHROOT_ONLY we need systemctl to configure systemd se

#ifndef CHROOT_ONLY

#ifndef ARM64
syslinux /* Collection of bootloaders */
syslinux-common /* Collection of bootloaders (common) */
isolinux /* Collection of bootloaders (ISO 9960) */
hdparm /* Tune hard disk parameters for high performance */
live-boot /* live-boot replaces casper in v16.x */
live-tools /* live tools provides additional tools for live booting */
live-boot-initramfs-tools
#endif

hdparm /* Tune hard disk parameters for high performance */
initramfs-tools
firmware-linux-free
busybox
parted

#ifdef UBUNTU
upstart
Expand All @@ -33,6 +37,10 @@ linux-image-686-pae
#ifdef AMD64
linux-image-amd64
#endif
#ifdef ARM64
linux-image-arm64
raspi-firmware
#endif
#endif
#endif

Expand Down
7 changes: 6 additions & 1 deletion plans/turnkey/base
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#include <boot>
#include <net>
#include <console>
#ifdef ARM64
#include <wifi>
#endif

wget
curl
rsync

#ifndef ARM64
di-live
#endif

whiptail /* di-live recommends */
kbd /* di-live recommends */
lvm2 /* di-live recommends */
Expand All @@ -15,7 +21,6 @@ eject /* di-live recommends */

confconsole
kbd /* confconsole recommends */
di-live /* confconsole recommends */
resolvconf /* confconsole recommends */

/* jiiterentropy-rngd provides entropy from cpu jitter; req'd in buster to */
Expand Down
4 changes: 4 additions & 0 deletions plans/wifi
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
wireless-tools # Tools for manipulating Linux Wireless Extensions
wpasupplicant # Client support for WPA and WPA2 (IEEE 802.11i)

#ifdef ARM64
firmware-brcm80211
#endif

#endif