Skip to content

Commit

Permalink
Enable gomuks auto-launch on boot
Browse files Browse the repository at this point in the history
  • Loading branch information
IronOxidizer committed May 5, 2023
1 parent 4bbc352 commit a8ba691
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 630 deletions.
417 changes: 21 additions & 396 deletions beepberry_os/bcm2708-rpi-zero-w/br_defconfig

Large diffs are not rendered by default.

23 changes: 6 additions & 17 deletions beepberry_os/bcm2708-rpi-zero-w/build-image.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
#!/bin/sh

# Use -N to skip downloads, use -L to skip downloads and clean recompile kernel
if [ "$#" -eq 0 ] || [ "$1" != "-N" ] && [ "$1" != "-L" ]; then
curl https://buildroot.org/downloads/buildroot-2023.02.tar.xz | tar xJ
mv buildroot* build
wget -N https://github.com/raspberrypi/firmware/raw/master/boot/bcm2708-rpi-zero-w.dtb -P build/output/images/
wget -N https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin -P build/output/images/
wget -N https://github.com/raspberrypi/firmware/raw/master/boot/start_cd.elf -P build/output/images/
wget -N https://github.com/raspberrypi/firmware/raw/master/boot/fixup_cd.dat -P build/output/images/
fi

ccache make -j $(nproc) -C build defconfig BR2_DEFCONFIG=../br_defconfig && \
if [ "$#" -eq 0 ] || [ "$1" != "-L" ]; then
ccache make -j $(nproc) -C build linux-dirclean
fi
ccache make -j $(nproc) -C build && \
yes | mv -f build/output/images/sdcard.img . && \
echo "Image built at $(pwd)/sdcard.img"
curl https://buildroot.org/downloads/buildroot-2023.02.tar.xz | tar xJ
mv buildroot-* build

make -j $(nproc) -C build defconfig BR2_DEFCONFIG=../br_defconfig && \
make -j $(nproc) -C build && \
yes | mv -f build/output/images/sdcard.img . && \
echo "Image built at $(pwd)/sdcard.img"
2 changes: 1 addition & 1 deletion beepberry_os/bcm2708-rpi-zero-w/cmdline.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
root=/dev/mmcblk0p2 rootflags=fastboot rootwait console=tty1 console=ttyAMA0,115200
root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA0,115200
4 changes: 2 additions & 2 deletions beepberry_os/bcm2708-rpi-zero-w/config.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# can probably remove this line
# This is required for the cutdown firmware
gpu_mem=16

start_file=start_cd.elf
fixup_file=fixup_cd.dat
kernel=zImage
kernel=zImage
53 changes: 23 additions & 30 deletions beepberry_os/bcm2708-rpi-zero-w/genimage.cfg
Original file line number Diff line number Diff line change
@@ -1,37 +1,30 @@
image boot.vfat {
vfat {
# Set to fat 16 for improved performance
# Set cluster size to 512 and sectors per cluster to 1 for a smaller minimum partition
extraargs = "-s 1 -S 512 -F 16"
vfat {
files = {
"bcm2708-rpi-zero-w.dtb",
"rpi-firmware/bootcode.bin",
"rpi-firmware/cmdline.txt",
"../../../config.txt",
"rpi-firmware/fixup_cd.dat",
"rpi-firmware/start_cd.elf",
"zImage"
}
}

files = {
"bcm2708-rpi-zero-w.dtb",
"bootcode.bin",
"../../../cmdline.txt",
"../../../config.txt",
"fixup_cd.dat",
"start_cd.elf",
"zImage"
}
}

size = 8M
size = 8M
}

image sdcard.img {
hdimage {}

partition boot {
# 0xE is FAT16B
partition-type = 0xE
bootable = "true"
image = "boot.vfat"
}

partition rootfs {
partition-type = 0x83
image = "rootfs.f2fs"
}
}
hdimage {}

partition boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}

partition rootfs {
partition-type = 0x83
image = "rootfs.ext4"
}
}
181 changes: 0 additions & 181 deletions beepberry_os/bcm2708-rpi-zero-w/linux_defconfig

This file was deleted.

10 changes: 8 additions & 2 deletions beepberry_os/bcm2708-rpi-zero-w/post-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
set -u
set -e

# Add a console on tty1
# Add an autologin console on tty1
if [ -e ${TARGET_DIR}/etc/inittab ]; then
grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \
sed -i '/GENERIC_SERIAL/a\
tty1::respawn:/sbin/getty -L tty1 0 vt100 # HDMI console' ${TARGET_DIR}/etc/inittab
tty1::respawn:-/bin/sh' ${TARGET_DIR}/etc/inittab
fi

# Auto launch gomuks on login on tty1
echo '
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
gomuks -s
fi' >> ${TARGET_DIR}/etc/profile
7 changes: 6 additions & 1 deletion beepberry_os/bcm2708-rpi-zero-w/post-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ set -e
GENIMAGE_CFG="../genimage.cfg"
GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"

# Pass an empty rootpath. genimage makes a full copy of the given rootpath to
# ${GENIMAGE_TMP}/root so passing TARGET_DIR would be a waste of time and disk
# space. We don't rely on genimage to build the rootfs image, just to insert a
# pre-built one in the disk image.

trap 'rm -rf "${ROOTPATH_TMP}"' EXIT
ROOTPATH_TMP="$(mktemp -d)"

Expand All @@ -17,4 +22,4 @@ genimage \
--outputpath "${BINARIES_DIR}" \
--config "${GENIMAGE_CFG}"

exit $?
exit $?
Binary file not shown.

0 comments on commit a8ba691

Please sign in to comment.