diff options
| author | Sébastien Dailly <sebastien@dailly.me> | 2026-05-30 09:58:45 +0200 |
|---|---|---|
| committer | Sébastien Dailly <sebastien@dailly.me> | 2026-05-30 09:58:45 +0200 |
| commit | 8b2420f74367e4973be0dd9556c021588abfe591 (patch) | |
| tree | b95fbf8d5aefc51f619b2506d8ae75ee9f29b75b | |
Initial commit
38 files changed, 794 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f9eefcf --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +configs/*_defconfig +board/genimage-*.cfg +output/ +wpa_supplicant.conf +local/ +board/common/rootfs_overlay/home/ diff --git a/Config.in b/Config.in new file mode 100644 index 0000000..9c91f56 --- /dev/null +++ b/Config.in @@ -0,0 +1,3 @@ +source "$BR2_EXTERNAL_BASTION_PATH/package/birthday/Config.in" +source "$BR2_EXTERNAL_BASTION_PATH/package/byobu/Config.in" +source "$BR2_EXTERNAL_BASTION_PATH/package/python-newt/Config.in" diff --git a/board/common/common.sh b/board/common/common.sh new file mode 100644 index 0000000..ee1af1f --- /dev/null +++ b/board/common/common.sh @@ -0,0 +1,28 @@ +create_missing_dir() { + echo "creating directory ${TARGET_DIR}/$1" + test -d "${TARGET_DIR}/$1" || mkdir -p "${TARGET_DIR}/$1" +} + +remove_text() { + echo sed --in-place "s/$2//" $1 + sed --in-place "s/$2//" $1 +} + +add_tmpfs() { + create_missing_dir "$1" + if ! grep -q "$1" "${TARGET_DIR}/etc/fstab"; then + cat << __EOF__ >> "${TARGET_DIR}/etc/fstab" +tmpfs $1 tmpfs rw 0 0 +__EOF__ + fi +} + +# Enable a systemd service +enable_service() { + if [ -e "$BR2_EXTERNAL_BASTION_PATH/local/services/$1" ]; then + cp "$BR2_EXTERNAL_BASTION_PATH/local/services/$1" "${TARGET_DIR}/etc/systemd/system/$1" + else + echo "WARN: local/services/$1 does not exists" + fi + ln -sf /etc/systemd/system/$1 "${TARGET_DIR}/usr/lib/systemd/system/multi-user.target.wants/$1" +} diff --git a/board/common/network.sh b/board/common/network.sh new file mode 100644 index 0000000..d28997e --- /dev/null +++ b/board/common/network.sh @@ -0,0 +1,36 @@ +########################### +# # +# Network configuration # +# # +########################### + +# Add default wpa_supplicant.conf if it exists +if [ -f "$BR2_EXTERNAL_BASTION_PATH/wpa_supplicant.conf" ]; then + create_missing_dir "/etc/wpa_supplicant/" + cat "$BR2_EXTERNAL_BASTION_PATH/wpa_supplicant.conf" > "${TARGET_DIR}/etc/wpa_supplicant/wpa_supplicant-wlan0.conf" + + +# cat << __EOF__ > "${TARGET_DIR}/etc/systemd/network/wireless.network" +#[Match] +#Name=wlan0 +# +#[Network] +#DHCP=yes +#__EOF__ + + # Create the link to interface wlan0 directly in the system configuration + ln -sf /usr/lib/systemd/system/wpa_supplicant@.service "${TARGET_DIR}/usr/lib/systemd/system/multi-user.target.wants/wpa_supplicant@wlan0.service" + +fi + + +cat << __EOF__ > "${TARGET_DIR}/etc/systemd/network/dhcp.network" +[Match] +Name=* + +[Network] +DHCP=yes + +[DHCP] +UseDNS=true +__EOF__ diff --git a/board/common/post-build.sh b/board/common/post-build.sh new file mode 100755 index 0000000..d96b74b --- /dev/null +++ b/board/common/post-build.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +set -u +set -e + +# Copie des fichiers de clef ssh +cp -v $BR2_EXTERNAL_BASTION_PATH/local/ssh/* ${TARGET_DIR}/etc/ssh +chmod go-r ${TARGET_DIR}/etc/ssh/ssh_host_ecdsa_key +chmod go-r ${TARGET_DIR}/etc/ssh/ssh_host_ed25519_key +chmod go-r ${TARGET_DIR}/etc/ssh/ssh_host_rsa_key +if ! grep -qF 'Include /etc/ssh/sshd_config.d/*.conf' "${TARGET_DIR}/etc/ssh/sshd_config"; then + cat << __EOF__ >> "${TARGET_DIR}/etc/ssh/sshd_config" +Include /etc/ssh/sshd_config.d/*.conf +__EOF__ +fi + + +#touch ${TARGET_DIR}/home/sebastien/test + +. "${BR2_EXTERNAL_BASTION_PATH}/board/common/common.sh" +. "${BR2_EXTERNAL_BASTION_PATH}/board/common/network.sh" +add_tmpfs '/tmp' +# +## Add a 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 +#fi + +# Put the whole system in readonly +#sed -ie '/^\/dev\/root/ s/rw 0 1/ro 0 0/' "${TARGET_DIR}/etc/fstab" + +mkdir -p "${TARGET_DIR}"/etc/systemd/system/getty.target.wants +# Add a console on ttyAMA0 and enable auto login +ln -sf /usr/lib/systemd/system/serial-getty@.service "${TARGET_DIR}"/etc/systemd/system/getty.target.wants/serial-getty@ttyGS0.service +sed '/^ExecStart=/ s/-o .-p -- ..u./--skip-login --noclear --noissue --login-options "-f root"/' -i "${TARGET_DIR}"/usr/lib/systemd/system/serial-getty@.service diff --git a/board/common/rootfs_overlay/etc/ssh/sshd_config.d/locale.conf b/board/common/rootfs_overlay/etc/ssh/sshd_config.d/locale.conf new file mode 100644 index 0000000..cce7f73 --- /dev/null +++ b/board/common/rootfs_overlay/etc/ssh/sshd_config.d/locale.conf @@ -0,0 +1 @@ +AcceptEnv LANG LC_* COLORTERM NO_COLOR diff --git a/board/common/rootfs_overlay/etc/ssh/sshd_config.d/no_password.conf b/board/common/rootfs_overlay/etc/ssh/sshd_config.d/no_password.conf new file mode 100644 index 0000000..1efa6ab --- /dev/null +++ b/board/common/rootfs_overlay/etc/ssh/sshd_config.d/no_password.conf @@ -0,0 +1,2 @@ +PasswordAuthentication no +PubkeyAuthentication yes diff --git a/board/common/rootfs_overlay/etc/systemd/resolved.conf.d/listen_all.conf b/board/common/rootfs_overlay/etc/systemd/resolved.conf.d/listen_all.conf new file mode 100644 index 0000000..9e68b7a --- /dev/null +++ b/board/common/rootfs_overlay/etc/systemd/resolved.conf.d/listen_all.conf @@ -0,0 +1,3 @@ +[Resolve] +DNSStubListenerExtra=0.0.0.0 +DNSStubListenerExtra=:: diff --git a/board/orangepi/common/extlinux.conf b/board/orangepi/common/extlinux.conf new file mode 100644 index 0000000..12f496b --- /dev/null +++ b/board/orangepi/common/extlinux.conf @@ -0,0 +1,4 @@ +LABEL default + kernel /boot/%LINUXIMAGE% + devicetreedir /boot + append root=PARTUUID=%PARTUUID% rootwait console=${console} rootfstype=ext4 quiet panic=10 diff --git a/board/orangepi/common/genimage.cfg b/board/orangepi/common/genimage.cfg new file mode 100644 index 0000000..c748108 --- /dev/null +++ b/board/orangepi/common/genimage.cfg @@ -0,0 +1,20 @@ +image sdcard.img { + partition u-boot { + in-partition-table = false + image = "u-boot-sunxi-with-spl.bin" + offset = 8K + size = 1000K # 1MB - 8KB(offset) - 16KB(GPT) + } + + hdimage { + partition-table-type = "gpt" + gpt-location = 1008K # 1MB - 16KB(GPT) + gpt-no-backup = true + } + + partition rootfs { + offset = 1M + image = "rootfs.ext4" + partition-uuid = %PARTUUID% + } +} diff --git a/board/orangepi/common/post-build.sh b/board/orangepi/common/post-build.sh new file mode 100755 index 0000000..bc5d630 --- /dev/null +++ b/board/orangepi/common/post-build.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +. ${BR2_EXTERNAL_BASTION_PATH}/board/common/post-build.sh + +linux_image() +{ + if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then + echo "uImage" + elif grep -Eq "^BR2_LINUX_KERNEL_IMAGE=y$" ${BR2_CONFIG}; then + echo "Image" + elif grep -Eq "^BR2_LINUX_KERNEL_IMAGEGZ=y$" ${BR2_CONFIG}; then + echo "Image.gz" + else + echo "zImage" + fi +} + +generic_getty() +{ + if grep -Eq "^BR2_TARGET_GENERIC_GETTY=y$" ${BR2_CONFIG}; then + echo "" + else + echo "s/\s*console=\S*//" + fi +} + +PARTUUID="$($HOST_DIR/bin/uuidgen)" + +install -d "$TARGET_DIR/boot/extlinux/" + +sed -e "$(generic_getty)" \ + -e "s/%LINUXIMAGE%/$(linux_image)/g" \ + -e "s/%PARTUUID%/$PARTUUID/g" \ + "board/orangepi/common/extlinux.conf" > "$TARGET_DIR/boot/extlinux/extlinux.conf" + +sed "s/%PARTUUID%/$PARTUUID/g" "board/orangepi/common/genimage.cfg" > "$BINARIES_DIR/genimage.cfg" diff --git a/board/orangepi/orangepi-zero/linux-extras.fragment b/board/orangepi/orangepi-zero/linux-extras.fragment new file mode 100644 index 0000000..2db241d --- /dev/null +++ b/board/orangepi/orangepi-zero/linux-extras.fragment @@ -0,0 +1,20 @@ +# spidev +CONFIG_SPI_SPIDEV=y + +# spi nor +CONFIG_MTD=y +CONFIG_MTD_OF_PARTS=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_M25P80=y + +# wireless core +CONFIG_WIRELESS=y +CONFIG_CFG80211=y +CONFIG_MAC80211=y +CONFIG_CFG80211_WEXT=y + +# wireless drivers +CONFIG_WLAN=y + +# ondemand cpufreq governor +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y diff --git a/board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt-triggering-xr819.patch b/board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt-triggering-xr819.patch new file mode 100644 index 0000000..16207af --- /dev/null +++ b/board/orangepi/orangepi-zero/patches/linux/0001-ARM-dts-orange-pi-zero-interrupt-triggering-xr819.patch @@ -0,0 +1,35 @@ +From 321faaf4b78d46a0c77782c1798856746f0619e9 Mon Sep 17 00:00:00 2001 +From: Sergey Matyukevich <geomatsi@gmail.com> +Date: Fri, 19 May 2017 23:39:48 +0300 +Subject: [PATCH] ARM: dts: orange-pi-zero: specify XR819 WiFi chip + interrupts + +The orange-pi-zero board has Allwinner XR819 SDIO wifi chip. The board +dts file provides a node enabling mmc1 controller. Together with an +out-of-tree driver https://github.com/fifteenhex/xradio this node +enables using the wifi chip. + +This commit specifies XR819 interrupt configuration for the driver. + +Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com> +--- + arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +index b7ca916d871d..4e1a9050c6b4 100644 +--- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts ++++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +@@ -125,6 +125,9 @@ + */ + xr819: sdio_wifi@1 { + reg = <1>; ++ compatible = "xradio,xr819"; ++ interrupt-parent = <&pio>; ++ interrupts = <6 10 IRQ_TYPE_EDGE_RISING>; + }; + }; + +-- +2.11.0 + diff --git a/board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch b/board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch new file mode 100644 index 0000000..e4c52ab --- /dev/null +++ b/board/orangepi/orangepi-zero/patches/linux/0002-ARM-dts-orange-pi-zero-enable-spi-nor.patch @@ -0,0 +1,42 @@ +From 068c3baff3048a3db4ef2518ff917ce749cd8169 Mon Sep 17 00:00:00 2001 +From: Sergey Matyukevich <geomatsi@gmail.com> +Date: Sat, 20 May 2017 11:24:26 +0300 +Subject: [PATCH] ARM: dts: orange-pi-zero: enable SPI NOR + +Enable SPI NOR on orange-pi-zero board. + +For more information see: +- http://linux-sunxi.org/Orange_Pi_Zero#SPI_NOR_flash + +Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com> +--- + arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +index 4e1a9050c6b4..cdf19821b1f3 100644 +--- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts ++++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +@@ -161,3 +161,19 @@ + /* USB VBUS is always on */ + status = "okay"; + }; ++ ++&spi0 { ++ status = "okay"; ++ ++ flash@0 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ compatible = "mxicy,mx25l1606e", "winbond,w25q128"; ++ reg = <0>; ++ spi-max-frequency = <40000000>; ++ ++ partition@00000000 { ++ reg = <0x00000000 0x200000>; /* 2Mb */ ++ }; ++ }; ++}; +-- +2.11.0 + diff --git a/board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch b/board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch new file mode 100644 index 0000000..ae0ed9b --- /dev/null +++ b/board/orangepi/orangepi-zero/patches/linux/0003-ARM-dts-orange-pi-zero-enable-spidev.patch @@ -0,0 +1,42 @@ +From 8dd1b2a696bb7e9914abd11cc6f5c0f54c33d626 Mon Sep 17 00:00:00 2001 +From: Sergey Matyukevich <geomatsi@gmail.com> +Date: Sat, 20 May 2017 15:36:51 +0300 +Subject: [PATCH] ARM: dts: orange-pi-zero: enable spidev + +On orange-pi-zero board SPI1 pins are accessible via GPIO expansion port. +This patch enables spidev driver for SPI1. + +Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com> +--- + arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +index cdf19821b1f3..7242aaecb14f 100644 +--- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts ++++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +@@ -59,6 +59,7 @@ + serial0 = &uart0; + /* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */ + ethernet1 = &xr819; ++ spi1 = &spi1; + }; + + chosen { +@@ -177,3 +178,13 @@ + }; + }; + }; ++ ++&spi1 { ++ status = "okay"; ++ ++ spidev@0 { ++ compatible = "rohm,dh2228fv"; ++ reg = <0>; ++ spi-max-frequency = <10000000>; ++ }; ++}; +-- +2.11.0 + diff --git a/board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch b/board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch new file mode 100644 index 0000000..839bc16 --- /dev/null +++ b/board/orangepi/orangepi-zero/patches/linux/0004-ARM-dts-orange-pi-zero-enable-uart.patch @@ -0,0 +1,35 @@ +From e8768cc1f0f1231cbd4864417de629330e21222d Mon Sep 17 00:00:00 2001 +From: Sergey Kuzminov <kuzminov.sergey81@gmail.com> +Date: Sun, 21 Nov 2021 00:58:32 +0300 +Subject: [PATCH] ARM: dts: orange-pi-zero: enable uart + +Enable uart1 and uart2 on orange-pi-zero board. + +Signed-off-by: Sergey Kuzminov <kuzminov.sergey81@gmail.com> +--- + arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +index f19ed981da9d..03acf166ab70 100644 +--- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts ++++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +@@ -184,13 +184,13 @@ &uart0 { + &uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>; +- status = "disabled"; ++ status = "okay"; + }; + + &uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; +- status = "disabled"; ++ status = "okay"; + }; + + &usb_otg { +-- +2.32.0 + diff --git a/board/orangepi/orangepi-zero/readme.txt b/board/orangepi/orangepi-zero/readme.txt new file mode 100644 index 0000000..1afdbb7 --- /dev/null +++ b/board/orangepi/orangepi-zero/readme.txt @@ -0,0 +1,29 @@ +OrangePi Zero + +Intro +===== + +This default configuration will allow you to start experimenting with the +buildroot environment for the OrangePi Zero. With the current configuration +it will bring-up the board, and allow access through the serial console. + +How to build it +=============== + +Configure Buildroot: + + $ make orangepi_zero_defconfig + +Compile everything and build the SD card image: + + $ make + +How to write the SD card +======================== + +Once the build process is finished you will have an image called "sdcard.img" +in the output/images/ directory. + +Copy the bootable "sdcard.img" onto an SD card with "dd": + + $ sudo dd if=output/images/sdcard.img of=/dev/sdX diff --git a/board/post-image.sh b/board/post-image.sh new file mode 100755 index 0000000..806eb6b --- /dev/null +++ b/board/post-image.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +set -e + +. "${BR2_EXTERNAL_BASTION_PATH}/board/common/common.sh" + +BOARD_DIR="$(dirname $0)" +GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOARDNAME}.cfg" +GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" + +for arg in "$@" +do + case "${arg}" in + --add-miniuart-bt-overlay) + if ! grep -qE '^dtoverlay=' "${BINARIES_DIR}/rpi-firmware/config.txt"; then + echo "Adding 'dtoverlay=miniuart-bt' to config.txt (fixes ttyAMA0 serial console)." + cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt" + +# fixes rpi (3B, 3B+, 3A+, 4B and Zero W) ttyAMA0 serial console +dtoverlay=miniuart-bt +__EOF__ + fi + ;; + --aarch64) + # Run a 64bits kernel (armv8) + sed -e '/^kernel=/s,=.*,=Image,' -i "${BINARIES_DIR}/rpi-firmware/config.txt" + if ! grep -qE '^arm_64bit=1' "${BINARIES_DIR}/rpi-firmware/config.txt"; then + cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt" + +# enable 64bits support +arm_64bit=1 +__EOF__ + fi + ;; + --gpu_mem_256=*|--gpu_mem_512=*|--gpu_mem_1024=*) + # Set GPU memory + gpu_mem="${arg:2}" + sed -e "/^${gpu_mem%=*}=/s,=.*,=${gpu_mem##*=}," -i "${BINARIES_DIR}/rpi-firmware/config.txt" + ;; + + --configure-piaudio) + # Configure piaudio + + # Inform the kernel about the filesystem and ro state + if ! grep -qE 'fastboot noswap ro' "${BINARIES_DIR}/rpi-firmware/cmdline.txt"; then + sed '/^root=/ s/$/ fastboot noswap ro/' -i "${BINARIES_DIR}/rpi-firmware/cmdline.txt" + fi + + ;; + esac + +done + +# 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)" + +rm -rf "${GENIMAGE_TMP}" + +genimage \ + --rootpath "${ROOTPATH_TMP}" \ + --tmppath "${GENIMAGE_TMP}" \ + --inputpath "${BINARIES_DIR}" \ + --outputpath "${BINARIES_DIR}" \ + --config "${GENIMAGE_CFG}" + +exit $? diff --git a/board/raspberrypi/cmdline.txt b/board/raspberrypi/cmdline.txt new file mode 100644 index 0000000..a318558 --- /dev/null +++ b/board/raspberrypi/cmdline.txt @@ -0,0 +1 @@ +root=/dev/mmcblk0p2 rootwait modules-load=dwc2,g_serial console=tty1 console=ttyAMA0,115200 diff --git a/board/raspberrypi/config_0w.txt b/board/raspberrypi/config_0w.txt new file mode 100644 index 0000000..6b862ef --- /dev/null +++ b/board/raspberrypi/config_0w.txt @@ -0,0 +1,32 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using a post-build script. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +# We always use the same names, the real used variant is selected by +# BR2_PACKAGE_RPI_FIRMWARE_{DEFAULT,X,CD} choice +start_file=start.elf +fixup_file=fixup.dat + +kernel=zImage + +# To use an external initramfs file +#initramfs rootfs.cpio.gz + +# Disable overscan assuming the display supports displaying the full resolution +# If the text shown on the screen disappears off the edge, comment this out +disable_overscan=1 + +# How much memory in MB to assign to the GPU on Pi models having +# 256, 512 or 1024 MB total memory +gpu_mem_256=100 +gpu_mem_512=100 +gpu_mem_1024=100 +boot_delay=0 +initial_turbo=10 +dtoverlay=dwc2 + +# https://github.com/raspberrypi/firmware/tree/master/boot/overlays +# dtparam=krnbt=on +dtparam=i2c=on diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..0bbd47c --- /dev/null +++ b/build.sh @@ -0,0 +1,48 @@ +#!/bin/sh +usage() { + echo "usage: BUILDROOT_DIR=${BUILDROOT_DIR} $0 {boardname} all" + echo + echo "with boardname in" + echo " - orangepi_zero" + echo " - qemu_x86_64" + echo " - raspberrypi0[w]" +} + +test -z ${BUILDROOT_DIR} && BUILDROOT_DIR="../buildroot-2026.02/" + +if [ ! -d ${BUILDROOT_DIR} ]; then + usage + echo + echo "Error: the path to buildroot \"${BUILDROOT_DIR}\" does not exists" + exit 1 +fi + +export BOARDNAME=$1 + +case "$BOARDNAME" in + orangepi_zero) + ;; + qemu_x86_64) + ;; + raspberrypi0 | raspberrypi0w) + ;; + *) + usage + echo + echo "Error: unknown card \"$1\"" + exit 1 + ;; +esac + +# Merge custom buildroot configurations +CONFIG_="BR2" KCONFIG_CONFIG="configs/${BOARDNAME}_defconfig" "$BUILDROOT_DIR/support/kconfig/merge_config.sh" -m -r \ + "${BUILDROOT_DIR}/configs/${BOARDNAME}_defconfig" \ + configs/config \ + "configs/$BOARDNAME" +sed "1i ### DO NOT EDIT, this file was automatically generated\n" -i "configs/${BOARDNAME}_defconfig" + +## Create full buildroot configuration +BR2_EXTERNAL="$(pwd)" make O="$(pwd)/output/${BOARDNAME}" -C "${BUILDROOT_DIR}" "${BOARDNAME}_defconfig" + +# Build +BR2_EXTERNAL="$(pwd)" make O="$(pwd)/output/${BOARDNAME}" -C ${BUILDROOT_DIR} "$2" diff --git a/configs/busybox.config b/configs/busybox.config new file mode 100644 index 0000000..2e813e6 --- /dev/null +++ b/configs/busybox.config @@ -0,0 +1,40 @@ +# Disable root access with SU +CONFIG_SU=n + +CONFIG_DELUSER=n +CONFIG_DELGROUP=n + +CONFIG_LPD=n +CONFIG_LPR=n +CONFIG_LPQ=n + +CONFIG_SENDMAIL=n + +CONFIG_DPKG=n +CONFIG_DPKG_DEB=n +CONFIG_RPM=n +CONFIG_CHROOT=n + +CONFIG_DC=n +CONFIG_CHAT=n + +CONFIG_TELNET=n +CONFIG_TELNETD=n +CONFIG_TFTP=n +CONFIG_TFTPD=n +CONFIG_FTPD=n +CONFIG_DNSD=n +CONFIG_HTTPD=n + +CONFIG_HUSH=n +CONFIG_FBSPLASH=n +CONFIG_HDPARM=n +CONFIG_EJECT=n + +CONFIG_ED=n + +CONFIG_NC=n +CONFIG_WGET=n +CONFIG_FTPGET=n +CONFIG_TCPSVD=n +CONFIG_UDPSVD=n diff --git a/configs/config b/configs/config new file mode 100644 index 0000000..e997e52 --- /dev/null +++ b/configs/config @@ -0,0 +1,68 @@ +### Generic configuration for all boards +# +BR2_HAVE_DOT_CONFIG=y +BR2_TARGET_ROOTFS_EXT2_SIZE="255M" +BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_BASTION_PATH)/patches" + +BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_BASTION_PATH)/board/common/post-build.sh" +BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_BASTION_PATH)/board/common/rootfs_overlay/" +BR2_ROOTFS_USERS_TABLES="${BR2_EXTERNAL}/configs/users.txt" + +BR2_TARGET_GENERIC_HOSTNAME="orange-bastion" +BR2_TARGET_ENABLE_ROOT_LOGIN=n +#BR2_TARGET_GENERIC_ROOT_PASSWD="root" + +BR2_TOOLCHAIN_BUILDROOT_LOCALE=y +BR2_TOOLCHAIN_BUILDROOT_WCHAR=y + +BR2_INIT_SYSTEMD=y + +BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y +BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL}/configs/busybox.config" + +BR2_TOOLCHAIN_BUILDROOT_GLIBC=y +BR2_PACKAGE_GLIBC_UTILS=y +BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY=y + +BR2_NEEDS_HOST_UTF8_LOCALE=y +BR2_ENABLE_LOCALE=y +BR2_PACKAGE_SYSTEMD_LOCALED=y +BR2_ENABLE_LOCALE_PURGE=y +BR2_GENERATE_LOCALE="C.UTF-8 en_US.UTF-8 fr_FR.UTF-8" +BR2_ENABLE_LOCALE_WHITELIST="C en_US fr_FR" + +BR2_PACKAGE_SYSTEMD_RESOLVED=y +BR2_PACKAGE_WPA_SUPPLICANT=y + +BR2_PACKAGE_NTP=y +BR2_PACKAGE_NTP_NTPD=y + +BR2_PACKAGE_CA_CERTIFICATES=y +BR2_PACKAGE_OPENSSH_SERVER=y +BR2_PACKAGE_OPENSSH=y +BR2_PACKAGE_SUDO=y + +BR2_PACKAGE_AVAHI_DAEMON=y +#BR2_PACKAGE_RSYNC=y + +# Birthday +#BR2_PACKAGE_BIRTHDAY=y + +# Irssi +BR2_PACKAGE_IRSSI=y +BR2_PACKAGE_IRSSI_TRUE_COLOR=y +BR2_PACKAGE_PERL=y + +BR2_PACKAGE_BASH=y +BR2_PACKAGE_TMUX=y + +BR2_PACKAGE_PYTHON3=y +BR2_PACKAGE_NEWT=y +BR2_PACKAGE_BYOBU=y + + +BR2_PACKAGE_FAIL2BAN=y + +#BR2_PACKAGE_SYSLOG_NG=y + +BR2_PACKAGE_DHCPCD=y diff --git a/configs/orangepi_zero b/configs/orangepi_zero new file mode 100644 index 0000000..7dd5cde --- /dev/null +++ b/configs/orangepi_zero @@ -0,0 +1,3 @@ + +# Script à appliquer post-installation +BR2_ROOTFS_POST_BUILD_SCRIPT="board/orangepi/common/post-build.sh" diff --git a/configs/qemu_x86_64 b/configs/qemu_x86_64 new file mode 100644 index 0000000..61ea008 --- /dev/null +++ b/configs/qemu_x86_64 @@ -0,0 +1,3 @@ +# Specific configuration for the board +# … actually nothing +BR2_PACKAGE_WPA_SUPPLICANT=n diff --git a/configs/raspberrypi0 b/configs/raspberrypi0 new file mode 100644 index 0000000..41222b6 --- /dev/null +++ b/configs/raspberrypi0 @@ -0,0 +1,9 @@ +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="$(BR2_EXTERNAL_BASTION_PATH)/board/raspberrypi/config_0w.txt" + +BR2_PACKAGE_BRCMFMAC_SDIO_FIRMWARE_RPI=y +#BR2_PACKAGE_BRCMFMAC_SDIO_FIRMWARE_RPI_BT=n +BR2_PACKAGE_BRCMFMAC_SDIO_FIRMWARE_RPI_WIFI=n +BR2_PACKAGE_WPA_SUPPLICANT=n + +# Activate the serial console on USB +BR2_PACKAGE_RPI_FIRMWARE_CMDLINE_FILE="$(BR2_EXTERNAL_BASTION_PATH)/board/raspberrypi/cmdline.txt" diff --git a/configs/raspberrypi0w b/configs/raspberrypi0w new file mode 100644 index 0000000..e9c865e --- /dev/null +++ b/configs/raspberrypi0w @@ -0,0 +1,8 @@ +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="$(BR2_EXTERNAL_BASTION_PATH)/board/raspberrypi/config_0w.txt" + +BR2_PACKAGE_BRCMFMAC_SDIO_FIRMWARE_RPI=y +#BR2_PACKAGE_BRCMFMAC_SDIO_FIRMWARE_RPI_BT=n +BR2_PACKAGE_BRCMFMAC_SDIO_FIRMWARE_RPI_WIFI=y + +# Activate the serial console on USB +BR2_PACKAGE_RPI_FIRMWARE_CMDLINE_FILE="$(BR2_EXTERNAL_BASTION_PATH)/board/raspberrypi/cmdline.txt" diff --git a/configs/users.txt b/configs/users.txt new file mode 100644 index 0000000..6019398 --- /dev/null +++ b/configs/users.txt @@ -0,0 +1,3 @@ +jose -1 jose -1 - /home/jose /bin/sh - José pour rebond ssh +dominique -1 dominique -1 - /home/dominique /bin/bash sudo Dominique +sebastien -1 sebastien -1 =sebastien /home/sebastien/ /bin/bash sudo Sébastien diff --git a/external.desc b/external.desc new file mode 100644 index 0000000..bd51d2f --- /dev/null +++ b/external.desc @@ -0,0 +1,2 @@ +name: BASTION +desc: Bastion server diff --git a/external.mk b/external.mk new file mode 100644 index 0000000..8f34e3a --- /dev/null +++ b/external.mk @@ -0,0 +1 @@ +include $(sort $(wildcard $(BR2_EXTERNAL_BASTION_PATH)/package/*/*.mk)) diff --git a/package/birthday/Config.in b/package/birthday/Config.in new file mode 100644 index 0000000..ec4d919 --- /dev/null +++ b/package/birthday/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_BIRTHDAY + bool "birthday" + help + Install birthday + + https://sourceforge.net/projects/birthday/ diff --git a/package/birthday/birthday.mk b/package/birthday/birthday.mk new file mode 100644 index 0000000..09c379d --- /dev/null +++ b/package/birthday/birthday.mk @@ -0,0 +1,17 @@ +BIRTHDAY_VERSION=1.6.2-7 +BIRTHDAY_SITE = https://salsa.debian.org/salvage-team/birthday/-/archive/debian/${BIRTHDAY_VERSION} +BIRTHDAY_SOURCE = birthday-debian-${BIRTHDAY_VERSION}.tar.gz +BIRTHDAY_LICENCE = +BIRTHDAY_LICENCE_FILES = + +define BIRTHDAY_BUILD_CMDS + (cd $(@D); \ + make ) +endef + +define BIRTHDAY_INSTALL_TARGET_CMDS + (cd $(@D); \ + make install DESTDIR=$(TARGET_DIR)) +endef + +$(eval $(generic-package)) diff --git a/package/byobu/Config.in b/package/byobu/Config.in new file mode 100644 index 0000000..f223c4c --- /dev/null +++ b/package/byobu/Config.in @@ -0,0 +1,6 @@ +config BR2_PACKAGE_BYOBU + bool "byobu" + help + Install byobu + + https://www.byobu.org/ diff --git a/package/byobu/byobu.mk b/package/byobu/byobu.mk new file mode 100644 index 0000000..27b2c05 --- /dev/null +++ b/package/byobu/byobu.mk @@ -0,0 +1,18 @@ +BYOBU_VERSION=6.16 +BYOBU_SITE = $(call github,dustinkirkland,byobu,$(BYOBU_VERSION)) +#BYOBU_SOURCE = ${BYOBU_VERSION}.tar.gz +BYOBU_LICENCE = +BYOBU_LICENCE_FILES = + +define BYOBU_BUILD_CMDS + (cd $(@D); \ + ./autogen.sh; \ + ./configure --prefix="/"; \ + $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) all) +endef + +define BYOBU_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install DESTDIR=$(TARGET_DIR) +endef + +$(eval $(generic-package)) diff --git a/package/python-newt/Config.in b/package/python-newt/Config.in new file mode 100644 index 0000000..dbe9374 --- /dev/null +++ b/package/python-newt/Config.in @@ -0,0 +1,5 @@ +config BR2_PACKAGE_NEWT + bool "newt" + help + https://github.com/kaelzhang/python-newt + diff --git a/package/python-newt/newt.mk b/package/python-newt/newt.mk new file mode 100644 index 0000000..5e605ed --- /dev/null +++ b/package/python-newt/newt.mk @@ -0,0 +1,13 @@ +################################################################################ +# +# newt +# +################################################################################ + +# Force to use libintl, otherwise it finds gettext functions in the C +# library, and does not link against libintl. +NEWT_CONF_ENV = LIBS=$(TARGET_NLS_LIBS) +NEWT_MAKE_ENV = $(PKG_PYTHON_SETUPTOOLS_ENV) +NEWT_CONF_OPTS = --without-tcl --with-python=python3.14 + +$(eval $(autotools-package)) diff --git a/patches/newt/001-python-snack.patch b/patches/newt/001-python-snack.patch new file mode 100644 index 0000000..d1a23ba --- /dev/null +++ b/patches/newt/001-python-snack.patch @@ -0,0 +1,39 @@ +Update the deprecated functions for python + +--- newt-0.52.23/snack.c.orig 2026-05-27 12:52:32.785944840 +0200 ++++ newt-0.52.23/snack.c 2026-05-27 12:17:34.944987036 +0200 +@@ -456,7 +456,7 @@ static void helpCallbackMarshall(newtCom + PyGILState_STATE _state = PyGILState_Ensure(); + + args = Py_BuildValue("(O)", data); +- result = PyEval_CallObject(helpCallback.cb, args); ++ result = PyObject_CallObject(helpCallback.cb, args); + Py_DECREF (args); + Py_XDECREF(result); + +@@ -473,10 +473,10 @@ static void suspendCallbackMarshall(void + + if (scs->data) { + args = Py_BuildValue("(O)", scs->data); +- result = PyEval_CallObject(scs->cb, args); ++ result = PyObject_CallObject(scs->cb, args); + Py_DECREF (args); + } else +- result = PyEval_CallObject(scs->cb, NULL); ++ result = PyObject_CallObject(scs->cb, NULL); + + if (!result) { + PyErr_Print(); +@@ -498,10 +498,10 @@ static void callbackMarshall(newtCompone + + if (scs->data) { + args = Py_BuildValue("(O)", scs->data); +- result = PyEval_CallObject(scs->cb, args); ++ result = PyObject_CallObject(scs->cb, args); + Py_DECREF (args); + } else +- result = PyEval_CallObject(scs->cb, NULL); ++ result = PyObject_CallObject(scs->cb, NULL); + + if (!result) { + PyErr_Print(); diff --git a/start-qemu.sh b/start-qemu.sh new file mode 100755 index 0000000..299b324 --- /dev/null +++ b/start-qemu.sh @@ -0,0 +1,22 @@ +#!/bin/sh +( +BINARIES_DIR="${0%/*}/" +cd ${BINARIES_DIR} + +if [ "${1}" = "serial-only" ]; then + EXTRA_ARGS='-nographic' + echo "Press ^A- h to access to the console" +else + EXTRA_ARGS='-serial stdio' +fi + +#export PATH="/home/sebastien/pi0/bastion/output/qemu_x86_64/host/bin:${PATH}" +qemu-system-x86_64 -M pc \ + -kernel output/qemu_x86_64/images/bzImage \ + -drive \ + file=output/qemu_x86_64/images/rootfs.ext2,if=virtio,format=raw \ + -append "rootwait root=/dev/vda console=tty1 console=ttyS0" \ + -net nic,model=virtio \ + -net user,hostfwd=tcp::5555-:22 \ + ${EXTRA_ARGS} +) |
