From 87d1a2597ceedd03a7d4005db1bf82b72b423a18 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 26 Nov 2024 21:43:54 +0100 Subject: Show the detected machine model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally I was planning to detect the machine model just in case we needed to do workaround for special cases. But since apparently even VisionFive2 brings its own CPU frequency base on DT, this is not even needed. Hence, fetching the model is now a cool message being shown on boot. Signed-off-by: Miquel Sabaté Solà --- kernel/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'kernel') diff --git a/kernel/main.c b/kernel/main.c index a39ed29..ecb93da 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -18,6 +18,7 @@ struct task_struct tasks[4] = { // Defined in fbos/init.h. struct dt_info info = { + .model = { '\0' }, .cpu_freq = 0, .initrd_start = 0, .initrd_end = 0, @@ -36,6 +37,13 @@ __noreturn __kernel void start_kernel(void *dtb) get_dt_info(dtb, &info); extract_initrd((unsigned char *)info.initrd_start, info.initrd_end - info.initrd_start, tasks); + // If we were able to fetch the model, print it now. + if (info.model[0] != '\0') { + printk("Running on: "); + printk(info.model); + printk("\n"); + } + // At this point everything has already been handled: setup the interrupt // vector and enable the timer to start ticking and scheduling the three // tasks at hand. -- cgit v1.2.3