Files
uniLoader/main/boot-fdt.c
Igor Belwon eaacd962db main: refactor booting logic
- Move main headers from include/ to include/main/
- Split booting logic to boot.c and boot-fdt.c to avoid cluttering main()
- Conditionally compile boot-fdt only if libfdt is used
- Add some better logging

Change was tested on qemu-virt, which succesfully booted a kernel:
$ qemu-system-aarch64 -machine virt -cpu cortex-a72 -nographic -m 512m -kernel uniLoader.o
[INFO]              .__.____                     .___
[INFO]  __ __  ____ |__|    |    _________     __| _/___________
[INFO] |  |  \/    \|  |    |   /  _ \__  \   / __ |/ __ \_  __\
[INFO] |  |  /   |  \  |    |__(  <_> ) __ \_/ /_/ \  ___/|  |\/
[INFO] |____/|___|  /__|_______ \____(____  /\____ |\___  >__|
[INFO]            \/           \/         \/      \/    \/
[INFO] passed board initialization
[INFO] welcome to uniLoader (e69eba1) - date 2026-02-21 14:01:34 on qemu-virt
[INFO] Booting kernel...
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083]
[    0.000000] Linux version 6.12.73+deb13-arm64 (debian-kernel@lists.debian.org) (aarch64-linux-gnu-gcc-14 (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44) #1 SMP Debian 6.12.73-1 (2026-02-17)
[    0.000000] KASLR enabled
[    0.000000] random: crng init done
[...]

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2026-02-23 23:02:53 +02:00

21 lines
417 B
C

// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2026, Igor Belwon <igor.belwon@mentallysanemainliners.org>
*/
#include <drivers/ramdisk-handler.h>
#include <lib/debug.h>
static char fdt_buf[CONFIG_FDT_BUF_SIZE];
void patch_dtb(void* dt)
{
int ret;
ret = ramdisk_handler_patch_dtb(dt, &fdt_buf, sizeof(fdt_buf));
if (ret != 0)
printk(KERN_ERR, "failed to patch dtb\n");
else
dt = &fdt_buf;
}