Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions build/conf/local.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ BB_NUMBER_THREADS = "20"
IB_PLATFORM ?= "virt64"
# IB_PLATFORM ?= "rpi4_64"
# IB_PLATFORM ?= "verdin-imx8mp"
# IB_PLATFORM ?= "pc64"

# On the QEMU-emulated platforms (virt32/virt64) a full BSP build
# (build.sh bsp-so3 / bsp-linux) also builds the QEMU emulator when its binary
Expand Down Expand Up @@ -47,6 +48,7 @@ IB_BUILD_QEMU ?= "1"
PREFERRED_VERSION_so3:virt32 = "6.4.0"
PREFERRED_VERSION_so3:virt64 = "6.4.0"
PREFERRED_VERSION_so3:rpi4_64 = "6.4.0"
PREFERRED_VERSION_so3:pc64 = "6.4.0"

# --- Configs (kernel defconfig) ---
# standalone and guest share the plain defconfig; capsule has its own.
Expand All @@ -56,6 +58,7 @@ PREFERRED_VERSION_so3:rpi4_64 = "6.4.0"
IB_CONFIG:so3:virt64 ?= "virt64_fb_defconfig"
IB_CONFIG:so3:virt32 ?= "virt32_fb_defconfig"
IB_CONFIG:so3:rpi4_64 ?= "rpi4_64_defconfig"
IB_CONFIG:so3:pc64 ?= "pc64_defconfig"

# --- ITS (boot-image selection) ---
# virt64: pick exactly ONE of standalone / guest / capsule.
Expand Down Expand Up @@ -136,6 +139,12 @@ IB_CONFIG:avz:verdin-imx8mp ?= "verdin-imx8mp_avz_defconfig"

IB_BOOT_CHAIN ?= "uboot"

# x86 PC (QEMU): GRUB loads SO3, its device tree and its root filesystem as
# multiboot2 modules, from the boot partition of the disk image.

IB_BOOT_CHAIN:pc64 = "grub"
IB_BOOT_STAGES_SUPPORTED:pc64 = "grub"

# ATF / OP-TEE platform identifiers for QEMU virt (used on the chains that
# carry them). Mirrors edgem1's virt64 settings.

Expand Down Expand Up @@ -270,6 +279,7 @@ IB_STORAGE_MODE:virt64 ?= "soft"
# IB_STORAGE_MODE:verdin-imx8mp ?= "hard"

IB_STORAGE_MODE:virt32 ?= "soft"
IB_STORAGE_MODE:pc64 ?= "soft"
IB_STORAGE_MODE:rpi4_64 ?= "hard"

# Verdin: deploy the imx-boot + SO3 ITB via a TEZI image set (see bsp_verdin-imx8mp.inc)
Expand Down Expand Up @@ -306,6 +316,7 @@ IB_ROOTFS_SIZE ?= "2G"
# Target partition for the main rootfs

IB_ROOTFS_PARTITION:virt32 = "p2"
IB_ROOTFS_PARTITION:pc64 = "p2"
IB_ROOTFS_PARTITION:virt64 = "p2"
IB_ROOTFS_PARTITION:rpi4_64 = "p2"

Expand All @@ -322,6 +333,8 @@ IB_PLAT_CPU:virt32 = "arm"
IB_PLAT_CPU:virt64 = "aarch64"
IB_PLAT_CPU:rpi4_64 = "aarch64"

IB_PLAT_CPU:pc64 = "x86_64"

IB_TOOLCHAIN:arm = "arm-linux-gnueabihf"
IB_TOOLCHAIN:virt64 = "aarch64-none-linux-gnu"
IB_TOOLCHAIN:rpi4_64 = "aarch64-none-linux-gnu"
Expand All @@ -334,6 +347,7 @@ IB_TOOLCHAIN:rpi4_64 = "aarch64-none-linux-gnu"
IB_MUSL_TOOLCHAIN_DIR = "${TMPDIR}/toolchains"
IB_MUSL_TARGET:aarch64 = "aarch64-linux-musl"
IB_MUSL_TARGET:arm = "arm-linux-musleabihf"
IB_MUSL_TARGET:x86_64 = "x86_64-linux-musl"

# Debug options
# IB_USR_BUILD_TYPE = "Release"
Expand Down
4 changes: 3 additions & 1 deletion build/meta-bsp/classes/bsp.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,12 @@ do_deploy_boot_chain[nostamp] = "1"
# filesystem:do_fs_check because a chain may write its first stage into the
# raw area of the card (bsp_virt64.inc, IB_FIRST_STAGE_FROM_CARD): on a fresh
# tree the storage image must exist before, not be created by do_deploy after.
do_deploy_boot_chain[depends] = "uboot:do_build filesystem:do_fs_check"
do_deploy_boot_chain[depends] = "filesystem:do_fs_check"

python () {
extra = []
if d.getVar('IB_CHAIN_HAS_UBOOT'):
extra.append("uboot:do_build")
if d.getVar('IB_CHAIN_HAS_ATF'):
extra.append("atf:do_build")
if d.getVar('IB_CHAIN_HAS_OPTEE'):
Expand Down
83 changes: 83 additions & 0 deletions build/meta-bsp/recipes-bsp/bsp/files/bsp_pc64.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Copyright (c) 2026 EDGEMTech SA

# Deployment on the QEMU x86_64 PC (pc64).
#
# GRUB plays the part of U-Boot: its core image sits right after the MBR,
# ahead of p1, and it loads the SO3 ELF with the device tree and the root
# filesystem as multiboot2 modules, all three read from p1. There is no ITB.

IB_PC64_GRUB_MODULES = "biosdisk part_msdos fat multiboot2 normal configfile serial terminal echo test"

do_itb:pc64 () {
bbnote "pc64: no ITB, GRUB loads the kernel, the device tree and the rootfs from p1"
}

def __pc64_grub_cfg():
return ("set timeout=0\n"
"serial --unit=0 --speed=115200\n"
"terminal_input serial console\n"
"terminal_output serial console\n"
"\n"
"menuentry \"SO3 (pc64)\" {\n"
"\tmultiboot2 /so3.elf\n"
"\tmodule2 /pc64.dtb dtb\n"
"\tmodule2 /rootfs.fat rootfs\n"
"}\n")

def __do_platform_boot_chain(d):
"""Install GRUB in the raw area of the disk image: boot.img in the MBR
code area (the partition table is left alone) and the core image from
sector 1, where boot.img and the core image's own blocklist expect it by
default. The core image embeds every module it needs, so p1 only holds
grub.cfg."""
import os
import subprocess

fs_dir = os.path.join(d.getVar('IB_DIR'), "filesystem")
store = os.path.join(fs_dir, "work", "sdcard.img.%s" % d.getVar('IB_PLATFORM'))
grub_dir = "/usr/lib/grub/i386-pc"
core = os.path.join(fs_dir, "grub-core.img")

if not os.path.isfile(store):
bb.fatal("no storage image at %s — run init_storage.sh first" % store)

if not os.path.isfile(os.path.join(grub_dir, "boot.img")):
bb.fatal("%s/boot.img is missing: install grub-pc-bin" % grub_dir)

subprocess.run(["grub-mkimage", "-O", "i386-pc", "-d", grub_dir, "-o", core,
"-p", "(hd0,msdos1)/boot/grub"] + d.getVar('IB_PC64_GRUB_MODULES').split(),
check=True)

# p1 starts at 1 MiB (fs_arm_common): the core image must end before.

if 512 + os.path.getsize(core) > 1024 * 1024:
bb.fatal("GRUB core image too big for the gap before p1")

subprocess.run(["dd", "if=%s/boot.img" % grub_dir, "of=%s" % store, "bs=440", "count=1",
"conv=notrunc,fsync"], check=True)
subprocess.run(["dd", "if=%s" % core, "of=%s" % store, "bs=512", "seek=1",
"conv=notrunc,fsync"], check=True)

def __do_platform_deploy(d):
import os
import shutil

p1 = d.getVar('IB_FILESYSTEM_PATH') + "/p1"
so3 = os.path.join(d.getVar('IB_SO3_PATH'), "so3")

files = {
os.path.join(so3, "so3"): "so3.elf",
os.path.join(so3, "dts", "pc64.dtb"): "pc64.dtb",
os.path.join(d.getVar('IB_ROOTFS_PATH'), "rootfs.fat"): "rootfs.fat",
}

for src, dst in files.items():
if not os.path.isfile(src):
bb.fatal(src + " is missing ...")

shutil.copyfile(src, os.path.join(p1, dst))

os.makedirs(os.path.join(p1, "boot", "grub"), exist_ok=True)

with open(os.path.join(p1, "boot", "grub", "grub.cfg"), "w") as f:
f.write(__pc64_grub_cfg())
10 changes: 0 additions & 10 deletions build/meta-bsp/recipes-bsp/bsp/files/bsp_x86-qemu.inc

This file was deleted.

1 change: 1 addition & 0 deletions build/meta-bsp/recipes-bsp/so3/bsp-so3_1.0.0.bb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ do_attach_infrabase[noexec] = "1"
# U-Boot) by the uboot recipe. verdin additionally needs the AVZ hypervisor
# (bundled by the AVZ+SO3 ITS), so its dependency set is overridden to add it.
IB_BSP_BUILD_DEPENDS = "usr-so3:do_build uboot:do_build"
IB_BSP_BUILD_DEPENDS:pc64 = "usr-so3:do_build so3:do_build"
IB_BSP_BUILD_DEPENDS:verdin-imx8mp = "usr-so3:do_build uboot:do_build avz:do_build"
do_build[depends] = "${IB_BSP_BUILD_DEPENDS}"

Expand Down
6 changes: 6 additions & 0 deletions build/meta-filesystem/classes/fs_pc64.bbclass
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2026 EDGEMTech SA

# Storage of the x86 PC: same layout as the ARM platforms, p1 (FAT, boot)
# starting at 1 MiB leaves room for the GRUB core image after the MBR.

inherit fs_arm_common
71 changes: 0 additions & 71 deletions build/meta-filesystem/classes/fs_x86-pc.bbclass

This file was deleted.

73 changes: 0 additions & 73 deletions build/meta-filesystem/classes/fs_x86-qemu.bbclass

This file was deleted.

17 changes: 6 additions & 11 deletions build/meta-linux/recipes-linux/linux/linux_6.12.bb
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,15 @@ do_build () {

cd ${IB_TARGET}

if [ "${IB_PLATFORM}" = "x86-qemu" -o "${IB_PLATFORM}" = "x86-pc" ]; then
make -j${CORES} bzImage
if [ "${IB_PLATFORM}" = "bbb" ]; then
make -j${CORES} zImage
else

if [ "${IB_PLATFORM}" = "bbb" ]; then
make -j${CORES} zImage
else
make ${IB_KMAKE_ARGS} -j${CORES} Image
fi

# Compile the device tree files
make ${IB_KMAKE_ARGS} dtbs
make ${IB_KMAKE_ARGS} -j${CORES} Image
fi

# Compile the device tree files
make ${IB_KMAKE_ARGS} dtbs

}

do_clean[nostamp] = "1"
Expand Down
2 changes: 1 addition & 1 deletion build/meta-qemu/classes/qemu.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ qemu_do_configure () {
# Fixed order, so the same targets always give the same configure line.

tlist=""
for t in arm-softmmu aarch64-softmmu; do
for t in arm-softmmu aarch64-softmmu x86_64-softmmu; do
if [ "$t" = "${QEMU_TARGET}" ] || ls build/$t/qemu-system-* >/dev/null 2>&1; then
tlist="${tlist:+$tlist,}$t"
fi
Expand Down
1 change: 1 addition & 0 deletions build/meta-qemu/recipes-qemu/qemu/qemu_8.2.2.bb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ IB_UPDIFF_EXCLUDE = "build subprojects GNUmakefile"

QEMU_TARGET:virt32 = "arm-softmmu"
QEMU_TARGET:virt64 = "aarch64-softmmu"
QEMU_TARGET:pc64 = "x86_64-softmmu"
QEMU_OPTS = "--enable-slirp --disable-attr --disable-werror --disable-docs --enable-sdl"

do_clean[nostamp] = "1"
Expand Down
Loading
Loading