Repository navigation
so3: x86_64 port on the QEMU PC (pc64), booted by GRUB - #380
Merged
Merged
Conversation
GRUB loads the kernel with multiboot2, together with the device tree and the root filesystem as modules. The boot code writes the memory size and the initrd location into the device tree, as U-Boot does on ARM, so the generic code sees the same input on both. It also moves the root filesystem to the top of the RAM: GRUB may load it right after the image, where the device tree and the frame table go. The kernel runs in the top 2 GB (-mcmodel=kernel) without the FPU, which belongs to user space and is switched with the callee-saved registers on the kernel stack. As with AArch32 there is a single page table root, so every process carries the kernel half, kept in sync on each switch. PC devices: 8259 PIC, 8254 PIT tick, TSC clocksource and the COM1 16550 in the I/O port space. musl on x86_64 follows the generic Linux ABI: other open() flag values and struct stat layout, clone() with ctid before tls, arch_prctl for the thread pointer, and stat/mkdir/unlink/rmdir/rename in place of their *at versions. strtod and libroxml compute in floating point and only serve SOO, so x86 leaves them out.
The usr-so3 recipe picks <IB_PLAT_CPU>-linux-musl.cmake, so the pc64 platform needs its x86_64 counterpart of the aarch64 one.
GRUB is a new stage of IB_BOOT_CHAIN, the x86 counterpart of U-Boot, so it runs alone. U-Boot is now built only when the chain names it, which changes nothing for the ARM platforms. The deploy installs GRUB in the raw area of the disk image, boot.img in the MBR and the core image from sector 1 where both expect it, so neither grub-install nor root is needed. p1 holds the kernel, the device tree, rootfs.fat and grub.cfg; there is no ITB. QEMU gains the x86_64 target, st.sh and build.sh the pc64 platform, and the build image the GRUB tools.
They described a Linux x86 platform that no longer builds: the BSP only printed a message and the two storage classes defined a hook that nothing calls any more. pc64 is the x86 platform now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports SO3 to x86_64, on a new
pc64platform (QEMU PC). GRUB boots SO3 from the disk image to the user shell.Kernel (
arch/x86)-mcmodel=kernel), built without FPU/SSErootfs.fatarrive as GRUB modules; the boot code writes the memory size and the initrd location into the device tree, as U-Boot does on ARM, so the generic code is unchanged theresyscallentry, return throughiretq; FPU/SSE state and callee-saved registers kept on the kernel stack across__switch_to; FS base per threadGeneric code, x86-only differences (the ARM build is untouched)
O_DIRECTORY/O_NOFOLLOW/O_DIRECT/O_LARGEFILEvalues, anotherstruct statlayout,clone()with ctid before tls,arch_prctl(), andstat/lstat/mkdir/rmdir/unlink/renameinstead of their*atversionsstrtodand libroxml compute in floating point and serve only SOO: left out on x86-mlittle-endianand-no-enum-size-warningmoved to the ARM flagsBuild
grubinIB_BOOT_CHAIN, exclusive withuboot; U-Boot is now built only when the chain names it (no change for the ARM platforms)bsp_pc64.inc: GRUB goes into the raw area ofsdcard.img.pc64(boot.img in the MBR, core image from sector 1), with nogrub-installand no root; p1 holds the kernel, the DTB,rootfs.fatandgrub.cfgst.sh/build.shknow pc64; the build image gainsgrub-pc-binandgrub-common; x86_64 musl toolchain and CMake filex86-qemu/x86-pcleftovers are removed (BSP stub, two storage classes, the bzImage branch oflinux_6.12.bb)Tested
IB_PLATFORM = "pc64":build.sh bsp-so3+deploy.sh bsp-so3+st.shboots to the shell (on the host, not yet in the container)ls -l,mkdir,cat, fork/exec,thread_example(clone, TLS, futex, mutex), Ctrl-C ontimenanosleeplasts 2.01 s under both TCG and KVMNot covered yet: SMP (uniprocessor port), LAPIC/IOAPIC, network, framebuffer, documentation page.