diff --git a/.gitignore b/.gitignore index 30c9624..2296246 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,6 @@ !/hardware !/software !/scripts -/software/OS_build +#/software/OS_build !/submodules /submodules/*/* diff --git a/Makefile b/Makefile index 70ce685..c804df8 100644 --- a/Makefile +++ b/Makefile @@ -49,11 +49,13 @@ build-dts: $(OS_BUILD_DIR) rm $(OS_BUILD_DIR)/$(SYSTEM_NAME)_tmp.dts ## Buildroot Makefile Variables and Targets -BUILDROOT_VERSION=buildroot-2022.02.10 +BUILDROOT_VERSION=buildroot-2025.08.1 BUILDROOT_DIR=$(OS_SUBMODULES_DIR)/$(BUILDROOT_VERSION) build-buildroot: $(OS_BUILD_DIR) $(BUILDROOT_DIR) $(MAKE) -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(OS_SOFTWARE_DIR)/buildroot iob_soc_defconfig + # PATCH: Apply patch for buildroot-2025.08.1 micropython: https://github.com/buildroot/buildroot/commit/ab906018c98e5f0838b023fa886c6c52a1cc5cf6 + -cd $(BUILDROOT_DIR) && curl -L https://github.com/buildroot/buildroot/commit/ab906018c98e5f0838b023fa886c6c52a1cc5cf6.patch | patch -p1 -N $(MAKE) -C $(BUILDROOT_DIR) -j`nproc` cp $(BUILDROOT_DIR)/output/images/rootfs.cpio.gz $(OS_BUILD_DIR) diff --git a/scripts/shell.nix b/scripts/shell.nix index 1dc1397..e04c2b5 100644 --- a/scripts/shell.nix +++ b/scripts/shell.nix @@ -1,11 +1,4 @@ -{ pkgs ? import (builtins.fetchTarball { - # Descriptive name to make the store path easier to identify - name = "nixos-22.11"; - # Commit hash for nixos-22.11 - url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/22.11.tar.gz"; - # Hash obtained using `nix-prefetch-url --unpack ` - sha256 = "11w3wn2yjhaa5pv20gbfbirvjq6i3m7pqrq2msf0g7cv44vijwgw"; -}) {}}: +{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/25.05.tar.gz") {}}: pkgs.mkShell { name = "iob-shell"; buildInputs = with pkgs; [ @@ -15,5 +8,14 @@ pkgs.mkShell { (callPackage ./scripts/riscv-gnu-toolchain.nix { }) # Linux kernel build packages libyaml + ncurses ]; + shellHook = '' + # fixes libstdc++.so.6 issues of buildroot's patchelf + export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib + ''; + + # Disable hardening flags for gcc. Prevents errors when running buildroot, like these: + # https://github.com/riscv-collab/riscv-gnu-toolchain/issues/901 + hardeningDisable = [ "all" ]; } diff --git a/software/OS_build/rootfs.cpio.gz b/software/OS_build/rootfs.cpio.gz index 473f4f1..19228a8 100644 Binary files a/software/OS_build/rootfs.cpio.gz and b/software/OS_build/rootfs.cpio.gz differ diff --git a/software/buildroot/board/IObundle/iob-soc/rootfs-overlay/etc/init.d/S10mdev b/software/buildroot/board/IObundle/iob-soc/rootfs-overlay/etc/init.d/S10mdev new file mode 100755 index 0000000..ed3637c --- /dev/null +++ b/software/buildroot/board/IObundle/iob-soc/rootfs-overlay/etc/init.d/S10mdev @@ -0,0 +1,47 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2025 IObundle +# +# SPDX-License-Identifier: MIT + +# +# Run the mdev daemon +# + +DAEMON="mdev" +PIDFILE="/var/run/$DAEMON.pid" + + +start() { + echo -n "Starting $DAEMON... " + start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df + [ $? -eq 0 ] && echo "OK" || echo "ERROR" + + # coldplug modules + find /sys/ -name modalias -print0 | \ + xargs -0 sort -u | \ + tr '\n' '\0' | \ + xargs -0 modprobe -abq +} + +stop() { + echo -n "Stopping $DAEMON... " + start-stop-daemon -K -p $PIDFILE + [ $? -eq 0 ] && echo "OK" || echo "ERROR" +} + +restart() { + stop + start +} + +case "$1" in + start|stop|restart) + "$1" + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? diff --git a/software/buildroot/board/IObundle/iob-soc/rootfs-overlay/etc/init.d/S99IObundleVerification b/software/buildroot/board/IObundle/iob-soc/rootfs-overlay/etc/init.d/S99IObundleVerification deleted file mode 100755 index fb6f816..0000000 --- a/software/buildroot/board/IObundle/iob-soc/rootfs-overlay/etc/init.d/S99IObundleVerification +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# Script to verify linux functioning -echo "Test passed!" > /tmp/test.log -# Send file via UART with Zmodem -echo "Transfering 'test.log' file via ZMODEM. Press Ctrl-X five or more times during the transfer to abort." -sz -e /tmp/test.log diff --git a/software/buildroot/board/IObundle/iob-soc/rootfs-overlay/etc/mdev.conf b/software/buildroot/board/IObundle/iob-soc/rootfs-overlay/etc/mdev.conf new file mode 100644 index 0000000..02de210 --- /dev/null +++ b/software/buildroot/board/IObundle/iob-soc/rootfs-overlay/etc/mdev.conf @@ -0,0 +1,43 @@ +# SPDX-FileCopyrightText: 2025 IObundle +# +# SPDX-License-Identifier: MIT + +# null may already exist; therefore ownership has to be changed with command +null root:root 666 @chmod 666 $MDEV +zero root:root 666 +full root:root 666 +random root:root 444 +urandom root:root 444 +hwrandom root:root 444 +grsec root:root 660 + +kmem root:root 640 +mem root:root 640 +port root:root 640 +# console may already exist; therefore ownership has to be changed with command +console root:tty 600 @chmod 600 $MDEV +ptmx root:tty 666 +pty.* root:tty 660 + +# Typical devices +tty root:tty 666 +tty[0-9]* root:tty 660 +vcsa*[0-9]* root:tty 660 +ttyS[0-9]* root:root 660 +ttyUSB[0-9]* root:root 660 + +# alsa sound devices +snd/pcm.* root:audio 660 +snd/control.* root:audio 660 +snd/midi.* root:audio 660 +snd/seq root:audio 660 +snd/timer root:audio 660 + +# input stuff +input/event[0-9]+ root:root 640 +input/mice root:root 640 +input/mouse[0-9] root:root 640 +input/ts[0-9] root:root 600 + +# load modules +$MODALIAS=.* root:root 660 @modprobe "$MODALIAS" diff --git a/software/buildroot/configs/iob_soc_defconfig b/software/buildroot/configs/iob_soc_defconfig index 0274213..dcf7946 100644 --- a/software/buildroot/configs/iob_soc_defconfig +++ b/software/buildroot/configs/iob_soc_defconfig @@ -4,13 +4,13 @@ BR2_CCACHE_DIR="$(HOME)/.buildroot-ccache-saxon_default" ## Target options BR2_riscv=y -BR2_RISCV_32=y ## Instruction Set Extensions BR2_riscv_custom=y -BR2_RISCV_ISA_CUSTOM_RVM=y -BR2_RISCV_ISA_CUSTOM_RVA=y -BR2_RISCV_ISA_CUSTOM_RVC=y +BR2_RISCV_ISA_RVM=y +BR2_RISCV_ISA_RVA=y +BR2_RISCV_ISA_RVC=y +BR2_RISCV_32=y BR2_RISCV_ABI_ILP32=y ## Linux headers same as kernel