2024-10-10 13:24:20 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2022-06-14 14:14:56 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
|
|
|
*/
|
|
|
|
|
2024-09-26 12:27:12 +00:00
|
|
|
#include <board.h>
|
2022-06-14 14:14:56 +00:00
|
|
|
#include <main.h>
|
2023-07-19 19:48:06 +00:00
|
|
|
#include <string.h>
|
2024-10-10 13:24:20 +00:00
|
|
|
#include <lib/debug.h>
|
2022-06-14 14:14:56 +00:00
|
|
|
|
2024-10-08 18:17:10 +00:00
|
|
|
/*
|
|
|
|
* Provide an empty board config that has
|
|
|
|
* to be filled in the board files
|
|
|
|
* TODO: figure out why having it in
|
|
|
|
* the board files makes devices reboot.
|
|
|
|
*/
|
|
|
|
struct board_data board = {
|
|
|
|
.name = "default",
|
|
|
|
.ops = {
|
|
|
|
[BOARD_OP_INIT] = BOARD_OP_INIT,
|
|
|
|
[BOARD_OP_LATE_INIT] = BOARD_OP_LATE_INIT,
|
|
|
|
[BOARD_OP_DRIVER_SETUP] = BOARD_OP_DRIVER_SETUP,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-10-12 16:39:11 +00:00
|
|
|
void main(void* dt, void* kernel, void* ramdisk)
|
2024-10-08 18:17:10 +00:00
|
|
|
{
|
2022-06-14 14:14:56 +00:00
|
|
|
/* Initialize SoC and Board specific peripherals/quirks */
|
2024-10-08 18:17:10 +00:00
|
|
|
init_board_funcs(&board);
|
2022-06-14 14:14:56 +00:00
|
|
|
|
2024-10-08 18:17:10 +00:00
|
|
|
EXECUTE_BOARD_OP(board.ops[BOARD_OP_INIT]);
|
|
|
|
EXECUTE_BOARD_OP(board.ops[BOARD_OP_DRIVER_SETUP]);
|
|
|
|
EXECUTE_BOARD_OP(board.ops[BOARD_OP_LATE_INIT]);
|
2024-09-26 12:27:12 +00:00
|
|
|
|
2024-10-10 13:24:20 +00:00
|
|
|
printk(-1, " .__.____ .___\n");
|
|
|
|
printk(-1, " __ __ ____ |__| | _________ __| _/___________\n");
|
|
|
|
printk(-1, "| | \\/ \\| | | / _ \\__ \\ / __ |/ __ \\_ __\\\n");
|
|
|
|
printk(-1, "| | / | \\ | |__( <_> ) __ \\_/ /_/ \\ ___/| |\\/\n");
|
|
|
|
printk(-1, "|____/|___| /__|_______ \\____(____ /\\____ |\\___ >__|\n");
|
|
|
|
printk(-1, " \\/ \\/ \\/ \\/ \\/\n");
|
|
|
|
|
|
|
|
printk(-1, "Passed board initialization!\n");
|
|
|
|
printk(-1, "Welcome to uniLoader!\n");
|
2022-06-14 14:14:56 +00:00
|
|
|
|
|
|
|
/* Copy kernel to memory and boot */
|
2024-10-10 13:24:20 +00:00
|
|
|
printk(-1, "Booting linux...\n");
|
2023-07-18 11:41:37 +00:00
|
|
|
|
|
|
|
memcpy((void*)CONFIG_PAYLOAD_ENTRY, kernel, (unsigned long) &kernel_size);
|
2024-10-12 16:39:11 +00:00
|
|
|
__optimized_memcpy((void*)CONFIG_RAMDISK_ENTRY, ramdisk, (unsigned long) &ramdisk_size);
|
2023-07-18 11:41:37 +00:00
|
|
|
load_kernel(dt, 0, 0, 0, (void*)CONFIG_PAYLOAD_ENTRY);
|
|
|
|
|
|
|
|
/* We shouldn't get there */
|
2024-10-10 13:24:20 +00:00
|
|
|
printk(KERN_WARNING, "Something wrong happened, we shouldn't be here. Hanging....\n");
|
2023-07-18 11:41:37 +00:00
|
|
|
while(1) {}
|
2022-06-14 14:14:56 +00:00
|
|
|
}
|