diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69e2784d6..11a4f9b39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,39 +15,52 @@ on: jobs: build: if: github.event.review.state == 'approved' || github.event_name == 'workflow_dispatch' - name: Build ${{ matrix.platform }} + name: Build ${{ matrix.platform }} ${{ matrix.variant }} runs-on: ubuntu-latest strategy: matrix: - platform: [aarch64, amd64] + platform: [aarch64, x86_64] + variant: [netconf, classic] fail-fast: false steps: - uses: actions/checkout@v3 - name: Set Build Variables id: vars run: | - echo "dir=infix-${{ matrix.platform }}" >> $GITHUB_OUTPUT - echo "tgz=infix-${{ matrix.platform }}.tar.gz" >> $GITHUB_OUTPUT + if [ "${{ matrix.variant }}" = "netconf" ]; then + target=${{ matrix.platform }} + else + target=${{ matrix.platform }}-${{ matrix.variant }} + fi + echo "dir=infix-$target" >> $GITHUB_OUTPUT + echo "tgz=infix-$target.tar.gz" >> $GITHUB_OUTPUT - name: Restore Cache of dl/ uses: actions/cache@v3 with: path: dl/ - key: dl-${{ matrix.platform }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }} + key: dl-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }} restore-keys: | + dl-${{ matrix.platform }}-${{ matrix.variant }}- dl-${{ matrix.platform }}- dl- - name: Restore Cache of .ccache/ uses: actions/cache@v3 with: - path: .buildroot-ccache/ - key: ccache-${{ matrix.board }}-os-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }} + path: .ccache/ + key: ccache-${{ matrix.platform }}-${{ matrix.variant }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }} restore-keys: | - ccache-${{ matrix.board }}-os- - ccache-${{ matrix.board }}- - ccache--os- + ccache-${{ matrix.platform }}-${{ matrix.variant }}- + ccache-${{ matrix.platform }}- + ccache- - name: Configure & Build run: | - make ${{ matrix.platform }}_defconfig + if [ "${{ matrix.variant }}" = "netconf" ]; then + target=${{ matrix.platform }}_defconfig + else + target=${{ matrix.platform }}_${{ matrix.variant }}_defconfig + fi + echo "Buildring $target ..." + make $target make - name: Prepare Artifact run: | diff --git a/Config.in b/Config.in index 2fbcb2429..e0926cbd9 100644 --- a/Config.in +++ b/Config.in @@ -1,3 +1,31 @@ +# For /etc/os-release, uses CondtionArchitechture= from systemd.unit(5) +config INFIX_ARCH + string + default "arm" if BR2_arm + default "arm64" if BR2_aarch64 + default "mips64" if BR2_mips64 + default "riscv64" if BR2_riscv + default "x86_64" if BR2_x86_64 + +# For /etc/os-release, VARIANT & VARIANT_ID used, e.g., in mnt script +choice + prompt "Select variant/flavor" + default INFIX_VARIANT_NETCONF + +config INFIX_VARIANT_NETCONF + bool "NETCONF" + help + Managed NETCONF mode, /etc is a ramdisk, all configuration is + generated by sysrepo plugins using NETCONF (xml) or RESTCONF. + +config INFIX_VARIANT_CLASSIC + bool "Classic /etc mode" + help + User managed mode, read-write configuration files in /etc that + is saved across reboots. + +endchoice + menu "Packages" source "$BR2_EXTERNAL_INFIX_PATH/package/Config.in" diff --git a/README.md b/README.md index 581ea1ea0..7ab105fad 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ may enable additional boards in the config, of course): See the aarch64 specific [documentation](board/aarch64/README.md) for more information. -### amd64 +### x86_64 Primarily intended to be run under [QEMU][] for development & test as well as evaluation, demo and [training][] purposes, e.g. using [GNS3][] @@ -59,10 +59,12 @@ under `External options -> QEMU virtualization`. GNS3 ---- -Download the [latest build][0] of amd64, unpack in a dedicated directory -and use ["Import Appliance"][9] to install the `.gns3a` file into GNS3. -Infix will show up in the "Router" category, it has 10 interfaces -available by default for use as switch ports or routing. +Download the [latest build][0] of the `x86_64`, or `x86_64_classic` +flavor. Unpack in a dedicated directory and use ["Import Appliance"][9] +to install the `.gns3a` file into GNS3. Infix (`x86_64`) is in the +"Router" category, it has 10 interfaces available by default for use as +switch ports or routing. The *classic* build only has one interface by +default, geared more towards acting as an end device. Building @@ -70,9 +72,10 @@ Building Buildroot is almost stand-alone, but need a few locally installed tools to bootstrap itself. For details, see the [excellent manual][manual]. + Briefly, to build an Infix image; select the target and then make: - make amd64_defconfig + make x86_64_defconfig make Online help is available: diff --git a/board/classic/post-build.sh b/board/classic/post-build.sh new file mode 100755 index 000000000..b668c0b2b --- /dev/null +++ b/board/classic/post-build.sh @@ -0,0 +1,8 @@ +#!/bin/sh +. "$BR2_CONFIG" + +# Prevent regen of host key at every boot, /etc is saved across reboots +if [ -L "$TARGET_DIR/etc/dropbear" ]; then + rm "$TARGET_DIR/etc/dropbear" + mkdir "$TARGET_DIR/etc/dropbear" +fi diff --git a/board/common/rootfs/bin/help b/board/classic/rootfs/bin/help similarity index 100% rename from board/common/rootfs/bin/help rename to board/classic/rootfs/bin/help diff --git a/board/common/rootfs/bin/hostnm b/board/classic/rootfs/bin/hostnm similarity index 100% rename from board/common/rootfs/bin/hostnm rename to board/classic/rootfs/bin/hostnm diff --git a/board/classic/rootfs/bin/setup b/board/classic/rootfs/bin/setup new file mode 100755 index 000000000..107a6e856 --- /dev/null +++ b/board/classic/rootfs/bin/setup @@ -0,0 +1,3 @@ +#!/bin/sh +pdmenu +clear diff --git a/board/common/rootfs/bin/show b/board/classic/rootfs/bin/show similarity index 98% rename from board/common/rootfs/bin/show rename to board/classic/rootfs/bin/show index 29683e8ff..6c69adfca 100755 --- a/board/common/rootfs/bin/show +++ b/board/classic/rootfs/bin/show @@ -215,10 +215,10 @@ system() { h1 "SYSTEM INFORMATION" echo "System Name : $(uname -n)" - echo "System Boot Mode : $(cat /tmp/.boot_mode)" + echo "System Variant : $VARIANT" echo "System Description : $PRETTY_NAME" echo "System Contact : $HOME_URL" - echo "System Timezone : $TZ" + echo "System Timezone : $(cat /etc/timezone)" echo "System Type : $NAME" echo "System Version : $(cat /etc/version)" echo "System Arch : $(uname -m)" diff --git a/board/common/rootfs/bin/yorn b/board/classic/rootfs/bin/yorn similarity index 100% rename from board/common/rootfs/bin/yorn rename to board/classic/rootfs/bin/yorn diff --git a/board/classic/rootfs/etc/finit.d/20-infix-classic.conf b/board/classic/rootfs/etc/finit.d/20-infix-classic.conf new file mode 100644 index 000000000..7e3a18a00 --- /dev/null +++ b/board/classic/rootfs/etc/finit.d/20-infix-classic.conf @@ -0,0 +1 @@ +run [S] /lib/infix/swup -- diff --git a/board/common/rootfs/etc/mdev.conf b/board/classic/rootfs/etc/mdev.conf similarity index 100% rename from board/common/rootfs/etc/mdev.conf rename to board/classic/rootfs/etc/mdev.conf diff --git a/board/common/rootfs/etc/motd b/board/classic/rootfs/etc/motd similarity index 100% rename from board/common/rootfs/etc/motd rename to board/classic/rootfs/etc/motd diff --git a/board/common/rootfs/etc/network/interfaces b/board/classic/rootfs/etc/network/interfaces similarity index 100% rename from board/common/rootfs/etc/network/interfaces rename to board/classic/rootfs/etc/network/interfaces diff --git a/board/common/rootfs/etc/network/interfaces.d/.empty b/board/classic/rootfs/etc/network/interfaces.d/.empty similarity index 100% rename from board/common/rootfs/etc/network/interfaces.d/.empty rename to board/classic/rootfs/etc/network/interfaces.d/.empty diff --git a/board/classic/rootfs/etc/network/interfaces.d/eth0 b/board/classic/rootfs/etc/network/interfaces.d/eth0 new file mode 100644 index 000000000..030e443c3 --- /dev/null +++ b/board/classic/rootfs/etc/network/interfaces.d/eth0 @@ -0,0 +1,3 @@ +auto eth0 +iface eth0 inet dhcp + pre-up ip link set eth0 group iface diff --git a/board/common/rootfs/etc/pdmenurc b/board/classic/rootfs/etc/pdmenurc similarity index 95% rename from board/common/rootfs/etc/pdmenurc rename to board/classic/rootfs/etc/pdmenurc index 2df7541f3..399bdcc78 100644 --- a/board/common/rootfs/etc/pdmenurc +++ b/board/classic/rootfs/etc/pdmenurc @@ -60,8 +60,7 @@ menu:system:System:System Settings exec:_Enable service:edit:initctl enable ~Enter name of service (filename) to enable:~ exec:_Disable service:edit:initctl disable ~Enter name of service (filename) to disable:~ nop - exec:_Change Operating Mode::chom - exec:_Factory Reset::yorn "Reboot and factory reset device, are you sure?" factory -y + exec:_Factory Reset::yorn "Factory reset device (reboots), are you sure?" factory -y nop exit:_Main menu.. diff --git a/board/common/rootfs/etc/rc.local b/board/classic/rootfs/etc/rc.local similarity index 100% rename from board/common/rootfs/etc/rc.local rename to board/classic/rootfs/etc/rc.local diff --git a/board/common/rootfs/lib/infix/swup b/board/classic/rootfs/lib/infix/swup similarity index 85% rename from board/common/rootfs/lib/infix/swup rename to board/classic/rootfs/lib/infix/swup index 0b699c832..d23ba44aa 100755 --- a/board/common/rootfs/lib/infix/swup +++ b/board/classic/rootfs/lib/infix/swup @@ -1,10 +1,4 @@ #!/bin/sh -# Only runs in native /etc and PROFINET nodes. - -if initctl cond get boot/profinet; then - initctl enable snmpd - initctl disable lldpd -fi # Factory default: all switch ports in VLAN 1 of br0 # need to check for 'length > 0' because ip command diff --git a/board/common/Config.in b/board/common/Config.in index 3b16f19f7..c9fcf3802 100644 --- a/board/common/Config.in +++ b/board/common/Config.in @@ -18,15 +18,6 @@ config SIGN_KEY comment "Additional Artifacts" -# For /etc/os-release, uses CondtionArchitechture= from systemd.unit(5) -config INFIX_ARCH - string - default "arm" if BR2_arm - default "arm64" if BR2_aarch64 - default "mips64" if BR2_mips64 - default "riscv64" if BR2_riscv - default "x86_64" if BR2_x86_64 - menuconfig DISK_IMAGE bool "Disk image" help @@ -43,13 +34,15 @@ config DISK_IMAGE_SIZE depends on DISK_IMAGE default "512M" help - Create a disk image of this size. Suffixes like K/M/G may be - used to multiply by powers of 1024. Suffixes like KB/MB/GB may - be used to multiply by powers of 1000. + Create a disk image of this size. A K/M/G suffix may be used + to multiply by powers of 1024. Suffixes like KB/MB/GB may be + used to multiply by powers of 1000. The image will be split + proportionally to fit the two rootfs, a kernel, a writable + /cfg and /var partiotions. Minimum supported size is 512M. -config GNS3_APPLIANCE +menuconfig GNS3_APPLIANCE bool "GNS3 Appliance" select DISK_IMAGE default y if BR2_x86_64 @@ -57,6 +50,22 @@ config GNS3_APPLIANCE Create a GNS3 appliance description that, together with the disk image, can be imported into GNS3. +config GNS3_APPLIANCE_RAM + int "Reserved RAM (MiB)" + depends on GNS3_APPLIANCE + default "192" + help + Amount of host RAM reserved for an appliance instance. + + Minimum supported size is 192M. + +config GNS3_APPLIANCE_IFNUM + int "Number of interfaces" + depends on GNS3_APPLIANCE + default "1" + help + Number of Ethernet interfaces to create for an appliance instance. + menuconfig FIT_IMAGE bool "Traditional FIT image" help diff --git a/board/common/mkdisk.sh b/board/common/mkdisk.sh index e2c5a89c9..556e8c439 100755 --- a/board/common/mkdisk.sh +++ b/board/common/mkdisk.sh @@ -17,7 +17,6 @@ size2int() dimension() { - if [ $total -ge $((4 << G)) ]; then bootsize=$(( 8 << M)) auxsize=$(( 8 << M)) @@ -161,24 +160,24 @@ cp -f $BINARIES_DIR/rootfs.itbh $root/aux/secondary.itbh case "$arch" in aarch64) - mkenvimage -s 0x4000 -o $root/aux/uboot.env \ - $BR2_EXTERNAL_INFIX_PATH/board/common/uboot/aux-env.txt + mkenvimage -s 0x4000 -o "$root/aux/uboot.env" \ + "$BR2_EXTERNAL_INFIX_PATH/board/common/uboot/aux-env.txt" ;; x86_64) - mkdir -p $root/aux/grub - cp -f $BR2_EXTERNAL_INFIX_PATH/board/amd64/grub.cfg \ - $BR2_EXTERNAL_INFIX_PATH/board/amd64/grubenv \ - $root/aux/grub/ + mkdir -p "$root/aux/grub" + cp -f "$BR2_EXTERNAL_INFIX_PATH/board/$arch/grub.cfg" \ + "$BR2_EXTERNAL_INFIX_PATH/board/$arch/grubenv" \ + "$root/aux/grub/" ;; *) ;; esac -rm -rf $tmp +rm -rf "$tmp" genimage \ - --rootpath $root \ - --tmppath $tmp \ - --inputpath $BINARIES_DIR \ - --outputpath $BINARIES_DIR \ - --config $root/genimage.cfg + --rootpath "$root" \ + --tmppath "$tmp" \ + --inputpath "$BINARIES_DIR" \ + --outputpath "$BINARIES_DIR" \ + --config "$root/genimage.cfg" diff --git a/board/common/mkgns3a.sh b/board/common/mkgns3a.sh index cbf7a7903..361c87b8a 100755 --- a/board/common/mkgns3a.sh +++ b/board/common/mkgns3a.sh @@ -1,8 +1,12 @@ #!/bin/sh -cat <"$BINARIES_DIR/infix.gns3a" +NM="infix-${1:-custom}" +RAM=${2:-512} +IFNUM=${3:-1} + +cat <"$BINARIES_DIR/${NM}.gns3a" { - "name": "infix", + "name": "$NM", "category": "router", "description": "Infix is a Network Operating System based on Linux. It can be set up both as a switch, with offloading using switchdev, and a router with firewalling.", "vendor_name": "KernelKit", @@ -12,13 +16,13 @@ cat <"$BINARIES_DIR/infix.gns3a" "status": "stable", "maintainer": "KernelKit", "maintainer_email": "kernelkit@googlegroups.com", - "usage": "Default login is 'root', no password.\n\nType 'help' for an overview of commands and relevant configuration files.\n\nThe /etc directory is writable, use the passwd tool after login as part of your set up.\nFor networking, classify interfaces as switchports with /etc/mactab, syntax: 'MAC-address eN', where N is the port number (1-MAX).\nTo set up bridging and management interfaces, use /etc/network/interfaces, and /etc/network/interfaces.d/", + "usage": "Default console login is 'root', no password. For remote login, default user/pass: admin/admin also works.\n\nType 'help' for an overview of commands and relevant configuration files.\n\nThe /etc directory is writable, use the passwd tool after login as part of your set up.\nFor networking, classify interfaces as switchports with /etc/mactab, syntax: 'MAC-address eN', where N is the port number (1-MAX).\nTo set up bridging and management interfaces, use /etc/network/interfaces, and /etc/network/interfaces.d/", "port_name_format": "eth{0}", "linked_clone": true, "qemu": { "adapter_type": "virtio-net-pci", - "adapters": 10, - "ram": 512, + "adapters": ${IFNUM}, + "ram": ${RAM}, "cpus": 1, "hda_disk_interface": "virtio", "arch": "x86_64", diff --git a/board/common/post-build.sh b/board/common/post-build.sh index 626ecbf40..7bad26c6b 100755 --- a/board/common/post-build.sh +++ b/board/common/post-build.sh @@ -11,17 +11,25 @@ GIT_VERSION=$(git -C $BR2_EXTERNAL_INFIX_PATH describe --always --dirty --tags) # original Buildroot information. rm "$TARGET_DIR/etc/os-release" { - echo "NAME=\"Infix\"" - echo "VERSION=${GIT_VERSION}" - echo "ID=infix" - echo "ID_LIKE=\"${ID}\"" - echo "VERSION_ID=${GIT_VERSION}" - echo "BUILD_ID=\"${NAME} ${VERSION}\"" - echo "PRETTY_NAME=\"Infix by KernelKit\"" - echo "ARCHITECTURE=\"${INFIX_ARCH}\"" - echo "HOME_URL=https://github.com/KernelKit" + echo "NAME=\"Infix\"" + echo "VERSION=${GIT_VERSION}" + echo "ID=infix" + echo "ID_LIKE=\"${ID}\"" + echo "VERSION_ID=${GIT_VERSION}" + echo "BUILD_ID=\"${NAME} ${VERSION}\"" + echo "PRETTY_NAME=\"Infix by KernelKit\"" + if [ "$INFIX_VARIANT_NETCONF" = "y" ]; then + echo "VARIANT=\"Managed NETCONF\"" + echo "VARIANT_ID=netconf" + else + echo "VARIANT=\"Classic, writable /etc\"" + echo "VARIANT_ID=classic" + fi + echo "ARCHITECTURE=\"${INFIX_ARCH}\"" + echo "HOME_URL=https://github.com/KernelKit" } > "$TARGET_DIR/etc/os-release" + echo "Infix by KernelKit $GIT_VERSION -- $(date +"%b %e %H:%M %Z %Y")" > "$TARGET_DIR/etc/version" # Allow pdmenu (setup) to be a login shell diff --git a/board/common/post-image.sh b/board/common/post-image.sh index 2780a4be6..45c655f78 100755 --- a/board/common/post-image.sh +++ b/board/common/post-image.sh @@ -15,15 +15,19 @@ ixmsg "Creating RAUC Update Bundle" $common/mkrauc.sh $BR2_ARCH $SIGN_KEY load_cfg DISK_IMAGE +load_cfg DISK_IMAGE_SIZE if [ "$DISK_IMAGE" = "y" ]; then ixmsg "Creating Disk Image" - $common/mkdisk.sh -a $BR2_ARCH + $common/mkdisk.sh -a $BR2_ARCH -s $DISK_IMAGE_SIZE fi load_cfg GNS3_APPLIANCE if [ "$GNS3_APPLIANCE" = "y" ]; then - ixmsg "Creating GNS3 Appliance" - $common/mkgns3a.sh + load_cfg GNS3_APPLIANCE_RAM + load_cfg GNS3_APPLIANCE_IFNUM + load_cfg BR2_DEFCONFIG + ixmsg "Creating GNS3 Appliance, $GNS3_APPLIANCE_RAM MiB with $GNS3_APPLIANCE_IFNUM ports" + $common/mkgns3a.sh $(basename $BR2_DEFCONFIG _defconfig | tr _ -) $GNS3_APPLIANCE_RAM $GNS3_APPLIANCE_IFNUM fi load_cfg FIT_IMAGE diff --git a/board/common/rootfs/bin/chom b/board/common/rootfs/bin/chom deleted file mode 100755 index c8cf3c20b..000000000 --- a/board/common/rootfs/bin/chom +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/sh -#set -x - -mode=/mnt/cfg/infix/.use_etc -boot=/tmp/.boot_mode -if [ -f $boot ]; then - current=$(cat $boot) -else - current="unknown" -fi -m=on -n=off -p=off - -select_mode() -{ - if [ -f $mode ]; then - m=off - if grep -qi profinet $boot; then - n=off - p=on - else - n=on - p=off - fi - fi - - exec 3>&1 - selection=$(dialog --erase-on-exit --no-tags \ - --hline "Arrow keys + space to select, enter to confirm" \ - --backtitle "Select Operating Mode" \ - --title "Select Operating Mode" \ - --radiolist "System currently runs in: $current mode" 13 60 1 \ - "1" "Managed NETCONF, XML datastore" "$m" \ - "2" "Native Linux, /etc datastore" "$n" \ - "3" "PROFINET, /etc variant" "$p" \ - 2>&1 1>&3) - exit_status=$? - exec 3>&- - case $exit_status in - 1) # cancel - exit 0 - ;; - 255) # escape - exit 1 - ;; - esac -} - -usage() -{ - cat </dev/null - grep -qi netconf $boot 2>/dev/null && exit 0 - result="Manageed NETCONF" - ;; - 2) - echo "native /etc" > $mode - grep -qi native $boot 2>/dev/null && exit 0 - result="Native Linux, /etc" - ;; - 3) - echo "PROFINET" > $mode - grep -qi profinet $boot 2>/dev/null && exit 0 - result="PROFINET" - ;; -esac - -if [ -n "$use_dialog" ]; then - dialog --erase-on-exit --cr-wrap --title "Activate Mode Change?" --yesno "\n Reboot to $result mode now?" 8 50 - if [ $? -eq 0 ]; then - reboot - fi -fi - -echo "Remember to reboot later to activate the change." -exit 0 diff --git a/board/common/rootfs/etc/bash.bashrc b/board/common/rootfs/etc/bash.bashrc index f5f7f66a4..e934fc5c2 100644 --- a/board/common/rootfs/etc/bash.bashrc +++ b/board/common/rootfs/etc/bash.bashrc @@ -3,6 +3,13 @@ # If not running interactively, don't do anything [ -z "$PS1" ] && return +# Reevaluate for each line, in case hostname changes +function prompt_command +{ + PS1="\u@$(hostname):\w\$ " +} +export PROMPT_COMMAND=prompt_command + # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize diff --git a/board/common/rootfs/etc/finit.d/10-infix.conf b/board/common/rootfs/etc/finit.d/10-infix.conf index 286c955af..73e2b8244 100644 --- a/board/common/rootfs/etc/finit.d/10-infix.conf +++ b/board/common/rootfs/etc/finit.d/10-infix.conf @@ -1,2 +1 @@ run [S] /lib/infix/nameif -- Probing network interfaces -run if: [S] /lib/infix/swup -- diff --git a/board/common/rootfs/etc/profile.d/convenience.sh b/board/common/rootfs/etc/profile.d/convenience.sh index e27fc5c51..72509b179 100644 --- a/board/common/rootfs/etc/profile.d/convenience.sh +++ b/board/common/rootfs/etc/profile.d/convenience.sh @@ -15,5 +15,4 @@ alias ipb='ip -br' alias ipaddr='ip addr' alias iplink='ip link' alias bridge='bridge --color=auto' -alias setup='pdmenu; clear' alias cli='klish' diff --git a/board/common/rootfs/etc/ssh/sshd_config.d/cli.conf b/board/common/rootfs/etc/ssh/sshd_config.d/cli.conf index 812f8d16e..6946e76b9 100644 --- a/board/common/rootfs/etc/ssh/sshd_config.d/cli.conf +++ b/board/common/rootfs/etc/ssh/sshd_config.d/cli.conf @@ -1 +1 @@ -Subsystem cli /usr/bin/clixon_cli +Subsystem cli /usr/bin/klish diff --git a/board/common/rootfs/lib/infix/mnt b/board/common/rootfs/lib/infix/mnt index d9d186066..bded7c640 100755 --- a/board/common/rootfs/lib/infix/mnt +++ b/board/common/rootfs/lib/infix/mnt @@ -1,5 +1,4 @@ #!/bin/sh - # Called from /etc/fstab to ensure we have something writable mounted # at /cfg, /etc, /home, /root, and /var. # @@ -14,6 +13,7 @@ # directories. Otherwise fall back to a tmpfs based RAM disk. This # effectively brings up the system with the default configuration, but # obviously any subsequent configuration is ephemeral. +. /etc/os-release set -e @@ -88,7 +88,8 @@ else sync fi - if /lib/infix/use-etc; then + # Check build: NETCONF or Classic + if [ "$VARIANT_ID" != "netconf" ]; then etcsrc=/mnt/cfg fi diff --git a/board/common/rootfs/lib/infix/use-etc b/board/common/rootfs/lib/infix/use-etc deleted file mode 100755 index 7364d03bf..000000000 --- a/board/common/rootfs/lib/infix/use-etc +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -if [ -f /mnt/cfg/infix/.use_etc ]; then - exit 0 -fi - -# Finit's condition system may not yet be bootstrapped when this script -# is called, e.g., when /etc/fstab is parsed, so we have to manually -# check for the boot/etc condition. -awk ' - $0 == "finit.cond" { - cond=1; - next; - } - cond == 1 { - use_etc = index($0, "etc") != 0; - } - END { - exit(use_etc ? 0 : 1); - } -' /proc/1/cmdline diff --git a/board/common/rootfs/libexec/finit/hook/mount/all/boot-mode.sh b/board/common/rootfs/libexec/finit/hook/mount/all/boot-mode.sh deleted file mode 100755 index da0e90e2a..000000000 --- a/board/common/rootfs/libexec/finit/hook/mount/all/boot-mode.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# Override boot mode based on user input from setup tool - -set_cond() -{ - mkdir -p /run/finit/cond/boot - ln -s /run/finit/cond/reconf "/run/finit/cond/boot/$1" -} - -# Report to the setup and show tools the current boot mode -if /lib/infix/use-etc; then - if [ -f /mnt/cfg/infix/.use_etc ]; then - cat /mnt/cfg/infix/.use_etc > /tmp/.boot_mode - if grep -qi profinet /mnt/cfg/infix/.use_etc; then - set_cond profinet - else - set_cond etc - fi - else - echo "native /etc" > /tmp/.boot_mode - set_cond etc - fi -else - echo "NETCONF" > /tmp/.boot_mode - set_cond netconf -fi diff --git a/board/common/users b/board/common/users index 51ba51179..e57dbddcd 100644 --- a/board/common/users +++ b/board/common/users @@ -1,3 +1,2 @@ -clicon -1 clicon -1 * - - wheel Clixon backend -factory -1 wheel -1 =reset - /sbin/factory - Reset to factory defaults -www-data -1 www-data -1 * - - clicon www-data +admin -1 wheel -1 =admin /home/admin /bin/bash - Administrator +factory -1 wheel -1 =reset - /sbin/factory - Reset to factory defaults diff --git a/board/netconf/post-build.sh b/board/netconf/post-build.sh new file mode 100755 index 000000000..a5beb06a0 --- /dev/null +++ b/board/netconf/post-build.sh @@ -0,0 +1,8 @@ +#!/bin/sh +. "$BR2_CONFIG" + +# Drop Buildroot default symlink to /tmp +if [ -L "$TARGET_DIR/var/lib/avahi-autoipd" ]; then + rm "$TARGET_DIR/var/lib/avahi-autoipd" + mkdir "$TARGET_DIR/var/lib/avahi-autoipd" +fi diff --git a/board/netconf/rootfs/.empty b/board/netconf/rootfs/.empty new file mode 100644 index 000000000..e69de29bb diff --git a/board/netconf/xattrs b/board/netconf/xattrs new file mode 100644 index 000000000..dbe17d746 --- /dev/null +++ b/board/netconf/xattrs @@ -0,0 +1 @@ +/var/lib/avahi-autoipd d 0755 avahi avahi - - - - - diff --git a/board/amd64/genimage.cfg b/board/x86_64/genimage.cfg similarity index 100% rename from board/amd64/genimage.cfg rename to board/x86_64/genimage.cfg diff --git a/board/amd64/grub-embed.cfg b/board/x86_64/grub-embed.cfg similarity index 100% rename from board/amd64/grub-embed.cfg rename to board/x86_64/grub-embed.cfg diff --git a/board/amd64/grub.cfg b/board/x86_64/grub.cfg similarity index 100% rename from board/amd64/grub.cfg rename to board/x86_64/grub.cfg diff --git a/board/amd64/grubenv b/board/x86_64/grubenv similarity index 100% rename from board/amd64/grubenv rename to board/x86_64/grubenv diff --git a/board/amd64/isolinux.cfg b/board/x86_64/isolinux.cfg similarity index 100% rename from board/amd64/isolinux.cfg rename to board/x86_64/isolinux.cfg diff --git a/board/amd64/linux_defconfig b/board/x86_64/linux_defconfig similarity index 100% rename from board/amd64/linux_defconfig rename to board/x86_64/linux_defconfig diff --git a/board/amd64/rootfs/boot/grub/grub.cfg b/board/x86_64/rootfs/boot/grub/grub.cfg similarity index 100% rename from board/amd64/rootfs/boot/grub/grub.cfg rename to board/x86_64/rootfs/boot/grub/grub.cfg diff --git a/board/amd64/rootfs/etc/rauc/system.conf b/board/x86_64/rootfs/etc/rauc/system.conf similarity index 100% rename from board/amd64/rootfs/etc/rauc/system.conf rename to board/x86_64/rootfs/etc/rauc/system.conf diff --git a/configs/aarch64_classic_defconfig b/configs/aarch64_classic_defconfig new file mode 100644 index 000000000..b1130986b --- /dev/null +++ b/configs/aarch64_classic_defconfig @@ -0,0 +1,110 @@ +BR2_aarch64=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="${BR2_EXTERNAL_INFIX_PATH}/patches" +BR2_TARGET_GENERIC_HOSTNAME="infix" +BR2_TARGET_GENERIC_ISSUE="Infix by KernelKit" +BR2_INIT_FINIT=y +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y +BR2_ROOTFS_DEVICE_TABLE="system/device_table.txt ${BR2_EXTERNAL_INFIX_PATH}/board/common/xattrs" +BR2_TARGET_GENERIC_GETTY_TERM="linux" +BR2_SYSTEM_DHCP="eth0" +BR2_ENABLE_LOCALE_WHITELIST="C en_US en_CA" +BR2_GENERATE_LOCALE="en_US en_CA" +BR2_TARGET_TZ_INFO=y +BR2_ROOTFS_USERS_TABLES="${BR2_EXTERNAL_INFIX_PATH}/board/common/users" +BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL_INFIX_PATH}/board/common/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/classic/rootfs" +BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build.sh ${BR2_EXTERNAL_INFIX_PATH}/board/classic/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.19.17" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/linux_defconfig" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="marvell/armada-3720-espressobin marvell/armada-3720-espressobin-emmc marvell/armada-3720-espressobin-v7 marvell/armada-3720-espressobin-v7-emmc marvell/armada-3720-espressobin-ultra marvell/cn9130-crb-A marvell/cn9130-crb-B sparx5_pcb135_emmc_no_psci" +BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/dts/microchip/sparx5_pcb135_emmc_no_psci.dts" +BR2_LINUX_KERNEL_INSTALL_TARGET=y +BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL_INFIX_PATH}/board/common/busybox_defconfig" +BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y +BR2_PACKAGE_JQ=y +BR2_PACKAGE_MDIO_TOOLS=y +BR2_PACKAGE_RNG_TOOLS=y +BR2_PACKAGE_UBOOT_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_LIBCURL_CURL=y +BR2_PACKAGE_NSS_MDNS=y +BR2_PACKAGE_ONIGURUMA=y +BR2_PACKAGE_AVAHI=y +# BR2_PACKAGE_AVAHI_AUTOIPD is not set +BR2_PACKAGE_AVAHI_DAEMON=y +BR2_PACKAGE_AVAHI_DEFAULT_SERVICES=y +BR2_PACKAGE_DHCPCD=y +BR2_PACKAGE_DNSMASQ=y +BR2_PACKAGE_DROPBEAR=y +BR2_PACKAGE_DROPBEAR_DISABLE_REVERSEDNS=y +BR2_PACKAGE_DROPBEAR_WTMP=y +BR2_PACKAGE_DROPBEAR_LASTLOG=y +BR2_PACKAGE_DROPBEAR_LEGACY_CRYPTO=y +BR2_PACKAGE_ETHTOOL=y +BR2_PACKAGE_FPING=y +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set +BR2_PACKAGE_IPROUTE2=y +BR2_PACKAGE_IPTABLES=y +BR2_PACKAGE_IPTABLES_NFTABLES=y +BR2_PACKAGE_LLDPD=y +BR2_PACKAGE_LYNX=y +BR2_PACKAGE_MTR=y +BR2_PACKAGE_NETCALC=y +BR2_PACKAGE_NFTABLES=y +BR2_PACKAGE_NMAP=y +BR2_PACKAGE_NMAP_NMAP=y +BR2_PACKAGE_NMAP_NPING=y +BR2_PACKAGE_OPENRESOLV=y +BR2_PACKAGE_SOCAT=y +BR2_PACKAGE_SSDP_RESPONDER=y +BR2_PACKAGE_TCPDUMP=y +BR2_PACKAGE_TRACEROUTE=y +BR2_PACKAGE_DIALOG=y +BR2_PACKAGE_PDMENU=y +BR2_PACKAGE_IRQBALANCE=y +BR2_PACKAGE_KMOD_TOOLS=y +BR2_PACKAGE_PWGEN=y +BR2_PACKAGE_RAUC=y +BR2_PACKAGE_RAUC_GPT=y +BR2_PACKAGE_RAUC_NETWORK=y +BR2_PACKAGE_SYSKLOGD=y +BR2_PACKAGE_SYSKLOGD_LOGGER=y +BR2_PACKAGE_WATCHDOGD=y +BR2_PACKAGE_MG=y +BR2_PACKAGE_MOST=y +BR2_PACKAGE_NANO=y +BR2_TARGET_ROOTFS_SQUASHFS=y +# BR2_TARGET_ROOTFS_TAR is not set +BR2_PACKAGE_HOST_E2FSPROGS=y +BR2_PACKAGE_HOST_ENVIRONMENT_SETUP=y +BR2_PACKAGE_HOST_GENEXT2FS=y +BR2_PACKAGE_HOST_GENIMAGE=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_VARIANT_CLASSIC=y +BR2_PACKAGE_FACTORY=y +BR2_PACKAGE_FINIT_SULOGIN=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_MODPROBE=y +BR2_PACKAGE_FINIT_PLUGIN_RTC=y +BR2_PACKAGE_FINIT_PLUGIN_TTY=y +BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y +BR2_PACKAGE_IFUPDOWN_NG=y +BR2_PACKAGE_TETRIS=y diff --git a/configs/aarch64_defconfig b/configs/aarch64_defconfig index e9fc267ec..23f7aab7b 100644 --- a/configs/aarch64_defconfig +++ b/configs/aarch64_defconfig @@ -12,7 +12,7 @@ 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_DEVICE_TABLE="system/device_table.txt ${BR2_EXTERNAL_INFIX_PATH}/board/common/xattrs ${BR2_EXTERNAL_INFIX_PATH}/board/netconf/xattrs" BR2_SYSTEM_BIN_SH_BASH=y BR2_TARGET_GENERIC_GETTY_TERM="linux" BR2_SYSTEM_DHCP="eth0" @@ -20,8 +20,8 @@ BR2_ENABLE_LOCALE_WHITELIST="C en_US en_CA" BR2_GENERATE_LOCALE="en_US en_CA" BR2_TARGET_TZ_INFO=y BR2_ROOTFS_USERS_TABLES="${BR2_EXTERNAL_INFIX_PATH}/board/common/users" -BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL_INFIX_PATH}/board/common/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/rootfs" -BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build.sh" +BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL_INFIX_PATH}/board/common/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/aarch64/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/netconf/rootfs"" +BR2_ROOTFS_POST_BUILD_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build.sh ${BR2_EXTERNAL_INFIX_PATH}/board/netconf/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y @@ -52,7 +52,6 @@ BR2_PACKAGE_NETOPEER2_CLI=y BR2_PACKAGE_NSS_MDNS=y BR2_PACKAGE_ONIGURUMA=y BR2_PACKAGE_AVAHI=y -# BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_DEFAULT_SERVICES=y BR2_PACKAGE_CHRONY=y @@ -121,12 +120,9 @@ BR2_PACKAGE_FINIT_PLUGIN_MODPROBE=y BR2_PACKAGE_FINIT_PLUGIN_RTC=y BR2_PACKAGE_FINIT_PLUGIN_TTY=y BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y -BR2_PACKAGE_IFUPDOWN_NG=y BR2_PACKAGE_KLINFIX=y BR2_PACKAGE_NET=y -BR2_PACKAGE_P_NET=y -BR2_PACKAGE_P_NET_MAX_SUBSLOTS=12 -BR2_PACKAGE_P_NET_MAX_PHYSICAL_PORTS=10 -BR2_PACKAGE_PROFETH=y BR2_PACKAGE_TETRIS=y BR2_PACKAGE_QUERIERD=y +GNS3_APPLIANCE_RAM=512 +GNS3_APPLIANCE_IFNUM=10 diff --git a/configs/x86_64_classic_defconfig b/configs/x86_64_classic_defconfig new file mode 100644 index 000000000..df76b1c6d --- /dev/null +++ b/configs/x86_64_classic_defconfig @@ -0,0 +1,114 @@ +BR2_x86_64=y +BR2_x86_corei7=y +BR2_TOOLCHAIN_EXTERNAL=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="${BR2_EXTERNAL_INFIX_PATH}/patches" +BR2_TARGET_GENERIC_HOSTNAME="infix" +BR2_TARGET_GENERIC_ISSUE="Infix by KernelKit" +BR2_INIT_FINIT=y +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y +BR2_ROOTFS_DEVICE_TABLE="system/device_table.txt ${BR2_EXTERNAL_INFIX_PATH}/board/common/xattrs" +BR2_TARGET_GENERIC_GETTY_TERM="linux" +BR2_SYSTEM_DHCP="eth0" +BR2_ENABLE_LOCALE_WHITELIST="C en_US en_CA" +BR2_GENERATE_LOCALE="en_US en_CA" +BR2_TARGET_TZ_INFO=y +BR2_ROOTFS_USERS_TABLES="${BR2_EXTERNAL_INFIX_PATH}/board/common/users" +BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL_INFIX_PATH}/board/common/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/x86_64/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/classic/rootfs" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_64/post-build.sh ${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build.sh ${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build.sh ${BR2_EXTERNAL_INFIX_PATH}/board/classic/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.19.17" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/x86_64/linux_defconfig" +BR2_LINUX_KERNEL_INSTALL_TARGET=y +BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y +BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL_INFIX_PATH}/board/common/busybox_defconfig" +BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y +BR2_PACKAGE_JQ=y +BR2_PACKAGE_RNG_TOOLS=y +BR2_PACKAGE_UBOOT_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_LIBCURL_CURL=y +BR2_PACKAGE_NSS_MDNS=y +BR2_PACKAGE_ONIGURUMA=y +BR2_PACKAGE_AVAHI=y +# BR2_PACKAGE_AVAHI_AUTOIPD is not set +BR2_PACKAGE_AVAHI_DAEMON=y +BR2_PACKAGE_AVAHI_DEFAULT_SERVICES=y +BR2_PACKAGE_DHCPCD=y +BR2_PACKAGE_DNSMASQ=y +BR2_PACKAGE_DROPBEAR=y +BR2_PACKAGE_DROPBEAR_DISABLE_REVERSEDNS=y +BR2_PACKAGE_DROPBEAR_WTMP=y +BR2_PACKAGE_DROPBEAR_LASTLOG=y +BR2_PACKAGE_DROPBEAR_LEGACY_CRYPTO=y +BR2_PACKAGE_ETHTOOL=y +BR2_PACKAGE_FPING=y +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set +BR2_PACKAGE_IPROUTE2=y +BR2_PACKAGE_IPTABLES=y +BR2_PACKAGE_IPTABLES_NFTABLES=y +BR2_PACKAGE_LLDPD=y +BR2_PACKAGE_LYNX=y +BR2_PACKAGE_MTR=y +BR2_PACKAGE_NETCALC=y +BR2_PACKAGE_NFTABLES=y +BR2_PACKAGE_NMAP=y +BR2_PACKAGE_NMAP_NMAP=y +BR2_PACKAGE_NMAP_NPING=y +BR2_PACKAGE_OPENRESOLV=y +BR2_PACKAGE_SOCAT=y +BR2_PACKAGE_SSDP_RESPONDER=y +BR2_PACKAGE_TCPDUMP=y +BR2_PACKAGE_TRACEROUTE=y +BR2_PACKAGE_DIALOG=y +BR2_PACKAGE_PDMENU=y +BR2_PACKAGE_IRQBALANCE=y +BR2_PACKAGE_KMOD_TOOLS=y +BR2_PACKAGE_PWGEN=y +BR2_PACKAGE_RAUC=y +BR2_PACKAGE_RAUC_GPT=y +BR2_PACKAGE_RAUC_NETWORK=y +BR2_PACKAGE_SYSKLOGD=y +BR2_PACKAGE_SYSKLOGD_LOGGER=y +BR2_PACKAGE_WATCHDOGD=y +BR2_PACKAGE_MG=y +BR2_PACKAGE_MOST=y +BR2_PACKAGE_NANO=y +BR2_TARGET_ROOTFS_SQUASHFS=y +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_EDK2=y +BR2_TARGET_GRUB2=y +BR2_TARGET_GRUB2_X86_64_EFI=y +BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_gpt normal efi_gop configfile loadenv test terminfo terminal echo" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="${BR2_EXTERNAL_INFIX_PATH}/board/x86_64/grub-embed.cfg" +BR2_TARGET_GRUB2_INSTALL_TOOLS=y +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_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_VARIANT_CLASSIC=y +BR2_PACKAGE_FACTORY=y +BR2_PACKAGE_FINIT_SULOGIN=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_MODPROBE=y +BR2_PACKAGE_FINIT_PLUGIN_RTC=y +BR2_PACKAGE_FINIT_PLUGIN_TTY=y +BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y +BR2_PACKAGE_IFUPDOWN_NG=y +BR2_PACKAGE_TETRIS=y diff --git a/configs/amd64_defconfig b/configs/x86_64_defconfig similarity index 91% rename from configs/amd64_defconfig rename to configs/x86_64_defconfig index 2de8a90f1..c59970528 100644 --- a/configs/amd64_defconfig +++ b/configs/x86_64_defconfig @@ -11,7 +11,7 @@ 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_DEVICE_TABLE="system/device_table.txt ${BR2_EXTERNAL_INFIX_PATH}/board/common/xattrs ${BR2_EXTERNAL_INFIX_PATH}/board/netconf/xattrs" BR2_SYSTEM_BIN_SH_BASH=y BR2_TARGET_GENERIC_GETTY_TERM="linux" BR2_SYSTEM_DHCP="eth0" @@ -19,14 +19,14 @@ BR2_ENABLE_LOCALE_WHITELIST="C en_US en_CA" BR2_GENERATE_LOCALE="en_US en_CA" BR2_TARGET_TZ_INFO=y BR2_ROOTFS_USERS_TABLES="${BR2_EXTERNAL_INFIX_PATH}/board/common/users" -BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL_INFIX_PATH}/board/common/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/amd64/rootfs" -BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_64/post-build.sh ${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build.sh" +BR2_ROOTFS_OVERLAY="${BR2_EXTERNAL_INFIX_PATH}/board/common/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/x86_64/rootfs ${BR2_EXTERNAL_INFIX_PATH}/board/netconf/rootfs" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_64/post-build.sh ${BR2_EXTERNAL_INFIX_PATH}/board/common/post-build.sh ${BR2_EXTERNAL_INFIX_PATH}/board/netconf/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="${BR2_EXTERNAL_INFIX_PATH}/board/common/post-image.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.19.17" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y -BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/amd64/linux_defconfig" +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL_INFIX_PATH}/board/x86_64/linux_defconfig" BR2_LINUX_KERNEL_INSTALL_TARGET=y BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y BR2_PACKAGE_BUSYBOX_CONFIG="${BR2_EXTERNAL_INFIX_PATH}/board/common/busybox_defconfig" @@ -49,7 +49,6 @@ BR2_PACKAGE_NETOPEER2_CLI=y BR2_PACKAGE_NSS_MDNS=y BR2_PACKAGE_ONIGURUMA=y BR2_PACKAGE_AVAHI=y -# BR2_PACKAGE_AVAHI_AUTOIPD is not set BR2_PACKAGE_AVAHI_DAEMON=y BR2_PACKAGE_AVAHI_DEFAULT_SERVICES=y BR2_PACKAGE_CHRONY=y @@ -126,12 +125,9 @@ BR2_PACKAGE_FINIT_PLUGIN_MODPROBE=y BR2_PACKAGE_FINIT_PLUGIN_RTC=y BR2_PACKAGE_FINIT_PLUGIN_TTY=y BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y -BR2_PACKAGE_IFUPDOWN_NG=y BR2_PACKAGE_KLINFIX=y BR2_PACKAGE_NET=y -BR2_PACKAGE_P_NET=y -BR2_PACKAGE_P_NET_MAX_SUBSLOTS=12 -BR2_PACKAGE_P_NET_MAX_PHYSICAL_PORTS=10 -BR2_PACKAGE_PROFETH=y BR2_PACKAGE_TETRIS=y BR2_PACKAGE_QUERIERD=y +GNS3_APPLIANCE_RAM=512 +GNS3_APPLIANCE_IFNUM=10 diff --git a/doc/boot.md b/doc/boot.md index 4bd7e07f0..47772e974 100644 --- a/doc/boot.md +++ b/doc/boot.md @@ -329,11 +329,10 @@ rollbacks when upgrading to a new version. | Size | >= 16 MiB | | Format | EXT4 filesystem | -Non-volatile storage of the system configuration and user -data. Concretely, user data is everything stored under `/root` and -`/home`. Depending on the operating mode, the configuration is either -the NETCONF databases from `/cfg`, or the contents of `/etc` when -operating in native mode. +Non-volatile storage of the system configuration and user data. +Concretely, user data is everything stored under `/root` and `/home`. +Depending on the operating mode, the configuration is either the NETCONF +databases from `/cfg`, or the contents of `/etc` in classic mode. ### `var` - Variable Data diff --git a/package/confd/clean-etc b/package/confd/clean-etc index 342f47e41..ca909fd9b 100755 --- a/package/confd/clean-etc +++ b/package/confd/clean-etc @@ -1,13 +1,8 @@ #!/bin/sh -# This is an unmanaged node, leave /etc as-is -/lib/infix/use-etc && exit 0 - -# This is a managed node, ignore all default configuration ... -# ... except for some core services reserved() { - for svc in dnsmasq getty klish lldpd nginx sysklogd sysrepo; do + for svc in avahi dnsmasq getty klish lldpd nginx ssdpd sshd sysklogd sysrepo; do [ "$1" = "${svc}.conf" ] && return 0 done diff --git a/package/confd/confd.mk b/package/confd/confd.mk index 5b4fd02a3..cc3a9de6f 100644 --- a/package/confd/confd.mk +++ b/package/confd/confd.mk @@ -16,9 +16,8 @@ define CONFD_INSTALL_EXTRA ln -sf ../available/sysrepo.conf $(FINIT_D)/enabled/sysrepo.conf cp $(CONFD_PKGDIR)/tmpfiles.conf $(TARGET_DIR)/etc/tmpfiles.d/confd.conf mkdir -p $(TARGET_DIR)/usr/share/factory/cfg - cp $(CONFD_PKGDIR)/factory.cfg $(TARGET_DIR)/usr/share/factory/cfg/startup-config.cfg + cp $(CONFD_PKGDIR)/factory-config.cfg $(TARGET_DIR)/usr/share/factory/cfg/startup-config.cfg mkdir -p $(TARGET_DIR)/lib/infix - cp $(CONFD_PKGDIR)/prep-db $(TARGET_DIR)/lib/infix/ cp $(CONFD_PKGDIR)/clean-etc $(TARGET_DIR)/lib/infix/ endef CONFD_TARGET_FINALIZE_HOOKS += CONFD_INSTALL_EXTRA diff --git a/package/confd/factory-config.cfg b/package/confd/factory-config.cfg new file mode 100644 index 000000000..4c5e9fcfe --- /dev/null +++ b/package/confd/factory-config.cfg @@ -0,0 +1,24 @@ +{ + "ietf-interfaces:interfaces": { + "interface": [ + { + "name": "eth0", + "type": "iana-if-type:ethernetCsmacd", + "ietf-ip:ipv4": { + "infix-ip:autoconf": { + "enabled": true + } + }, + "ietf-ip:ipv6": { + "enabled": true, + "autoconf": { + "create-global-addresses": true + } + } + } + ] + }, + "ietf-system:system": { + "hostname": "infix" + } +} diff --git a/package/confd/factory.cfg b/package/confd/factory.cfg deleted file mode 100644 index 8711e168a..000000000 --- a/package/confd/factory.cfg +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ietf-system:system": { - "hostname": "default" - } -} diff --git a/package/confd/prep-db b/package/confd/prep-db deleted file mode 100755 index 541a41f53..000000000 --- a/package/confd/prep-db +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -set -e - -exit 0 diff --git a/package/confd/sysrepo.conf b/package/confd/sysrepo.conf index a78d4e56a..ffae6e84d 100644 --- a/package/confd/sysrepo.conf +++ b/package/confd/sysrepo.conf @@ -1,8 +1,7 @@ -run if: [S] /lib/infix/clean-etc -- -run if: [S] /lib/infix/prep-db -- +run [S] /lib/infix/clean-etc -- -service if: name:sysrepo [S12345789] sysrepo-plugind -p /run/sysrepo.pid -n -- Configuration daemon -run if: [S] log sysrepocfg -v4 -E/cfg/startup-config.cfg -f json -- -service if: name:netopeer [12345789] netopeer2-server -n -- NETCONF daemon +service name:sysrepo [S12345789] sysrepo-plugind -p /run/sysrepo.pid -n -- Configuration daemon +run [S] log sysrepocfg -v4 -E/cfg/startup-config.cfg -f json -- +service name:netopeer [12345789] netopeer2-server -n -- NETCONF daemon -task if: [12345789] resolvconf -u -- Update DNS configuration +task [12345789] resolvconf -u -- Update DNS configuration diff --git a/package/finit/finit.hash b/package/finit/finit.hash index a848602dd..3f135547e 100644 --- a/package/finit/finit.hash +++ b/package/finit/finit.hash @@ -4,6 +4,6 @@ sha256 262d8cfea80d94e048e3f1b149f5d940b4579a38f2b7dba563cf4b0b497e7422 finit- # Locally calculated sha256 abdb9adbbc1faacc35c80bc2974c7d6b842e3e50b066d688385b5d21be86206f LICENSE -# Snapshot before 4.-rc1 -sha256 2278adb4884495b784d8220f3dc0a1df88c3caf1e8bb222428f6eab3ed93b739 finit-c3ba15045b4336d3520dbeb068b68eafdf54e6c3.tar.gz +# Snapshot before 4.4-rc1 +sha256 4abed02dca80a8fff128bf823aea3491e3b48fdedc7228803b985b5eca0c03a5 finit-700c32fd73ae362af05fb094cb4b069f5147aabf.tar.gz diff --git a/package/finit/finit.mk b/package/finit/finit.mk index d67baf2e7..fe4a85ff0 100644 --- a/package/finit/finit.mk +++ b/package/finit/finit.mk @@ -14,7 +14,7 @@ FINIT_INSTALL_STAGING = YES FINIT_D = $(TARGET_DIR)/etc/finit.d # Create configure script using autoreconf when building from git -FINIT_VERSION = c3ba15045b4336d3520dbeb068b68eafdf54e6c3 +FINIT_VERSION = 700c32fd73ae362af05fb094cb4b069f5147aabf FINIT_SITE = $(call github,troglobit,finit,$(FINIT_VERSION)) FINIT_AUTORECONF = YES FINIT_DEPENDENCIES += host-automake host-autoconf host-libtool diff --git a/package/skeleton-init-finit/skeleton-init-finit.mk b/package/skeleton-init-finit/skeleton-init-finit.mk index d7ad1830b..ade9b0b84 100644 --- a/package/skeleton-init-finit/skeleton-init-finit.mk +++ b/package/skeleton-init-finit/skeleton-init-finit.mk @@ -44,6 +44,13 @@ endef SKELETON_INIT_FINIT_TARGET_FINALIZE_HOOKS += SKELETON_INIT_FINIT_SET_AVAHI endif +ifeq ($(BR2_PACKAGE_AVAHI_AUTOIPD),y) +define SKELETON_INIT_FINIT_SET_AVAHI_AUTOIPD + echo "service [2345789] name:zeroconf :%i avahi-autoipd --syslog %i -- ZeroConf for %i" > $(FINIT_D)/available/zeroconf@.conf +endef +SKELETON_INIT_FINIT_TARGET_FINALIZE_HOOKS += SKELETON_INIT_FINIT_SET_AVAHI_AUTOIPD +endif + ifeq ($(BR2_PACKAGE_CHRONY),y) define SKELETON_INIT_FINIT_SET_CHRONY cp $(SKELETON_INIT_FINIT_AVAILABLE)/chronyd.conf $(FINIT_D)/available/ @@ -297,7 +304,6 @@ endif define SKELETON_INIT_FINIT_INSTALL_TARGET_CMDS $(call SYSTEM_RSYNC,$(SKELETON_INIT_FINIT_PKGDIR)/skeleton,$(TARGET_DIR)) - rm -rf $(TARGET_DIR)/etc/finit.d/available $(TARGET_DIR)/etc/finit.d/enabled mkdir -p $(TARGET_DIR)/etc/finit.d/available mkdir -p $(TARGET_DIR)/etc/finit.d/enabled for svc in getty inetd ntpd telnetd; do \ diff --git a/package/skeleton-init-finit/skeleton/etc/finit.d/available/lldpd.conf b/package/skeleton-init-finit/skeleton/etc/finit.d/available/lldpd.conf index 186f0372b..ece41b2fd 100644 --- a/package/skeleton-init-finit/skeleton/etc/finit.d/available/lldpd.conf +++ b/package/skeleton-init-finit/skeleton/etc/finit.d/available/lldpd.conf @@ -1,2 +1 @@ -service if: [2345789] env:-/etc/default/lldpd \ - lldpd -d $LLDPD_ARGS -- LLDP daemon (IEEE 802.1ab) +service [2345789] env:-/etc/default/lldpd lldpd -d $LLDPD_ARGS -- LLDP daemon (IEEE 802.1ab) diff --git a/package/skeleton-init-finit/skeleton/etc/finit.d/available/profeth.conf b/package/skeleton-init-finit/skeleton/etc/finit.d/available/profeth.conf index e7d300180..f8e7e73a3 100644 --- a/package/skeleton-init-finit/skeleton/etc/finit.d/available/profeth.conf +++ b/package/skeleton-init-finit/skeleton/etc/finit.d/available/profeth.conf @@ -1,4 +1,2 @@ -service if: [2345789] \ - log:prio:local7.info,tag:profeth \ - env:-/etc/default/profeth \ - profeth -s infix -p /var/lib/profeth $PROFETH_ARGS -- PROFΞTH daemon +service [2345789] log:prio:local7.info,tag:profeth \ + env:-/etc/default/profeth profeth -s infix -p /var/lib/profeth $PROFETH_ARGS -- PROFΞTH daemon diff --git a/patches/klish/0001-klishd-allow-all-users-of-group-wheel-to-connect.patch b/patches/klish/0001-klishd-allow-all-users-of-group-wheel-to-connect.patch new file mode 100644 index 000000000..eda783ebe --- /dev/null +++ b/patches/klish/0001-klishd-allow-all-users-of-group-wheel-to-connect.patch @@ -0,0 +1,47 @@ +From 667a24c8d6c3abbebfefbcafa0543e9cfe8df970 Mon Sep 17 00:00:00 2001 +From: Joachim Wiberg +Date: Mon, 24 Apr 2023 09:22:39 +0200 +Subject: [PATCH] klishd: allow all users of group 'wheel' to connect +Organization: Addiva Elektronik + +Signed-off-by: Joachim Wiberg +--- + bin/klishd/klishd.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/bin/klishd/klishd.c b/bin/klishd/klishd.c +index 3f68b28..81dc392 100644 +--- a/bin/klishd/klishd.c ++++ b/bin/klishd/klishd.c +@@ -1,4 +1,5 @@ + #define _GNU_SOURCE ++#include + #include + #include + #include +@@ -451,6 +452,7 @@ static int create_listen_unix_sock(const char *path) + int sock = -1; + int opt = 1; + struct sockaddr_un laddr = {}; ++ struct group *gr; + + assert(path); + if (!path) +@@ -482,6 +484,14 @@ static int create_listen_unix_sock(const char *path) + goto err; + } + ++ gr = getgrnam("wheel"); ++ if (gr) { ++ if (chown(path, -1, gr->gr_gid)) ++ syslog(LOG_ERR, "Failed chown(wheel) %s: %s", path, strerror(errno)); ++ else ++ chmod(path, 0770); ++ } ++ + return sock; + + err: +-- +2.34.1 + diff --git a/src/confd/src/core.c b/src/confd/src/core.c index 042bd943e..1bab567a0 100644 --- a/src/confd/src/core.c +++ b/src/confd/src/core.c @@ -70,6 +70,13 @@ int sr_plugin_init_cb(sr_session_ctx_t *session, void **priv) goto err; } + rc = sr_module_change_subscribe(session, "ietf-interfaces", "/ietf-interfaces:interfaces//.", + commit_done_hook, NULL, 0, SR_SUBSCR_PASSIVE | SR_SUBSCR_DONE_ONLY, &confd.sub); + if (rc) { + ERROR("failed setting up startup-config hook: %s", sr_strerror(rc)); + goto err; + } + rc = sr_install_module(confd.conn, YANG_PATH_"/kernelkit-infix-deviations.yang", NULL, NULL); if (rc) goto err; diff --git a/src/confd/src/ietf-interfaces.c b/src/confd/src/ietf-interfaces.c index 883b69659..1cb728999 100644 --- a/src/confd/src/ietf-interfaces.c +++ b/src/confd/src/ietf-interfaces.c @@ -35,6 +35,7 @@ static const struct srx_module_requirement ietf_if_reqs[] = { { .dir = YANG_PATH_, .name = "ietf-interfaces", .rev = "2018-02-20", .features = iffeat }, { .dir = YANG_PATH_, .name = "iana-if-type", .rev = "2023-01-26" }, { .dir = YANG_PATH_, .name = "ietf-ip", .rev = "2018-02-22", .features = ipfeat }, + { .dir = YANG_PATH_, .name = "infix-ip", .rev = "2023-04-24" }, { NULL } }; @@ -124,7 +125,7 @@ static void ifpopul(sr_session_ctx_t *session) rc = sr_apply_changes(session, 0); if (rc) - ERROR("faled: %s", sr_strerror(rc)); + ERROR("failed: %s", sr_strerror(rc)); } static void ifinit(sr_session_ctx_t *session) @@ -168,7 +169,7 @@ static void ifinit(sr_session_ctx_t *session) rc = sr_apply_changes(session, 0); if (rc) - ERROR("faled: %s", sr_strerror(rc)); + ERROR("failed: %s", sr_strerror(rc)); } static int ifchange_cand_infer_type(sr_session_ctx_t *session, const char *xpath) @@ -232,6 +233,16 @@ static int ifchange_cand(sr_session_ctx_t *session, uint32_t sub_id, const char return SR_ERR_OK; } +static void zeroconf_init(char *ifname) +{ + systemf("initctl enable zeroconf@%s.conf", ifname); +} + +static void zeroconf_exit(char *ifname) +{ + systemf("initctl disable zeroconf@%s.conf", ifname); +} + static int ifchange(sr_session_ctx_t *session, uint32_t sub_id, const char *module, const char *xpath, sr_event_t event, unsigned request_id, void *priv) { @@ -265,8 +276,15 @@ static int ifchange(sr_session_ctx_t *session, uint32_t sub_id, const char *modu "/proc/sys/net/ipv4/conf/%s/forwarding", ifname); systemf("ip addr flush dev %s", ifname); - if (!srx_enabled(session, "%s/ietf-ip:ipv4/enabled", xpath)) + if (!srx_enabled(session, "%s/ietf-ip:ipv4/enabled", xpath)) { + zeroconf_exit(ifname); goto ipv6; + } + + if (!srx_enabled(session, "%s/ietf-ip:ipv4/autoconf/enabled", xpath)) + zeroconf_exit(ifname); + else + zeroconf_init(ifname); snprintf(path, sizeof(path), "%s/ietf-ip:ipv4/address", xpath); rc = sr_get_items(session, path, 0, 0, &addr, &addrcnt); diff --git a/src/confd/src/ietf-system.c b/src/confd/src/ietf-system.c index fad0ddc98..8718cab05 100644 --- a/src/confd/src/ietf-system.c +++ b/src/confd/src/ietf-system.c @@ -510,7 +510,7 @@ static int change_motd(sr_session_ctx_t *session, uint32_t sub_id, const char *m { /* XXX: derive from global "options.h" or /usr/share/factory/ */ const char *msg = "\033[1;90mNote:\033[0m" - "\033[0;90m use help, show, and setup commands to set up and diagnose the system\033[0m"; + "\033[0;90m configuration is done using the CLI, type 'cli' at the shell prompt.\033[0m"; char *str; int rc; diff --git a/src/confd/yang/infix-ip@2023-04-24.yang b/src/confd/yang/infix-ip@2023-04-24.yang new file mode 100644 index 000000000..663d89047 --- /dev/null +++ b/src/confd/yang/infix-ip@2023-04-24.yang @@ -0,0 +1,47 @@ +module infix-ip { + yang-version 1.1; + namespace "urn:infix:params:xml:ns:yang:infix-ip"; + prefix infix-ip; + + import ietf-interfaces { + prefix if; + } + import ietf-ip { + prefix ip; + } + import ietf-inet-types { + prefix inet; + } + import ietf-yang-types { + prefix yang; + } + + description + "This module augments ietf-ip with an IPv4 link-local autoconf"; + + revision 2023-04-24 { + description + "Initial revision."; + reference + "RFC 7277: A YANG Data Model for IP Management"; + } + + /* + * Data nodes + */ + augment "/if:interfaces/if:interface/ip:ipv4" { + container autoconf { + description + "Parameters to control the autoconfiguration of IPv4 address."; + + leaf enabled { + type boolean; + default false; + description + "Use a ZeroConf/IPv4LL agent to retrieve an 169.254/16 address."; + reference + "RFC 3927: Dynamic Configuration of IPv4 Link-Local Addresses"; + } + } + } +}