From 40ae7a8412a642aa9b6c86e9e5967b3e9e079a34 Mon Sep 17 00:00:00 2001 From: geens Date: Thu, 31 Jul 2025 17:44:58 +0200 Subject: [PATCH] Booting yocto system (and many other useful scripts) --- .gitmodules | 3 ++ image/Dockerfile | 43 +++++++++--------- image/conf/bblayers.conf | 1 + image/conf/local.conf | 45 +++---------------- image/docker-compose.yml | 5 ++- .../conf/distro/fcb-looper.conf | 19 ++++++++ .../meta-fcb-looper/conf/layer.conf | 12 ++--- .../recipes-core/images/fcb-looper-image.bb | 30 +++++++++---- .../recipes-kernel/linux/files/wifi.cfg | 6 +++ .../linux/linux-yocto_%.bbappend | 5 +++ .../keyboard-config/files/keyboard-setup.sh | 5 +++ .../keyboard-config/keyboard-config_1.0.bb | 41 +++++++++++++++++ .../meta-fcb-looper/wic/fcb-looper-noswap.wks | 2 +- image/yocto/meta-intel | 1 + 14 files changed, 141 insertions(+), 77 deletions(-) create mode 100644 image/meta-layers/meta-fcb-looper/conf/distro/fcb-looper.conf create mode 100644 image/meta-layers/meta-fcb-looper/recipes-kernel/linux/files/wifi.cfg create mode 100644 image/meta-layers/meta-fcb-looper/recipes-kernel/linux/linux-yocto_%.bbappend create mode 100644 image/meta-layers/meta-fcb-looper/recipes-support/keyboard-config/files/keyboard-setup.sh create mode 100644 image/meta-layers/meta-fcb-looper/recipes-support/keyboard-config/keyboard-config_1.0.bb create mode 160000 image/yocto/meta-intel diff --git a/.gitmodules b/.gitmodules index 81e1e71..5e2db07 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ path = image/yocto/meta-rust-bin url = https://github.com/rust-embedded/meta-rust-bin.git branch = master +[submodule "image/yocto/meta-intel"] + path = image/yocto/meta-intel + url = git://git.yoctoproject.org/meta-intel diff --git a/image/Dockerfile b/image/Dockerfile index 1635d1c..f8b17db 100644 --- a/image/Dockerfile +++ b/image/Dockerfile @@ -5,38 +5,39 @@ ENV DEBIAN_FRONTEND=noninteractive # Install dependencies RUN apt-get update && apt-get install -y \ - gawk \ - wget \ - git \ - diffstat \ - unzip \ - texinfo \ - gcc \ build-essential \ chrpath \ - socat \ cpio \ - python3 \ - python3-pip \ - python3-pexpect \ - xz-utils \ debianutils \ + diffstat \ + file \ + gawk \ + gcc \ + git \ iputils-ping \ + less \ + libacl1 \ + liblz4-tool \ + locales \ + ovmf \ + python3 \ python3-git \ python3-jinja2 \ + python3-pexpect \ + python3-pip \ python3-subunit \ - zstd \ - liblz4-tool \ - file \ - locales \ - libacl1 \ - sudo \ - vim \ - less \ - tree \ qemu-system-data \ qemu-system-x86 \ qemu-utils \ + socat \ + sudo \ + texinfo \ + tree \ + unzip \ + vim \ + wget \ + xz-utils \ + zstd \ && rm -rf /var/lib/apt/lists/* # Set up locale diff --git a/image/conf/bblayers.conf b/image/conf/bblayers.conf index 2f10d69..7042926 100644 --- a/image/conf/bblayers.conf +++ b/image/conf/bblayers.conf @@ -9,6 +9,7 @@ BBLAYERS ?= " \ /workspace/yocto/poky/meta \ /workspace/yocto/poky/meta-poky \ /workspace/yocto/poky/meta-yocto-bsp \ + /workspace/yocto/meta-intel \ /workspace/yocto/meta-openembedded/meta-oe \ /workspace/yocto/meta-openembedded/meta-python \ /workspace/yocto/meta-openembedded/meta-multimedia \ diff --git a/image/conf/local.conf b/image/conf/local.conf index 07f706f..f0f8a33 100644 --- a/image/conf/local.conf +++ b/image/conf/local.conf @@ -1,46 +1,13 @@ -MACHINE = "genericx86-64" +#MACHINE = "genericx86-64" +MACHINE = "intel-skylake-64" DISTRO = "poky" -PREFERRED_PROVIDER_virtual/kernel = "linux-yocto" -IMAGE_INSTALL:append = " openssh ssh-keys" -EXTRA_IMAGE_FEATURES += "ssh-server-openssh" -# Image formats for QEMU testing and deployment -IMAGE_FSTYPES += "ext4 tar.bz2" - -# Root access configuration -EXTRA_IMAGE_FEATURES += "empty-root-password" -EXTRA_IMAGE_FEATURES += "allow-empty-password" - -# SSH configuration -EXTRA_IMAGE_FEATURES += "ssh-server-openssh" - -# Memory optimization settings +# Limit resource usage for builds BB_NUMBER_THREADS = "2" PARALLEL_MAKE = "-j 2" - -# Limit memory usage for builds BB_SCHEDULER = "completion" INHERIT += "rm_work" -# Rust support -ENABLE_RUST = "1" - -# GUI support -DISTRO_FEATURES:append = " wayland systemd pam usrmerge" -VIRTUAL-RUNTIME_init_manager = "systemd" -DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" -VIRTUAL-RUNTIME_initscripts = "" - -# Add GUI packages to image -CORE_IMAGE_EXTRA_INSTALL += "gui-app weston liberation-fonts" - -# Needed to enable terminal on tty2 -EXTRA_IMAGE_FEATURES += "debug-tweaks" - -# WiFi support - Intel Centrino Advanced-N 6235 specific -DISTRO_FEATURES += "wifi opengl" -IMAGE_INSTALL:append = " wpa-supplicant iw linux-firmware packagegroup-base-wifi pciutils usbutils" -IMAGE_INSTALL:append = " linux-firmware-iwlwifi-6000g2b-6" - -# Enable iwlwifi driver in kernel -KERNEL_FEATURES:append = " features/iwlwifi/iwlwifi.scc" \ No newline at end of file +#VIRTUAL-RUNTIME_dev_manager = "busybox-mdev" +PREFERRED_PROVIDER_virtual/kernel = "linux-intel-rt" +IMAGE_FSTYPES += "wic.vdi" \ No newline at end of file diff --git a/image/docker-compose.yml b/image/docker-compose.yml index 2805507..442d480 100644 --- a/image/docker-compose.yml +++ b/image/docker-compose.yml @@ -19,7 +19,7 @@ services: bash -c " source /workspace/yocto/poky/oe-init-build-env /workspace/build && cp /workspace/conf/* /workspace/build/conf/ && - bitbake fcb-looper-image && + bitbake core-image-rt && echo 'Build complete. Image files available in output directory.' " @@ -48,5 +48,6 @@ services: echo 'VNC will be available on localhost:5901' && echo 'SSH will be available on localhost:2222' && echo 'QEMU monitor on localhost:4444' && - qemu-system-x86_64 -accel kvm -cpu host -m 4096 -smp 4 -kernel /workspace/build/tmp/deploy/images/genericx86-64/bzImage -drive file=/workspace/build/tmp/deploy/images/genericx86-64/fcb-looper-image-genericx86-64.rootfs.ext4,if=virtio,format=raw,cache=writeback -netdev user,id=net0,hostfwd=tcp:127.0.0.1:2222-:22,hostfwd=tcp:127.0.0.1:8080-:8080 -device virtio-net-pci,netdev=net0 -device virtio-vga -vnc 127.0.0.1:1 -monitor telnet:127.0.0.1:4444,server,nowait -serial stdio -append 'root=/dev/vda rw console=ttyS0 console=tty0' + cp /usr/share/OVMF/OVMF_VARS.fd /tmp/OVMF_VARS.fd && + qemu-system-x86_64 -accel kvm -cpu host -m 4096 -smp 4 -drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE.fd -drive if=pflash,format=raw,file=/tmp/OVMF_VARS.fd -drive file=/workspace/build/tmp/deploy/images/intel-skylake-64/core-image-rt-intel-skylake-64.rootfs.wic,if=virtio,format=raw,cache=writeback -netdev user,id=net0,hostfwd=tcp:127.0.0.1:2222-:22,hostfwd=tcp:127.0.0.1:8080-:8080 -device virtio-net-pci,netdev=net0 -device virtio-vga -vnc 127.0.0.1:1 -monitor telnet:127.0.0.1:4444,server,nowait -serial stdio " \ No newline at end of file diff --git a/image/meta-layers/meta-fcb-looper/conf/distro/fcb-looper.conf b/image/meta-layers/meta-fcb-looper/conf/distro/fcb-looper.conf new file mode 100644 index 0000000..a4b828d --- /dev/null +++ b/image/meta-layers/meta-fcb-looper/conf/distro/fcb-looper.conf @@ -0,0 +1,19 @@ +require conf/distro/poky.conf + +DISTRO = "fcb-looper" +DISTRO_NAME = "FCB Looper Distribution" +DISTRO_VERSION = "1.0" + +# Use busybox-mdev as device manager +VIRTUAL-RUNTIME_dev_manager = "busybox-mdev" + +## Distro features for GUI, W^Fi, and systemd +#DISTRO_FEATURES:append = " wayland systemd pam usrmerge wifi opengl" +#DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" +# +## Systemd configuration +#VIRTUAL-RUNTIME_init_manager = "systemd" +#VIRTUAL-RUNTIME_initscripts = "" +# +## Default target +#SYSTEMD_DEFAULT_TARGET = "graphical.target" \ No newline at end of file diff --git a/image/meta-layers/meta-fcb-looper/conf/layer.conf b/image/meta-layers/meta-fcb-looper/conf/layer.conf index fd1864c..ebb6e15 100644 --- a/image/meta-layers/meta-fcb-looper/conf/layer.conf +++ b/image/meta-layers/meta-fcb-looper/conf/layer.conf @@ -4,12 +4,12 @@ BBPATH .= ":${LAYERDIR}" # Layer recipes BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend" -BBFILE_COLLECTIONS += "meta-fcb-looper" -BBFILE_PATTERN_meta-fcb-looper = "^${LAYERDIR}/" -BBFILE_PRIORITY_meta-fcb-looper = "10" +BBFILE_COLLECTIONS += "fcb-looper-layer" +BBFILE_PATTERN_fcb-looper-layer = "^${LAYERDIR}/" +BBFILE_PRIORITY_fcb-looper-layer = "10" -LAYERVERSION_meta-fcb-looper = "1" -LAYERSERIES_COMPAT_meta-fcb-looper = "scarthgap" +LAYERVERSION_fcb-looper-layer = "1" +LAYERSERIES_COMPAT_fcb-looper-layer = "scarthgap" # Dependencies -LAYERDEPENDS_meta-fcb-looper = "core openembedded-layer rust-bin-layer" \ No newline at end of file +LAYERDEPENDS_fcb-looper-layer = "core intel openembedded-layer rust-bin-layer" \ No newline at end of file diff --git a/image/meta-layers/meta-fcb-looper/recipes-core/images/fcb-looper-image.bb b/image/meta-layers/meta-fcb-looper/recipes-core/images/fcb-looper-image.bb index 143e78f..a53a6e5 100644 --- a/image/meta-layers/meta-fcb-looper/recipes-core/images/fcb-looper-image.bb +++ b/image/meta-layers/meta-fcb-looper/recipes-core/images/fcb-looper-image.bb @@ -1,11 +1,14 @@ SUMMARY = "FCB1010 Looper System Image" DESCRIPTION = "Minimal embedded Linux system with GUI for audio looper" -require recipes-core/images/core-image-base.bb +require recipes-core/images/core-image-minimal.bb + +# Distro features now configured in fcb-looper distribution + +# gui-app IMAGE_INSTALL += "\ packagegroup-core-boot \ - gui-app \ weston \ weston-init \ liberation-fonts \ @@ -13,12 +16,25 @@ IMAGE_INSTALL += "\ openssh \ ssh-keys \ wifi-config \ + wpa-supplicant \ + iw \ + linux-firmware \ + packagegroup-base-wifi \ + pciutils \ + usbutils \ + linux-firmware-iwlwifi-6000g2b-6 \ + kbd \ + file \ + util-linux \ + keyboard-config \ ${CORE_IMAGE_EXTRA_INSTALL} \ " -# Optimize for embedded use -IMAGE_FEATURES += "read-only-rootfs ssh-server-openssh" -SYSTEMD_DEFAULT_TARGET = "graphical.target" +# WiFi kernel features - ensure iwlwifi is built +KERNEL_FEATURES:append = " cfg/80211.scc features/iwlwifi/iwlwifi.scc" + +# Image features for development and access - removed read-only for debugging +IMAGE_FEATURES += "ssh-server-openssh empty-root-password allow-empty-password debug-tweaks" # Size optimization IMAGE_ROOTFS_SIZE ?= "1048576" @@ -28,6 +44,4 @@ IMAGE_OVERHEAD_FACTOR = "1.1" IMAGE_FSTYPES += "ext4 tar.bz2 wic" # Custom WIC file without swap -WKS_FILE = "fcb-looper-noswap.wks" - -LICENSE = "MIT" \ No newline at end of file +WKS_FILE = "fcb-looper-noswap.wks" \ No newline at end of file diff --git a/image/meta-layers/meta-fcb-looper/recipes-kernel/linux/files/wifi.cfg b/image/meta-layers/meta-fcb-looper/recipes-kernel/linux/files/wifi.cfg new file mode 100644 index 0000000..9e8399f --- /dev/null +++ b/image/meta-layers/meta-fcb-looper/recipes-kernel/linux/files/wifi.cfg @@ -0,0 +1,6 @@ +# WiFi kernel configuration - built into kernel +CONFIG_CFG80211=y +CONFIG_MAC80211=y +CONFIG_IWLWIFI=y +CONFIG_IWLDVM=y +CONFIG_IWLMVM=y \ No newline at end of file diff --git a/image/meta-layers/meta-fcb-looper/recipes-kernel/linux/linux-yocto_%.bbappend b/image/meta-layers/meta-fcb-looper/recipes-kernel/linux/linux-yocto_%.bbappend new file mode 100644 index 0000000..be5217b --- /dev/null +++ b/image/meta-layers/meta-fcb-looper/recipes-kernel/linux/linux-yocto_%.bbappend @@ -0,0 +1,5 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI += "file://wifi.cfg" + +COMPATIBLE_MACHINE = "genericx86-64" \ No newline at end of file diff --git a/image/meta-layers/meta-fcb-looper/recipes-support/keyboard-config/files/keyboard-setup.sh b/image/meta-layers/meta-fcb-looper/recipes-support/keyboard-config/files/keyboard-setup.sh new file mode 100644 index 0000000..20e89ee --- /dev/null +++ b/image/meta-layers/meta-fcb-looper/recipes-support/keyboard-config/files/keyboard-setup.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# Set Belgian keyboard layout +loadkeys be +# Make it persistent for systemd +localectl set-keymap be \ No newline at end of file diff --git a/image/meta-layers/meta-fcb-looper/recipes-support/keyboard-config/keyboard-config_1.0.bb b/image/meta-layers/meta-fcb-looper/recipes-support/keyboard-config/keyboard-config_1.0.bb new file mode 100644 index 0000000..609f445 --- /dev/null +++ b/image/meta-layers/meta-fcb-looper/recipes-support/keyboard-config/keyboard-config_1.0.bb @@ -0,0 +1,41 @@ +SUMMARY = "Belgian Keyboard Layout Configuration" +DESCRIPTION = "Sets up Belgian keyboard layout on boot" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "file://keyboard-setup.sh" + +S = "${WORKDIR}" + +do_install() { + # Install keyboard setup script + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/keyboard-setup.sh ${D}${bindir}/ + + # Create keyboard setup service + install -d ${D}${sysconfdir}/systemd/system + cat > ${D}${sysconfdir}/systemd/system/keyboard-setup.service << EOF +[Unit] +Description=Setup Belgian Keyboard Layout +DefaultDependencies=false +Before=sysinit.target + +[Service] +Type=oneshot +ExecStart=${bindir}/keyboard-setup.sh +RemainAfterExit=yes + +[Install] +WantedBy=sysinit.target +EOF + + # Enable service + install -d ${D}${sysconfdir}/systemd/system/sysinit.target.wants + ln -sf ${sysconfdir}/systemd/system/keyboard-setup.service ${D}${sysconfdir}/systemd/system/sysinit.target.wants/keyboard-setup.service +} + +FILES:${PN} = "${bindir}/keyboard-setup.sh \ + ${sysconfdir}/systemd/system/keyboard-setup.service \ + ${sysconfdir}/systemd/system/sysinit.target.wants/*" + +RDEPENDS:${PN} = "systemd kbd" \ No newline at end of file diff --git a/image/meta-layers/meta-fcb-looper/wic/fcb-looper-noswap.wks b/image/meta-layers/meta-fcb-looper/wic/fcb-looper-noswap.wks index 6d4fcd6..2830836 100644 --- a/image/meta-layers/meta-fcb-looper/wic/fcb-looper-noswap.wks +++ b/image/meta-layers/meta-fcb-looper/wic/fcb-looper-noswap.wks @@ -3,4 +3,4 @@ part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk sda --label msdos --active --align 1024 part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid -bootloader --ptable gpt --timeout=5 --append="rootfstype=ext4 console=ttyS0,115200 console=tty0" \ No newline at end of file +bootloader --ptable gpt --timeout=5 --append="rootfstype=ext4 console=ttyS0,115200 console=tty0 systemd.gpt_auto=0" \ No newline at end of file diff --git a/image/yocto/meta-intel b/image/yocto/meta-intel new file mode 160000 index 0000000..38e75c8 --- /dev/null +++ b/image/yocto/meta-intel @@ -0,0 +1 @@ +Subproject commit 38e75c8c1059e5f37659c140c010eaa203238fd2