Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mh-superbox committed Nov 23, 2022
1 parent 71df686 commit 55a440d
Show file tree
Hide file tree
Showing 18 changed files with 1,598 additions and 69 deletions.
1 change: 1 addition & 0 deletions buildroot/board/common/boot.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
printenv
4 changes: 4 additions & 0 deletions buildroot/board/common/boot.txt.save
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load mmc 0:1 ${kernel_addr_r} Image
setenv bootargs 8250.nr_uarts=1 root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA0,115200 loglevel=3 zram.enabled=1
printenv
booti ${kernel_addr_r} - ${fdt_addr}
12 changes: 12 additions & 0 deletions buildroot/board/common/busybox.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# CONFIG_KLOGD is not set
# CONFIG_FEATURE_KLOGD_KLOGCTL is not set
# CONFIG_SYSLOGD is not set
# CONFIG_FEATURE_ROTATE_LOGFILE is not set
# CONFIG_FEATURE_REMOTE_LOG is not set
# CONFIG_FEATURE_SYSLOGD_DUP is not set
# CONFIG_FEATURE_SYSLOGD_CFG is not set
# CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set
CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0
# CONFIG_FEATURE_IPC_SYSLOG is not set
CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
# CONFIG_FEATURE_KMSG_SYSLOG is not set
1 change: 1 addition & 0 deletions buildroot/board/common/cmdline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA0,115200 loglevel=3 zram.enabled=1
17 changes: 8 additions & 9 deletions buildroot/board/common/config.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
start_file=start.elf
fixup_file=fixup.dat

kernel=Image
# Load U-Boot instead of Linux
kernel=u-boot.bin
#kernel=Image

# Disable compensation for displays with overscan
disable_overscan=1

gpu_mem=100
# Enable 64-bit support
arm_64bit=1

dtoverlay=miniuart-bt
dtoverlay=krnbt=on
# Enable early debugging info
uart_2ndstage=1

# enable 64bits support
arm_64bit=1
3 changes: 3 additions & 0 deletions buildroot/board/common/extlinux.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
label buildroot
kernel /Image
append 8250.nr_uarts=1 root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA0,115200 loglevel=3 zram.enabled=1
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ image boot.vfat {
"bcm2710-rpi-3-b-plus.dtb",
"bcm2837-rpi-3-b.dtb",
"rpi-firmware/bootcode.bin",
"rpi-firmware/cmdline.txt",
"cmdline.txt",
"rpi-firmware/config.txt",
"rpi-firmware/fixup.dat",
"rpi-firmware/start.elf",
"rpi-firmware/overlays",
"Image"
"Image",
"extlinux",
"u-boot.bin",
"boot.scr",
"boot.txt"
}
}
size = 32M
Expand Down
1 change: 1 addition & 0 deletions buildroot/board/common/linux.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_IP_PNP_BOOTP=y
26 changes: 17 additions & 9 deletions buildroot/board/common/post-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,31 @@
set -u
set -e

mkdir -p ${TARGET_DIR}/boot
mkdir -p "${TARGET_DIR}/boot"

# Copy U-Boot extlinux config file
install -m 0644 -D "${BR2_EXTERNAL_UNIPI_PATH}/board/common/extlinux.conf" "${BINARIES_DIR}/extlinux/extlinux.conf"

# Copy U-Boot boot txt
install -m 0664 -D "${BR2_EXTERNAL_UNIPI_PATH}/board/common/boot.txt" "${BINARIES_DIR}/boot.txt"

# Copy cmdline.txt file
install -m 0644 -D "${BR2_EXTERNAL_UNIPI_PATH}/board/common/cmdline.txt" "${BINARIES_DIR}/cmdline.txt"

# Init systemd
mkdir -p ${TARGET_DIR}/etc/systemd/system/multi-user.target.wants
mkdir -p "${TARGET_DIR}/etc/systemd/system/multi-user.target.wants"

# Enable resize root systemd service
ln -fs ../resize-root.service ${TARGET_DIR}/etc/systemd/system/multi-user.target.wants/resize-root.service
ln -fs ../resize-root.service "${TARGET_DIR}/etc/systemd/system/multi-user.target.wants/resize-root.service"

# Enable monit systemd service
ln -fs ../resize-root.service ${TARGET_DIR}/etc/systemd/system/multi-user.target.wants/monit.service
ln -fs ../resize-root.service "${TARGET_DIR}/etc/systemd/system/multi-user.target.wants/monit.service"

# Update boot arguments
grep -qE ' loglevel=3' ${BINARIES_DIR}/rpi-firmware/cmdline.txt || sed -i '$ s/$/ loglevel=3/' ${BINARIES_DIR}/rpi-firmware/cmdline.txt
grep -qE ' zram.enabled=1' ${BINARIES_DIR}/rpi-firmware/cmdline.txt || sed -i '$ s/$/ zram.enabled=1/' ${BINARIES_DIR}/rpi-firmware/cmdline.txt
# Allow members of group whell to exectue any command
sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' "${TARGET_DIR}/etc/sudoers"

# Update Systemd Journald
sed -i 's/#Storage=auto/Storage=volatile/g' ${TARGET_DIR}/etc/systemd/journald.conf
sed -i 's/#Storage=auto/Storage=volatile/g' "${TARGET_DIR}/etc/systemd/journald.conf"

# Set ZSH for root user
sed -i '/^root:/s,:/bin/dash$,:/bin/zsh,' ${TARGET_DIR}/etc/passwd
sed -i '/^root:/s,:/bin/dash$,:/bin/zsh,' "${TARGET_DIR}/etc/passwd"
3 changes: 3 additions & 0 deletions buildroot/board/common/post-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

support/scripts/genimage.sh -c "${BR2_EXTERNAL_UNIPI_PATH}/board/common/genimage.cfg"
Empty file.

0 comments on commit 55a440d

Please sign in to comment.