Compare commits

..
Author SHA1 Message Date
Mattias Walström cc0edaf59c confd: Add support to upload images directly
This add support for upgrading images with curl only, without FTP or
similiar. The image needs to be base64 encoded.

Example:

TEMP_JSON=/tmp/restconf.txt
echo -n '{"infix-system:input":{"image":"' > "$TEMP_JSON"
base64 -w 0 "$BUNDLE_FILE" >> "$TEMP_JSON"
echo '"}}' >> "$TEMP_JSON"

curl -k \
  -X POST \
  -u "admin:admin" \
  -H "Content-Type: application/yang-data+json" \
  -H "Accept: application/yang-data+json" \
  -d @"$TEMP_JSON" \
  "https://192.168.30.1/restconf/operations/infix-system:install-bundle"
2025-07-11 16:33:02 +02:00
Mattias Walström 60b3a97f0e confd: Coding style 2025-07-11 16:33:01 +02:00
Mattias Walström e534c0bd2d nginx: Add support for large files in restconf app. 2025-07-11 16:26:33 +02:00
36 changed files with 2055 additions and 505 deletions
@@ -0,0 +1,14 @@
--- a/arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts 2025-04-28 00:13:06.880003668 +0200
+++ b/arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts 2025-04-28 00:14:17.708941263 +0200
@@ -14,6 +14,11 @@
chosen {
/* 8250 auxiliary UART instead of pl011 */
stdout-path = "serial1:115200n8";
+
+ infix {
+ /* Default admin user password: 'admin' */
+ factory-password-hash = "$5$mI/zpOAqZYKLC2WU$i7iPzZiIjOjrBF3NyftS9CCq8dfYwHwrmUK097Jca9A";
+ };
};
cam1_reg: regulator-cam1 {
File diff suppressed because it is too large Load Diff
@@ -12,8 +12,6 @@ kernel=u-boot.bin
device_tree=bcm2711-rpi-4-b.dtb
dtoverlay=rpi-env
dtoverlay=infix-key
dtoverlay=vc4-kms-v3d-pi4
dtoverlay=vc4-kms-dsi-ili9881-7inch
# To use an external initramfs file
#initramfs rootfs.cpio.gz
@@ -22,7 +20,11 @@ dtoverlay=vc4-kms-dsi-ili9881-7inch
# If the text shown on the screen disappears off the edge, comment this out
disable_overscan=1
gpu_mem=256
# 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
# Enable UART0 for serial console on ttyAMA0
enable_uart=1
@@ -29,7 +29,7 @@ image var.ext4 {
}
}
image #INFIX_ID##VERSION#-rpi4-sdcard.img {
image sdcard.img {
hdimage {
partition-table-type = "gpt"
}
@@ -1,6 +1,5 @@
#!/bin/sh
set -e
#. "$BR2_CONFIG" 2>/dev/null
BOARD_DIR=$(dirname "$0")
GENIMAGE_CFG="${BUILD_DIR}/genimage.cfg"
@@ -19,22 +18,17 @@ find "${BINARIES_DIR}" -type f -name '*.dtbo' -exec mv '{}' "${BINARIES_DIR}/rpi
# Create FILES array for the genimage.cfg generation
FILES=""
for f in "${BINARIES_DIR}"/rpi-firmware/*; do
for f in "${BINARIES_DIR}"/*.dtb "${BINARIES_DIR}"/rpi-firmware/*; do
case "$f" in
*~|*.bak) continue ;;
esac
echo "${FILES}" | grep -q `basename $f` && continue # If already exist it has been added by us.
FILES="${FILES}\t\t\t\"${f#"${BINARIES_DIR}/"}\",\n"
done
echo $FILES
KERNEL=$(sed -n 's/^kernel=//p' "${BINARIES_DIR}/rpi-firmware/config.txt")
FILES="${FILES}\t\t\t\"${KERNEL}\""
sed "s|#BOOT_FILES#|${FILES}|" "${BOARD_DIR}/genimage.cfg.in" | \
sed "s|#VERSION#|${RELEASE}|" | \
sed "s|#INFIX_ID#|${INFIX_ID}|" > "${GENIMAGE_CFG}"
sed "s|#BOOT_FILES#|${FILES}|" "${BOARD_DIR}/genimage.cfg.in" > "${GENIMAGE_CFG}"
ROOTPATH_TMP=$(mktemp -d)
trap 'rm -rf \"$ROOTPATH_TMP\"' EXIT
@@ -0,0 +1,16 @@
default rpi4b
menu title Boot Menu
prompt 1
timeout 30
label rpi4b
menu label Infix on Raspberry Pi 4B
kernel /boot/Image
devicetree /boot/broadcom/bcm2711-rpi-4-b.dtb
append ${bootargs_root} 8250.nr_uarts=1 console=ttyS0,115200 ${bootargs_log} -- ${bootargs_user}
label rpi400
menu label Infix on Raspberry Pi 400
kernel /boot/Image
devicetree /boot/broadcom/bcm2711-rpi-400.dtb
append ${bootargs_root} 8250.nr_uarts=1 console=ttyS0,115200 ${bootargs_log} -- ${bootargs_user}
@@ -2,17 +2,6 @@
"ieee802-dot1ab-lldp:lldp": {
"infix-lldp:enabled": true
},
"ietf-hardware:hardware": {
"component": [
{
"name": "USB",
"class": "infix-hardware:usb",
"state": {
"admin-state": "unlocked"
}
}
]
},
"ietf-interfaces:interfaces": {
"interface": [
{
@@ -38,10 +27,6 @@
{
"name": "eth0",
"type": "infix-if-type:ethernet"
},
{
"name": "wifi0",
"type": "infix-if-type:wifi"
}
]
},
@@ -50,9 +35,9 @@
"asymmetric-key": [
{
"name": "genkey",
"public-key-format": "infix-crypto-types:ssh-public-key-format",
"public-key-format": "ietf-crypto-types:ssh-public-key-format",
"public-key": "",
"private-key-format": "infix-crypto-types:rsa-private-key-format",
"private-key-format": "ietf-crypto-types:rsa-private-key-format",
"cleartext-private-key": "",
"certificates": {}
}
@@ -94,7 +79,7 @@
],
"rule": [
{
"name": "deny-password-read",
"name": "deny-password-read",
"module-name": "ietf-system",
"path": "/ietf-system:system/authentication/user/password",
"access-operations": "*",
@@ -142,7 +127,7 @@
"udp": {
"address": "pool.ntp.org"
},
"iburst": true
"iburst": true
}
]
},
@@ -188,7 +173,7 @@
]
},
"infix-meta:meta": {
"version": "1.5"
"infix-meta:version": "1.2"
},
"infix-services:mdns": {
"enabled": true
@@ -204,23 +189,5 @@
"restconf": {
"enabled": true
}
},
"infix-services:ssh": {
"enabled": true,
"hostkey": [
"genkey"
],
"listen": [
{
"name": "ipv4",
"address": "0.0.0.0",
"port": 22
},
{
"name": "ipv6",
"address": "::",
"port": 22
}
]
}
}
@@ -0,0 +1,6 @@
# Broadcom BCM2835 Watchdog timer
device /dev/watchdog0 {
timeout = 60
interval = 5
safe-exit = true
}
@@ -9,7 +9,7 @@
ixbootdelay = "0.5";
bootdelay = "-2";
bootmenu_delay = "10";
boot_targets = "mmc0";
boot_targets = "mmc1";
ethprime = "eth0";
bootcmd = "run ixboot";
-6
View File
@@ -114,12 +114,6 @@ grep -qsE '^/bin/true$$' "$TARGET_DIR/etc/shells" \
grep -qsE '^/bin/false$$' "$TARGET_DIR/etc/shells" \
|| echo "/bin/false" >> "$TARGET_DIR/etc/shells"
boards=$(${BR2_EXTERNAL_INFIX_PATH}/board/common/selected-boards.sh ${BR2_EXTERNAL_INFIX_PATH} ${O})
for board in $boards; do
[ ! -f "${BR2_EXTERNAL_INFIX_PATH}/src/board/${board}/post-build.sh" ] && continue
${BR2_EXTERNAL_INFIX_PATH}/src/board/${board}/post-build.sh
done
# Allow clish (symlink to /usr/bin/klish) to be a login shell
grep -qsE '^/bin/clish$$' "$TARGET_DIR/etc/shells" \
|| echo "/bin/clish" >> "$TARGET_DIR/etc/shells"
-8
View File
@@ -108,11 +108,3 @@ rm -f "$BINARIES_DIR/qemu.cfg.old" "$BINARIES_DIR/.config.old"
# Quick intro for beginners, with links to more information
cp "$BR2_EXTERNAL_INFIX_PATH/board/common/README.txt" "$BINARIES_DIR/"
boards=$(${BR2_EXTERNAL_INFIX_PATH}/board/common/selected-boards.sh ${BR2_EXTERNAL_INFIX_PATH} ${O})
for board in $boards; do
[ ! -f "${BR2_EXTERNAL_INFIX_PATH}/src/board/${board}/post-image.sh" ] && continue
RELEASE=$(ver)
export INFIX_ID RELEASE
${BR2_EXTERNAL_INFIX_PATH}/src/board/${board}/post-image.sh
done
@@ -1,5 +1,11 @@
# /telemetry/optics is for streaming (not used atm)
# Proxy buffer settings for large files
proxy_buffering off; # Disable buffering for streaming
proxy_request_buffering off; # Stream request body immediately
proxy_max_temp_file_size 0; # No temp files
location ~ ^/(restconf|yang|.well-known)/ {
client_max_body_size 200M;
client_body_buffer_size 1M;
grpc_pass grpc://[::1]:10080;
grpc_set_header Host $host;
grpc_set_header X-Real-IP $remote_addr;
-165
View File
@@ -1,165 +0,0 @@
# /etc/watchdogd.conf sample
# Commented out values are program defaults.
#
# The checker/monitor `warning` and `critical` levels are 0.00-1.00,
# i.e. 0-100%, except for load average which can vary a lot between
# systems and use-cases, not just because of the number of CPU cores.
# Use the `script = ...` setting to call script when `warning` and
# `critical` are reached for a monitor. In `critical` the monitor
# otherwise triggers an unconditional reboot.
#
# NOTE: `critical` is optional, omitting it disables the reboot action.
#
### Watchdogs ##########################################################
# Global settings that can be overridden per watchdog
# Do not set WDT timeout and kick interval too low, the daemon runs at
# SCHED_OTHER level with all other tasks, unless the process supervisor
# is enabled. The monitor plugins (below) need CPU time as well.
#timeout = 20
#interval = 10
# With safe-exit enabled (true) the daemon will ask the driver disable
# the WDT before exiting (SIGINT). However, some WDT drivers (or HW)
# may not support this.
#safe-exit = true
# Multiple watchdogs can be kicked, the default, even if no .conf file
# is found or device node given on the command line, is /dev/watchdog
device /dev/watchdog {
timeout = 60
interval = 5
safe-exit = true
}
#device /dev/watchdog2 {
# timeout = 20
# interval = 10
# safe-exit = true
#}
### Supervisor #########################################################
# Instrumented processes can have their main loop supervised. Processes
# subscribe to this service using the libwdog API, see the docs for more
# on this. When the supervisor is enabled and the priority is set to a
# value > 0, watchdogd runs as a SCHED_RR process with elevated realtime
# priority. When disabled, or the priority is set to zero (0), it runs
# as a regular SCHED_OTHER process, this is the default.
#
# When a supervised process fails to meet its deadline, the daemon will
# perform an unconditional reset having saved the reset reason. If a
# script is provided in this section it will be called instead. The
# script is called as:
#
# script.sh supervisor CODE PID LABEL
#
# Availabel CODEs for the reset reason are avilable in wdog.h
#
#supervisor {
# !!!REMEMBER TO ENABLE reset-reason (below) AS WELL!!!
# enabled = true
# priority = 98
# script = "/path/to/supervisor-script.sh"
#}
### Reset reason #######################################################
# The following section controls if/how the reset reason & reset counter
# is tracked. By default this is disabled, since not all systems allow
# writing to disk, e.g. embedded systems using MTD devices with limited
# number of write cycles.
#
# The default file setting is a non-volatile path, according to the FHS.
# It can be changed to another location, but make sure that location is
# writable first.
reset-reason {
enabled = true
file = "/var/lib/misc/watchdogd.state"
}
### Checkers/Monitors ##################################################
#
# Script or command to run instead of reboot when a monitor plugin
# reaches any of its critical or warning level. Setting this will
# disable the built-in reboot on critical, it is therefore up to the
# script to perform reboot, if needed. The script is called as:
#
# script.sh {filenr, fsmon, loadavg, meminfo} {crit, warn} VALUE
#
#script = "/path/to/reboot-action.sh"
# Monitors file descriptor leaks based on /proc/sys/fs/file-nr
filenr {
# enabled = true
interval = 300
logmark = false
warning = 0.9
critical = 1.0
# script = "/path/to/alt-reboot-action.sh"
}
# Monitors a file system, blocks and inode usage against watermarks
# The script is called with fsmon as the first argument and there
# are two environment variables FSMON_NAME, for the monitored path,
# and FSMON_TYPE indicating either 'blocks' or 'inodes'.
#fsmon /var {
# enabled = true
# interval = 300
# logmark = false
# warning = 0.95
# critical = 1.0
# script = "/path/to/alt-reboot-action.sh"
#}
# Monitors load average based on sysinfo() from /proc/loadavg
# The level is composed from the average of the 1 and 5 min marks.
loadavg {
# enabled = true
interval = 300
logmark = false
warning = 1.0
critical = 2.0
# script = "/path/to/alt-reboot-action.sh"
}
# Monitors free RAM based on data from /proc/meminfo
meminfo {
# enabled = true
interval = 300
logmark = false
warning = 0.9
critical = 0.95
# script = "/path/to/alt-reboot-action.sh"
}
# Monitor temperature. The critical value is unset by default, so no
# action is taken at that watermark (by default). Both the critical and
# warning watermarks are relative to the trip/critical/max value from
# sysfs. The warning is default 0.9, i.e., 90% of critical. Use script
# to to reset the fan controller or poweroff(8) the system.
#
# Each temp monitor caches the last 10 values, calculates the mean, and
# compares that to the warning and critical levels. Logging is only
# done every 10 x interval (if enabled).
#tempmon /sys/class/hwmon/hwmon0/temp1_input {
# enabled = true
# interval = 30
# warning = 0.9
# critical = 0.95
# logmark = true
# script = "/script/to/log/and/poweroff.sh"
#}
# Monitor a generic script, executes 'monitor-script' every 'interval'
# seconds, with a max runtime of 'timeout' seconds. When the exit code
# of the monitor script is above the critical level watchdogd either
# starts the reboot, or calls the alternate 'script' to determin the
# next cause of action.
#generic /path/to/monitor-script.sh {
# enabled = true
# interval = 300
# timeout = 60
# warning = 1
# critical = 10
# script = "/path/to/alt-reboot-action.sh"
#}
@@ -308,52 +308,16 @@ def probe_qemusystem(out):
subprocess.run("initctl -nbq cond set qemu".split(), check=False)
return 0
def rasberry_pi_4_usb_ports(out):
out["usb-ports"] = [
{
"name": "USB",
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/authorized"
},
{
"name": "USB",
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/authorized_default"
},
{
"name": "USB",
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/authorized",
},
{
"name": "USB",
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-0:1.0/authorized"
},
{
"name": "USB",
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/authorized"
},
{
"name": "USB",
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/authorized_default"
},
{
"name": "USB3",
"path": "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/2-0:1.0/authorized"
}
]
def probe_dtsystem(out):
"""Probe DTS based system, expects a VPD in ONIE PROM format."""
dtsys = DTSystem()
vpds = dtsys.infix_vpds()
dtsys.infix_usb_devices(out)
model = dtsys.base.str("model")
if model:
out["product-name"] = model
# Since rpi4 has USB on PCIe, there is no phandle reference
if model and model.startswith("Raspberry Pi 4"):
rasberry_pi_4_usb_ports(out)
else:
dtsys.infix_usb_devices(out)
out["compatible"] = dtsys.base.str_array("compatible")
staticpw = dtsys.infix.str("factory-password-hash")
-61
View File
@@ -1,61 +0,0 @@
#!/bin/bash
#
# Check if an infix board is selected
if [ $# -ne 2 ]; then
echo "usage: $0 <INFIX-DIR> <OUTPUT>"
exit 1
fi
ROOT=$1
O=$2
BOARD_SRC_DIR="${ROOT}/src/board"
BOARD_PACKAGE_DIR="${ROOT}/package/board"
CONFIG_FILE="${O}/.config"
is_board_enabled() {
local symbol=$1
if [ -f "$CONFIG_FILE" ]; then
if grep -q "^${symbol}=y" "$CONFIG_FILE" 2>/dev/null; then
return 0 # enabled
else
return 1 # disabled or not set
fi
else
echo "Warning: No .config file found. Run 'make menuconfig' first."
return 1
fi
}
get_actual_config_symbol() {
local board_name=$1
local config_file="${BOARD_PACKAGE_DIR}/$board_name/Config.in"
if [ -f "$config_file" ]; then
# Extract the first config symbol from the Config.in file
local symbol=$(grep -m1 "^config " "$config_file" 2>/dev/null | awk '{print $2}')
if [ -n "$symbol" ]; then
echo "$symbol"
return 0
fi
fi
# Fallback to predicted symbol if no Config.in found
echo "BR2_PACKAGE_BOARD_$(echo "$board_name" | tr '[:lower:]' '[:upper:]' | tr '-' '_')"
return 1
}
boards=""
for board_path in "$BOARD_SRC_DIR"/*; do
if [ -d "$board_path" ]; then
board_name=$(basename "$board_path")
config_symbol=$(get_actual_config_symbol "$board_name")
if is_board_enabled "$config_symbol"; then
boards="$boards $board_name"
fi
fi
done
echo "$boards"
-1
View File
@@ -134,7 +134,6 @@ BR2_PACKAGE_ALDER_ALDER=y
BR2_PACKAGE_MARVELL_CN9130_CRB=y
BR2_PACKAGE_MARVELL_ESPRESSOBIN=y
BR2_PACKAGE_STYX_DCP_SC_28P=y
BR2_PACKAGE_RASPBERRY_PI_4=y
BR2_PACKAGE_CONFD=y
BR2_PACKAGE_CONFD_TEST_MODE=y
BR2_PACKAGE_CURIOS_HTTPD=y
+201
View File
@@ -0,0 +1,201 @@
BR2_aarch64=y
BR2_cortex_a72=y
BR2_ARM_FPU_VFPV4=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y
BR2_DL_DIR="${BR2_EXTERNAL_INFIX_PATH}/dl"
BR2_CCACHE=y
BR2_CCACHE_DIR="${BR2_EXTERNAL_INFIX_PATH}/.ccache"
BR2_GLOBAL_PATCH_DIR="board/raspberrypi/patches ${BR2_EXTERNAL_INFIX_PATH}/patches"
BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
BR2_TARGET_GENERIC_HOSTNAME="infix"
BR2_TARGET_GENERIC_ISSUE="Infix by KernelKit"
BR2_INIT_FINIT=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_ROOTFS_DEVICE_TABLE="system/device_table.txt ${BR2_EXTERNAL_INFIX_PATH}/board/common/xattrs"
BR2_ROOTFS_MERGED_USR=y
# BR2_TARGET_ENABLE_ROOT_LOGIN is not set
BR2_SYSTEM_BIN_SH_BASH=y
BR2_TARGET_GENERIC_GETTY_PORT="@console"
BR2_TARGET_GENERIC_GETTY_TERM="xterm"
BR2_SYSTEM_DHCP="eth0"
BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin"
BR2_ENABLE_LOCALE_WHITELIST="C en_US en_CA C.UTF-8"
BR2_GENERATE_LOCALE="en_US en_CA C.UTF-8"
BR2_TARGET_TZ_INFO=y
BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL_INFIX_PATH}/board/common/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/rpi/rootfs"
BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build.sh ${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/rpi/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh ${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/rpi/post-image.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.35"
BR2_LINUX_KERNEL_PATCH="${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/rpi/bcm2711-rpi-4-b-dts.patch"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/rpi/bcm2711_defconfig"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2711-rpi-4-b broadcom/bcm2711-rpi-400"
BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME=y
BR2_LINUX_KERNEL_INSTALL_TARGET=y
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_INFIX_PATH)/board/common/busybox_defconfig"
BR2_PACKAGE_XZ=y
BR2_PACKAGE_STRACE=y
BR2_PACKAGE_STRESS_NG=y
BR2_PACKAGE_JQ=y
BR2_PACKAGE_E2FSPROGS=y
BR2_PACKAGE_ARMBIAN_FIRMWARE=y
BR2_PACKAGE_ARMBIAN_FIRMWARE_AP6255=y
BR2_PACKAGE_BRCMFMAC_SDIO_FIRMWARE_RPI=y
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM43XX=y
BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM43XXX=y
BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM4366B1=y
BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM4366C0=y
BR2_PACKAGE_RPI_FIRMWARE=y
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X=y
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/rpi/config.txt"
BR2_PACKAGE_RPI_FIRMWARE_CMDLINE_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/rpi/cmdline.txt"
BR2_PACKAGE_DBUS_CXX=y
BR2_PACKAGE_DBUS_GLIB=y
BR2_PACKAGE_DBUS_TRIGGERD=y
BR2_PACKAGE_EUDEV_RULES_GEN=y
# BR2_PACKAGE_EUDEV_ENABLE_HWDB is not set
BR2_PACKAGE_EVEMU=y
BR2_PACKAGE_EVTEST=y
BR2_PACKAGE_GPTFDISK=y
BR2_PACKAGE_GPTFDISK_SGDISK=y
BR2_PACKAGE_INPUT_EVENT_DAEMON=y
BR2_PACKAGE_MDIO_TOOLS=y
BR2_PACKAGE_RNG_TOOLS=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_SUPPORT=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
BR2_PACKAGE_UBOOT_TOOLS_FIT_CHECK_SIGN=y
BR2_PACKAGE_UBOOT_TOOLS_MKENVIMAGE=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_GUNICORN=y
BR2_PACKAGE_LIBSSH_OPENSSL=y
BR2_PACKAGE_LIBSSH2=y
BR2_PACKAGE_LIBSSH2_OPENSSL=y
BR2_PACKAGE_LIBOPENSSL_BIN=y
BR2_PACKAGE_LIBINPUT=y
BR2_PACKAGE_LIBCURL_CURL=y
BR2_PACKAGE_NETOPEER2_CLI=y
BR2_PACKAGE_NSS_MDNS=y
BR2_PACKAGE_LINUX_PAM=y
BR2_PACKAGE_LIBPAM_RADIUS_AUTH=y
BR2_PACKAGE_ONIGURUMA=y
BR2_PACKAGE_AVAHI_DAEMON=y
BR2_PACKAGE_AVAHI_DEFAULT_SERVICES=y
BR2_PACKAGE_CHRONY=y
BR2_PACKAGE_CONNTRACK_TOOLS=y
BR2_PACKAGE_DNSMASQ=y
BR2_PACKAGE_ETHTOOL=y
BR2_PACKAGE_FPING=y
BR2_PACKAGE_FRR=y
BR2_PACKAGE_HOSTAPD=y
# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
BR2_PACKAGE_IPROUTE2=y
BR2_PACKAGE_IPTABLES_NFTABLES=y
BR2_PACKAGE_IPUTILS=y
BR2_PACKAGE_IW=y
BR2_PACKAGE_LLDPD=y
BR2_PACKAGE_MSTPD=y
BR2_PACKAGE_NETCALC=y
BR2_PACKAGE_NETCAT_OPENBSD=y
BR2_PACKAGE_NETSNMP=y
BR2_PACKAGE_NFTABLES=y
BR2_PACKAGE_NGINX=y
BR2_PACKAGE_NGINX_HTTP_SSL_MODULE=y
BR2_PACKAGE_NGINX_HTTP_V2_MODULE=y
BR2_PACKAGE_NMAP=y
BR2_PACKAGE_NMAP_NCAT=y
BR2_PACKAGE_NMAP_NMAP=y
BR2_PACKAGE_NMAP_NPING=y
BR2_PACKAGE_OPENRESOLV=y
BR2_PACKAGE_OPENSSH=y
BR2_PACKAGE_SOCAT=y
BR2_PACKAGE_TCPDUMP=y
BR2_PACKAGE_TRACEROUTE=y
BR2_PACKAGE_ULOGD=y
BR2_PACKAGE_WHOIS=y
BR2_PACKAGE_WIRELESS_REGDB=y
BR2_PACKAGE_WIRELESS_TOOLS=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_BASH_COMPLETION=y
BR2_PACKAGE_SUDO=y
BR2_PACKAGE_TTYD=y
BR2_PACKAGE_GETENT=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_IRQBALANCE=y
BR2_PACKAGE_KMOD_TOOLS=y
BR2_PACKAGE_PWGEN=y
BR2_PACKAGE_RAUC=y
BR2_PACKAGE_RAUC_DBUS=y
BR2_PACKAGE_RAUC_GPT=y
BR2_PACKAGE_RAUC_NETWORK=y
BR2_PACKAGE_RAUC_JSON=y
BR2_PACKAGE_SYSKLOGD=y
BR2_PACKAGE_SYSKLOGD_LOGGER=y
BR2_PACKAGE_WATCHDOGD=y
BR2_PACKAGE_LESS=y
BR2_PACKAGE_MG=y
BR2_PACKAGE_NANO=y
BR2_TARGET_ROOTFS_SQUASHFS=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rpi_arm64"
BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_INFIX_PATH)/board/common/uboot/extras.config $(BR2_EXTERNAL_INFIX_PATH)/board/aarch64/rpi/uboot/extras.config"
BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="arch/arm/dts/infix-key.dtbo arch/arm/dts/rpi-env.dtbo"
BR2_TARGET_UBOOT_CUSTOM_DTS_PATH="$(BR2_EXTERNAL_INFIX_PATH)/board/aarch64/rpi/uboot/rpi-env.dtso"
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_E2FSPROGS=y
BR2_PACKAGE_HOST_ENVIRONMENT_SETUP=y
BR2_PACKAGE_HOST_GENEXT2FS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_KMOD_XZ=y
BR2_PACKAGE_HOST_MTOOLS=y
BR2_PACKAGE_HOST_RAUC=y
BR2_PACKAGE_HOST_UBOOT_TOOLS=y
BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT=y
INFIX_VENDOR_HOME="https://github.com/kernelkit"
INFIX_IMAGE_ID="${INFIX_ID}-rpi4"
INFIX_DESC="Infix is an operating system based on Linux and modeled with YANG. It can be set up both as a switch, with offloading using switchdev, a router with firewalling, or a secure end device. All while supporting advanced networking scenarios and running Docker containers."
INFIX_HOME="https://github.com/kernelkit/infix/"
INFIX_DOC="https://github.com/kernelkit/infix/tree/main/doc"
INFIX_SUPPORT="mailto:kernelkit@googlegroups.com"
BR2_PACKAGE_CONFD=y
BR2_PACKAGE_GENCERT=y
BR2_PACKAGE_STATD=y
BR2_PACKAGE_FACTORY=y
BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y
BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS=y
BR2_PACKAGE_FINIT_PLUGIN_MODULES_LOAD=y
BR2_PACKAGE_FINIT_PLUGIN_RTC=y
BR2_PACKAGE_FINIT_RTC_DATE="2024-11-04 10:54:00"
BR2_PACKAGE_FINIT_RTC_FILE="/var/lib/misc/rtc"
BR2_PACKAGE_FINIT_PLUGIN_TTY=y
BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y
BR2_PACKAGE_IITO=y
BR2_PACKAGE_KEYACK=y
BR2_PACKAGE_KLISH_PLUGIN_INFIX=y
BR2_PACKAGE_LANDING=y
BR2_PACKAGE_LOWDOWN=y
BR2_PACKAGE_MCD=y
BR2_PACKAGE_MDNS_ALIAS=y
BR2_PACKAGE_NETBROWSE=y
BR2_PACKAGE_PODMAN=y
BR2_PACKAGE_PODMAN_DRIVER_BTRFS=y
BR2_PACKAGE_PODMAN_DRIVER_DEVICEMAPPER=y
BR2_PACKAGE_PODMAN_DRIVER_VFS=y
BR2_PACKAGE_SHOW=y
BR2_PACKAGE_TETRIS=y
BR2_PACKAGE_ROUSETTE=y
BR2_PACKAGE_RAUC_INSTALLATION_STATUS=y
BR2_PACKAGE_HOST_PYTHON_YANGDOC=y
TRUSTED_KEYS=y
TRUSTED_KEYS_DEVELOPMENT=y
SDCARD_AUX=y
-10
View File
@@ -3,15 +3,6 @@ Change Log
All notable changes to the project are documented in this file.
[v25.07.0][UNRELEASED] -
-------------------------
### Changes
- Raspberry Pi 4 is now a part of the aarch64 image, as well as a SDcard
image for initial deployments.
### Fixes
[v25.06.0][] - 2025-07-01
-------------------------
@@ -1603,7 +1594,6 @@ Supported YANG models in addition to those used by sysrepo and netopeer:
- N/A
[buildroot]: https://buildroot.org/
[UNRELEASED]: https://github.com/kernelkit/infix/compare/v25.06.1...HEAD
[v25.06.0]: https://github.com/kernelkit/infix/compare/v25.05.1...v26.06.0
[v25.05.1]: https://github.com/kernelkit/infix/compare/v25.05.0...v25.05.1
[v25.05.0]: https://github.com/kernelkit/infix/compare/v25.04.0...v25.05.0
+1 -2
View File
@@ -67,8 +67,7 @@ $ sudo apt install bc binutils build-essential bzip2 cpio \
diffutils file findutils git gzip \
libncurses-dev libssl-dev perl patch \
python3 rsync sed tar unzip wget \
autopoint bison flex autoconf automake \
mtools
autopoint bison flex autoconf automake
```
> For details, see the Getting Started and System Requirements sections
-1
View File
@@ -6,6 +6,5 @@ source "$BR2_EXTERNAL_INFIX_PATH/package/board/marvell-cn9130-crb/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/board/marvell-espressobin/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/board/microchip-sparx5-pcb135/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/board/styx-dcp-sc-28p/Config.in"
source "$BR2_EXTERNAL_INFIX_PATH/package/board/raspberry-pi-4/Config.in"
endmenu
-41
View File
@@ -1,41 +0,0 @@
config BR2_PACKAGE_RASPBERRY_PI_4
bool "Raspberry Pi 4"
depends on BR2_aarch64
select BR2_PACKAGE_FEATURE_WIFI
select BR2_PACKAGE_BRCMFMAC_SDIO_FIRMWARE_RPI
select BR2_PACKAGE_BRCMFMAC_SDIO_FIRMWARE_RPI_WIFI
select BR2_PACKAGE_RPI_FIRMWARE
select BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4
select BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4_X
select SDCARD_AUX
select BR2_TARGET_UBOOT
select BR2_TARGET_UBOOT_FORMAT_CUSTOM
select BR2_TARGET_UBOOT_NEEDS_DTC
select BR2_TARGET_UBOOT_NEEDS_UBOOT_TOOLS
select BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
help
Raspberry pi 4
# Don't redefine - just set conditional defaults
if BR2_PACKAGE_RASPBERRY_PI_4
config BR2_TARGET_UBOOT_BOARD_DEFCONFIG
default "rpi_arm64"
config BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES
default "${BR2_EXTERNAL_INFIX_PATH}/board/common/uboot/extras.config ${BR2_EXTERNAL_INFIX_PATH}/src/board/raspberry-pi-4/uboot/extras.config"
config BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME
default "arch/arm/dts/infix-key.dtbo arch/arm/dts/rpi-env.dtbo"
config BR2_TARGET_UBOOT_CUSTOM_DTS_PATH
default "${BR2_EXTERNAL_INFIX_PATH}/src/board/raspberry-pi-4/uboot/rpi-env.dtso"
config BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE
default "${BR2_EXTERNAL_INFIX_PATH}/src/board/raspberry-pi-4/config.txt"
config BR2_PACKAGE_RPI_FIRMWARE_CMDLINE_FILE
default "${BR2_EXTERNAL_INFIX_PATH}/src/board/raspberry-pi-4/cmdline.txt"
endif
@@ -1,46 +0,0 @@
define RASPBERRY_PI_4_LINUX_CONFIG_FIXUPS
$(call KCONFIG_ENABLE_OPT,CONFIG_SND)
$(call KCONFIG_ENABLE_OPT,CONFIG_SND_SOC)
$(call KCONFIG_ENABLE_OPT,CONFIG_COMMON_CLK_BCM2835)
$(call KCONFIG_ENABLE_OPT,CONFIG_CLK_RASPBERRYPI)
$(call KCONFIG_ENABLE_OPT,CONFIG_DRM)
$(call KCONFIG_SET_OPT,CONFIG_DRM_V3D,m)
$(call KCONFIG_SET_OPT,CONFIG_DRM_VC4,m)
$(call KCONFIG_ENABLE_OPT,CONFIG_DRM_VC4_HDMI_CEC)
$(call KCONFIG_ENABLE_OPT,CONFIG_DRM_LOAD_EDID_FIRMWARE)
$(call KCONFIG_ENABLE_OPT,CONFIG_FB)
$(call KCONFIG_ENABLE_OPT,CONFIG_DRM_FBDEV_EMULATION)
$(call KCONFIG_ENABLE_OPT,CONFIG_INPUT_TOUCHSCREEN)
$(call KCONFIG_SET_OPT,CONFIG_TOUCHSCREEN_EDT_FT5X06,m)
$(call KCONFIG_SET_OPT,CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN,m)
# RPI
$(call KCONFIG_ENABLE_OPT,CONFIG_ARCH_BCM)
$(call KCONFIG_ENABLE_OPT,CONFIG_ARCH_BCM2835)
$(call KCONFIG_ENABLE_OPT,CONFIG_ARCH_BRCMSTB)
$(call KCONFIG_ENABLE_OPT,CONFIG_BCM2835_MBOX)
$(call KCONFIG_ENABLE_OPT,CONFIG_BCM2835_WDT)
$(call KCONFIG_ENABLE_OPT,CONFIG_RASPBERRYPI_FIRMWARE)
$(call KCONFIG_ENABLE_OPT,CONFIG_PINCTRL_BCM2835)
$(call KCONFIG_ENABLE_OPT,CONFIG_GPIO_BCM2835)
$(call KCONFIG_SET_OPT,CONFIG_BRCMFMAC,m)
$(call KCONFIG_ENABLE_OPT,CONFIG_BRCMFMAC_SDIO)
$(call KCONFIG_ENABLE_OPT,CONFIG_I2C_BCM2835)
$(call KCONFIG_ENABLE_OPT,CONFIG_MMC_BCM2835)
$(call KCONFIG_ENABLE_OPT,CONFIG_MMC_SDHCI_IPROC)
$(call KCONFIG_ENABLE_OPT,CONFIG_BCM2711_THERMAL)
$(call KCONFIG_ENABLE_OPT,CONFIG_RASPBERRYPI_POWER)
$(call KCONFIG_ENABLE_OPT,CONFIG_SERIAL_8250)
$(call KCONFIG_ENABLE_OPT,CONFIG_SERIAL_8250_CONSOLE)
$(call KCONFIG_ENABLE_OPT,CONFIG_SERIAL_8250_BCM2835AUX)
$(call KCONFIG_ENABLE_OPT,CONFIG_SERIAL_8250_EXTENDED)
$(call KCONFIG_ENABLE_OPT,CONFIG_SERIAL_8250_SHARE_IRQ)
$(call KCONFIG_ENABLE_OPT,CONFIG_NET_VENDOR_BROADCOM)
$(call KCONFIG_ENABLE_OPT,CONFIG_BCMGENET)
endef
$(eval $(ix-board))
$(eval $(generic-package))
-13
View File
@@ -1,13 +0,0 @@
Copyright (c) 2025 The KernelKit Authors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-1
View File
@@ -1 +0,0 @@
dtb-y += broadcom/bcm2711-rpi-4-b.dtb
@@ -1,22 +0,0 @@
#include <arm64/broadcom/bcm2711-rpi-4-b.dts>
/ {
framebuffer@3e402000 {
compatible = "simple-framebuffer";
reg = <0x3e402000 0x1000>;
width = <800>;
height = <480>;
stride = <1600>;
format = "r5g6b5";
status = "okay";
};
chosen {
/* 8250 auxiliary UART instead of pl011 */
stdout-path = "serial1:115200n8";
infix {
/* Default admin user password: 'admin' */
factory-password-hash = "$5$mI/zpOAqZYKLC2WU$i7iPzZiIjOjrBF3NyftS9CCq8dfYwHwrmUK097Jca9A";
};
};
};
@@ -1,6 +0,0 @@
cat <<EOF
{
"name": "wifi0",
"type": "infix-if-type:wifi",
}
EOF
+2 -2
View File
@@ -97,7 +97,6 @@ filter_iface_ports()
for phy in $ifaces; do
found=""
for port in $ports; do
[ -d "/sys/class/net/${port}/wireless" ] && continue
if [ "$port" = "$phy" ]; then
found=true
break
@@ -148,6 +147,7 @@ ports=$(ip -d -j link show group port | jq -r '
# Remaining external interfaces not classified as switch ports
ifaces="$(filter_iface_ports "$phys_ifaces" "$ports")"
cat <<EOF
{
"ietf-interfaces:interfaces": {
@@ -193,7 +193,7 @@ cat <<EOF
}
$(for iface in $ifaces; do gen_iface_json "$iface"; done)
$(for iface in $ports; do gen_iface_json "$iface" "$bridge"; done)
]
]
EOF
if [ "$dhcp" = "true" ] && [ -n "$bridge" ]; then
cat <<EOF
+1
View File
@@ -78,6 +78,7 @@ PKG_CHECK_MODULES([jansson], [jansson >= 2.0.0])
PKG_CHECK_MODULES([libite], [libite >= 2.6.1])
PKG_CHECK_MODULES([sysrepo], [sysrepo >= 2.2.36])
PKG_CHECK_MODULES([libsrx], [libsrx >= 1.0.0])
PKG_CHECK_MODULES([libssl], [libssl >= 1.0.0])
# Control build with automake flags
AM_CONDITIONAL(CONTAINERS, [test "x$enable_containers" != "xno"])
+3 -1
View File
@@ -12,6 +12,7 @@ confd_plugin_la_CFLAGS = \
$(libite_CFLAGS) \
$(sysrepo_CFLAGS) \
$(libsrx_CFLAGS) \
$(libssl_CFLAGS) \
$(CFLAGS)
confd_plugin_la_LIBADD = \
@@ -20,7 +21,8 @@ confd_plugin_la_LIBADD = \
$(jansson_LIBS) \
$(libite_LIBS) \
$(sysrepo_LIBS) \
$(libsrx_LIBS)
$(libsrx_LIBS) \
$(libssl_LIBS)
confd_plugin_la_SOURCES = \
base64.c base64.h \
+120 -25
View File
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: BSD-3-Clause */
#include <srx/common.h>
#include <srx/lyx.h>
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <sys/statvfs.h>
#include "core.h"
#include "rauc-installer.h"
@@ -21,24 +24,111 @@ static RaucInstaller *infix_system_sw_new_rauc(void)
return rauc;
}
static int base64_decode_inplace(char *input, size_t input_len, size_t *output_len)
{
BIO *bio, *b64;
int decode_len;
bio = BIO_new_mem_buf(input, input_len);
if (!bio) {
return -1;
}
b64 = BIO_new(BIO_f_base64());
if (!b64) {
BIO_free(bio);
return -1;
}
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
bio = BIO_push(b64, bio);
/* Decode directly into the same buffer */
decode_len = BIO_read(bio, input, input_len);
BIO_free_all(bio);
if (decode_len < 0) {
return -1;
}
*output_len = decode_len;
return 0;
}
static int infix_system_sw_install(sr_session_ctx_t *session, uint32_t sub_id,
const char *path, const sr_val_t *input,
const size_t input_cnt, sr_event_t event,
unsigned request_id, sr_val_t **output,
size_t *output_cnt, void *priv)
{
char *url = input->data.string_val;
sr_error_t srerr = SR_ERR_OK;
GError *raucerr = NULL;
RaucInstaller *rauc;
RaucInstaller *rauc = NULL;
char *install_source = NULL;
DEBUG("url:%s", url);
const char *url = NULL;
char *binary_data = NULL;
size_t binary_len = 0;
size_t decoded_len = 0;
for (size_t i = 0; i < input_cnt; i++) {
if (strcmp(input[i].xpath, "/infix-system:install-bundle/url") == 0) {
if (input[i].type == SR_STRING_T) {
url = input[i].data.string_val;
}
} else if (strcmp(input[i].xpath, "/infix-system:install-bundle/image") == 0) {
if (input[i].type == SR_BINARY_T) {
binary_data = (char *)input[i].data.binary_val; // Cast away const for in-place decode
binary_len = strlen(binary_data); // Length of base64 string
}
}
}
if (url) {
DEBUG("Installing from URL: %s", url);
install_source = (char *)url;
} else if (binary_data) {
const char *temp_dir = "/tmp";
char path[256];
FILE *fp;
DEBUG("Installing from uploaded binary data (%zu bytes base64)", binary_len);
if (base64_decode_inplace(binary_data, binary_len, &decoded_len) != 0) {
sr_session_set_netconf_error(session, "application", "invalid-value",
NULL, NULL, "Failed to decode base64 image data", 0);
srerr = SR_ERR_INVAL_ARG;
goto cleanup;
}
fmkpath(0775, "%s/images", temp_dir);
snprintf(path, sizeof(path), "%s/images/install_bundle", temp_dir);
fp = fopen(path, "wb");
if (!fp) {
ERROR("Could not open %s", path);
return SR_ERR_NO_MEMORY;
}
fwrite(binary_data, sizeof(char), decoded_len, fp);
fclose(fp);
install_source = path;
} else {
ERROR("Unknown source");
return 0;
}
rauc = infix_system_sw_new_rauc();
if (!rauc)
return SR_ERR_INTERNAL;
if (!rauc) {
sr_session_set_netconf_error(session, "application", "operation-failed",
NULL, NULL, "Failed to initialize RAUC installer", 0);
srerr = SR_ERR_INTERNAL;
goto cleanup;
}
rauc_installer_call_install_sync(rauc, url, NULL, &raucerr);
rauc_installer_call_install_sync(rauc, install_source, NULL, &raucerr);
if (raucerr) {
sr_session_set_netconf_error(session, "application", "operation-failed",
NULL, NULL, raucerr->message, 0);
@@ -46,13 +136,18 @@ static int infix_system_sw_install(sr_session_ctx_t *session, uint32_t sub_id,
srerr = SR_ERR_OPERATION_FAILED;
}
g_object_unref(rauc);
cleanup:
if (rauc) {
g_object_unref(rauc);
}
return srerr;
}
/*
boot order can only be: primary, secondary and net, limited by model
*/
*/
static int infix_system_sw_set_boot_order(sr_session_ctx_t *session, uint32_t sub_id,
const char *path, const sr_val_t *input,
const size_t input_cnt, sr_event_t event,
@@ -63,24 +158,24 @@ static int infix_system_sw_set_boot_order(sr_session_ctx_t *session, uint32_t su
const sr_val_t *val = &input[i];
if (i != 0)
strlcat(boot_order, " ", sizeof(boot_order));
strlcat(boot_order, val->data.string_val, sizeof(boot_order));
}
strlcat(boot_order, " ", sizeof(boot_order));
strlcat(boot_order, val->data.string_val, sizeof(boot_order));
}
if (fexist("/sys/firmware/devicetree/base/chosen/u-boot,version")) {
if (systemf("fw_setenv BOOT_ORDER %s", boot_order)) {
ERROR("Set-boot-order: Failed to set boot order in U-Boot");
return SR_ERR_INTERNAL;
}
} else if (fexist("/mnt/aux/grub/grubenv")) {
if (systemf("grub-editenv /mnt/aux/grub/grubenv set ORDER=\"%s\"", boot_order)) {
ERROR("Set-boot-order: Failed to set boot order in Grub");
return SR_ERR_INTERNAL;
}
} else {
ERROR("No supported boot loader found");
return SR_ERR_UNSUPPORTED;
}
if (fexist("/sys/firmware/devicetree/base/chosen/u-boot,version")) {
if (systemf("fw_setenv BOOT_ORDER %s", boot_order)) {
ERROR("Set-boot-order: Failed to set boot order in U-Boot");
return SR_ERR_INTERNAL;
}
} else if (fexist("/mnt/aux/grub/grubenv")) {
if (systemf("grub-editenv /mnt/aux/grub/grubenv set ORDER=\"%s\"", boot_order)) {
ERROR("Set-boot-order: Failed to set boot order in Grub");
return SR_ERR_INTERNAL;
}
} else {
ERROR("No supported boot loader found");
return SR_ERR_UNSUPPORTED;
}
return SR_ERR_OK;
}
@@ -204,16 +204,42 @@ submodule infix-system-software {
description
"Upgrade the system's software by installing the specified bundle.";
input {
leaf url {
type string;
choice source {
mandatory true;
description
"The location of the software bundle, specified as a Uniform
Resource Locator (URL). Currently supported protocols include
FTP, HTTP(S) and SCP.";
"Source of the software bundle to install.";
case url {
leaf url {
type string;
description
"The location of the software bundle, specified as a Uniform
Resource Locator (URL). Currently supported protocols include
FTP, HTTP(S) and SCP.";
}
}
case upload {
leaf image {
type binary;
description
"The image data to install, provided as base64-encoded binary data.";
}
}
}
}
}
rpc install-upload-bundle {
nacm:default-deny-all;
description "Upgrade the system's software by installing from a supplied blob.";
input {
leaf image {
type binary;
mandatory true;
description "The image to install";
}
}
}
rpc set-boot-order {
nacm:default-deny-all;
description