mirror of
https://github.com/ivoszbg/uniLoader.git
synced 2026-05-17 10:40:04 +00:00
- 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>
41 lines
1.2 KiB
C
41 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
|
*/
|
|
|
|
#include <board.h>
|
|
#include <main/boot.h>
|
|
#include <main/main.h>
|
|
#include <lib/debug.h>
|
|
|
|
extern struct board_data board_ops;
|
|
|
|
static void print_splash(void)
|
|
{
|
|
printk(KERN_INFO, " .__.____ .___\n");
|
|
printk(KERN_INFO, " __ __ ____ |__| | _________ __| _/___________\n");
|
|
printk(KERN_INFO, "| | \\/ \\| | | / _ \\__ \\ / __ |/ __ \\_ __\\\n");
|
|
printk(KERN_INFO, "| | / | \\ | |__( <_> ) __ \\_/ /_/ \\ ___/| |\\/\n");
|
|
printk(KERN_INFO, "|____/|___| /__|_______ \\____(____ /\\____ |\\___ >__|\n");
|
|
printk(KERN_INFO, " \\/ \\/ \\/ \\/ \\/\n");
|
|
|
|
printk(KERN_INFO, "passed board initialization\n");
|
|
printk(KERN_INFO, "welcome to uniLoader %s on %s\n", VER_TAG, board_ops.name);
|
|
}
|
|
|
|
void main(void* dt, void* kernel, void* ramdisk)
|
|
{
|
|
INITCALL(board_ops.ops.early_init);
|
|
INITCALL(board_ops.ops.drivers_init);
|
|
|
|
print_splash();
|
|
|
|
INITCALL(board_ops.ops.late_init);
|
|
|
|
boot_kernel(dt, kernel, ramdisk);
|
|
|
|
// todo: reset the board?
|
|
printk(KERN_EMERG, "Something wrong happened, we shouldn't be here. Hanging....\n");
|
|
HANG();
|
|
}
|