Skip to content

Commit 8823696

Browse files
committed
FIXED
1 parent 337783a commit 8823696

3 files changed

Lines changed: 42 additions & 25 deletions

File tree

.traerules

Lines changed: 0 additions & 20 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,21 @@ set(CMAKE_ASM_NASM_FLAGS "-f elf32")
1111
project(BasicallyLinux C ASM_NASM)
1212

1313
# Toolchain configuration (can be overridden by command line)
14-
set(CMAKE_C_COMPILER i686-linux-gnu-gcc)
15-
set(CMAKE_ASM_NASM_COMPILER nasm)
14+
if(NOT CMAKE_C_COMPILER)
15+
find_program(C_COMPILER_I686 i686-linux-gnu-gcc)
16+
find_program(C_COMPILER_ELF i686-elf-gcc)
17+
if(C_COMPILER_I686)
18+
set(CMAKE_C_COMPILER ${C_COMPILER_I686})
19+
elseif(C_COMPILER_ELF)
20+
set(CMAKE_C_COMPILER ${C_COMPILER_ELF})
21+
else()
22+
set(CMAKE_C_COMPILER gcc) # Fallback to system gcc
23+
endif()
24+
endif()
25+
26+
if(NOT CMAKE_ASM_NASM_COMPILER)
27+
set(CMAKE_ASM_NASM_COMPILER nasm)
28+
endif()
1629

1730
# Compilation flags for C files only
1831
add_compile_options(
@@ -33,8 +46,23 @@ add_compile_options(
3346
include_directories(include)
3447

3548
# Source discovery
36-
file(GLOB_RECURSE ASM_SOURCES "src/*.asm")
37-
file(GLOB_RECURSE C_SOURCES "src/*.c")
49+
message(STATUS "Searching for sources in ${CMAKE_CURRENT_SOURCE_DIR}/src")
50+
file(GLOB_RECURSE ASM_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.asm")
51+
file(GLOB_RECURSE C_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c")
52+
53+
# Debugging: print found sources if they are empty
54+
if(NOT ASM_SOURCES AND NOT C_SOURCES)
55+
message(WARNING "No source files found in ${CMAKE_CURRENT_SOURCE_DIR}/src. Trying relative path...")
56+
file(GLOB_RECURSE ASM_SOURCES "src/*.asm")
57+
file(GLOB_RECURSE C_SOURCES "src/*.c")
58+
endif()
59+
60+
if(NOT ASM_SOURCES AND NOT C_SOURCES)
61+
message(FATAL_ERROR "No source files found in any search path!")
62+
endif()
63+
64+
message(STATUS "Found ${ASM_SOURCES} ASM files")
65+
message(STATUS "Found ${C_SOURCES} C files")
3866

3967
# AI model blob handling
4068
set(MODEL_BLOB "${CMAKE_CURRENT_SOURCE_DIR}/model.bin")
@@ -54,10 +82,14 @@ if(EXISTS "${MODEL_BLOB}")
5482
else()
5583
message(WARNING "AI model blob not found. Kernel will be built without AI support.")
5684
set(MODEL_OBJ_PATH "")
85+
add_compile_definitions(NO_AI_MODEL)
5786
endif()
5887

5988
# Ensure boot.asm is ALWAYS FIRST in the link order to keep Multiboot header at the top
60-
set(BOOT_ASM "${CMAKE_CURRENT_SOURCE_DIR}/src/boot.asm")
89+
set(BOOT_ASM "${CMAKE_CURRENT_SOURCE_DIR}/src/arch/x86/boot.asm")
90+
if(NOT EXISTS "${BOOT_ASM}")
91+
message(FATAL_ERROR "Could not find boot.asm at ${BOOT_ASM}")
92+
endif()
6193
list(REMOVE_ITEM ASM_SOURCES "${BOOT_ASM}")
6294
set(ASM_SOURCES "${BOOT_ASM}" ${ASM_SOURCES})
6395

src/ai/ai_model.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@
1414
#include "smp_rally.h"
1515
#include "sched.h"
1616

17+
#ifndef NO_AI_MODEL
1718
extern uint8_t _ai_model_start;
1819
extern uint8_t _ai_model_end;
20+
#else
21+
static uint8_t _ai_model_start = 0;
22+
static uint8_t _ai_model_end = 0;
23+
#endif
1924

2025
static uint8_t* ai_mapped_base = 0;
2126
static uint32_t ai_mapped_size = 0;

0 commit comments

Comments
 (0)