mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-25 14:04:33 +00:00
build: fix kernel build on different architectures
Userspace still fails to compile on non-x86!!!
This commit is contained in:
parent
33eee9c628
commit
0735743f44
251
.vscode/tasks.json
vendored
251
.vscode/tasks.json
vendored
@ -6,6 +6,7 @@
|
||||
"type": "shell",
|
||||
"command": "make clean",
|
||||
"isBackground": false,
|
||||
"hide": false,
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
@ -29,6 +30,7 @@
|
||||
"type": "shell",
|
||||
"command": "make build",
|
||||
"isBackground": false,
|
||||
"hide": false,
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
@ -52,6 +54,7 @@
|
||||
"type": "shell",
|
||||
"command": "make qemu",
|
||||
"isBackground": false,
|
||||
"hide": false,
|
||||
"dependsOn": [
|
||||
"Build"
|
||||
],
|
||||
@ -78,6 +81,7 @@
|
||||
"type": "shell",
|
||||
"command": "make -C ../ build_bootloader",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
@ -100,6 +104,7 @@
|
||||
"type": "shell",
|
||||
"command": "make -C ../ build_kernel",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"dependsOn": [
|
||||
"Build Bootloader"
|
||||
],
|
||||
@ -125,6 +130,7 @@
|
||||
"type": "shell",
|
||||
"command": "make -C ../ build_drivers",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"dependsOn": [
|
||||
"Build Kernel"
|
||||
],
|
||||
@ -150,6 +156,7 @@
|
||||
"type": "shell",
|
||||
"command": "make -C ../ build_userspace",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"dependsOn": [
|
||||
"Build Drivers"
|
||||
],
|
||||
@ -175,6 +182,7 @@
|
||||
"type": "shell",
|
||||
"command": "make -C ../ build_image",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"dependsOn": [
|
||||
"Build Userspace"
|
||||
],
|
||||
@ -242,6 +250,249 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "CI AMD64 Debug",
|
||||
"type": "shell",
|
||||
"command": "make __ci-amd64-debug",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"dependsOn": [
|
||||
"Clean"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "shared"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/../",
|
||||
"shell": {
|
||||
"executable": "bash",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "CI AMD64 Release",
|
||||
"type": "shell",
|
||||
"command": "make __ci-amd64-release",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"dependsOn": [
|
||||
"CI AMD64 Debug"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "shared"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/../",
|
||||
"shell": {
|
||||
"executable": "bash",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "CI i386 Debug",
|
||||
"type": "shell",
|
||||
"command": "make __ci-i386-debug",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"dependsOn": [
|
||||
"CI AMD64 Release"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "shared"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/../",
|
||||
"shell": {
|
||||
"executable": "bash",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "CI i386 Release",
|
||||
"type": "shell",
|
||||
"command": "make __ci-i386-release",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"dependsOn": [
|
||||
"CI i386 Debug"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "shared"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/../",
|
||||
"shell": {
|
||||
"executable": "bash",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "CI ARM Debug",
|
||||
"type": "shell",
|
||||
"command": "make __ci-arm-debug",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"dependsOn": [
|
||||
"CI i386 Release"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "shared"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/../",
|
||||
"shell": {
|
||||
"executable": "bash",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "CI ARM Release",
|
||||
"type": "shell",
|
||||
"command": "make __ci-arm-release",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"dependsOn": [
|
||||
"CI ARM Debug"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "shared"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/../",
|
||||
"shell": {
|
||||
"executable": "bash",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "CI AARCH64 Debug",
|
||||
"type": "shell",
|
||||
"command": "make __ci-aarch64-debug",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"dependsOn": [
|
||||
"CI ARM Release"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "shared"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/../",
|
||||
"shell": {
|
||||
"executable": "bash",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "CI AARCH64 Release",
|
||||
"type": "shell",
|
||||
"command": "make __ci-aarch64-release",
|
||||
"isBackground": false,
|
||||
"hide": true,
|
||||
"dependsOn": [
|
||||
"CI AARCH64 Debug"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "shared"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/../",
|
||||
"shell": {
|
||||
"executable": "bash",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Test CI Build",
|
||||
"type": "shell",
|
||||
"command": "make __ci-restore-config",
|
||||
"isBackground": false,
|
||||
"dependsOn": [
|
||||
"CI AARCH64 Release",
|
||||
"clean"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": false
|
||||
},
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "shared"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/../",
|
||||
"shell": {
|
||||
"executable": "bash",
|
||||
"args": [
|
||||
"-c"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -122,16 +122,10 @@ namespace KernelConsole
|
||||
return;
|
||||
|
||||
ConsoleTerminal *term = CurrentTerminal.load();
|
||||
ConsoleTerminal::Blinker *blinker = &term->Blink;
|
||||
|
||||
ConsoleTerminal::Blinker &blinker = term->Blink;
|
||||
TerminalCell *cell = term->Term->GetCell(Renderer.Cursor.X + Renderer.Cursor.Y * term->Term->GetWinsize()->ws_row);
|
||||
|
||||
uint32_t bgColor = cell->attr.Bright ? TermBrightColors[cell->attr.Background] : TermColors[cell->attr.Background];
|
||||
|
||||
Renderer.Paint(Renderer.Cursor.X, Renderer.Cursor.Y,
|
||||
term->Blink.Character,
|
||||
Enable ? term->Blink.Color : bgColor,
|
||||
bgColor);
|
||||
Renderer.Paint(Renderer.Cursor.X, Renderer.Cursor.Y, blinker.Character, Enable ? blinker.Color : bgColor, bgColor);
|
||||
}
|
||||
|
||||
void paint_blinker_thread()
|
||||
|
@ -363,11 +363,11 @@ namespace Driver
|
||||
driverInfo.License = (const char *)(Drv.BaseAddress + (uintptr_t)driverInfo.License);
|
||||
}
|
||||
|
||||
for (size_t h = 0; h < (sht_symtab.sh_size / sizeof(Elf64_Sym)); h++)
|
||||
for (size_t h = 0; h < (sht_symtab.sh_size / sizeof(Elf_Sym)); h++)
|
||||
{
|
||||
Elf64_Sym symEntry{};
|
||||
uintptr_t symOffset = sht_symtab.sh_offset + (h * sizeof(Elf64_Sym));
|
||||
File->Read(&symEntry, sizeof(Elf64_Sym), symOffset);
|
||||
Elf_Sym symEntry{};
|
||||
uintptr_t symOffset = sht_symtab.sh_offset + (h * sizeof(Elf_Sym));
|
||||
File->Read(&symEntry, sizeof(Elf_Sym), symOffset);
|
||||
|
||||
if (symEntry.st_name == 0)
|
||||
continue;
|
||||
@ -477,10 +477,10 @@ namespace Driver
|
||||
{
|
||||
AssertReturnError(relaSize != nullptr, -ENOEXEC);
|
||||
|
||||
Elf64_Rela *rela = (Elf64_Rela *)(Drv.BaseAddress + dyn->d_un.d_ptr);
|
||||
for (size_t i = 0; i < (relaSize->d_un.d_val / sizeof(Elf64_Rela)); i++)
|
||||
Elf_Rela *rela = (Elf_Rela *)(Drv.BaseAddress + dyn->d_un.d_ptr);
|
||||
for (size_t i = 0; i < (relaSize->d_un.d_val / sizeof(Elf_Rela)); i++)
|
||||
{
|
||||
Elf64_Rela *r = &rela[i];
|
||||
Elf_Rela *r = &rela[i];
|
||||
uintptr_t *reloc = (uintptr_t *)(Drv.BaseAddress + r->r_offset);
|
||||
uintptr_t relocTarget = 0;
|
||||
|
||||
@ -500,8 +500,7 @@ namespace Driver
|
||||
}
|
||||
default:
|
||||
{
|
||||
fixme("Unhandled relocation type: %#lx",
|
||||
ELF64_R_TYPE(r->r_info));
|
||||
fixme("Unhandled relocation type: %#lx", ELF_R_TYPE(r->r_info));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -517,24 +516,24 @@ namespace Driver
|
||||
{
|
||||
AssertReturnError(pltrelSize != nullptr, -ENOEXEC);
|
||||
|
||||
std::vector<Elf64_Dyn> symtab = Execute::ELFGetDynamicTag(File, DT_SYMTAB);
|
||||
Elf64_Sym *symbols = (Elf64_Sym *)((uintptr_t)Drv.BaseAddress + symtab[0].d_un.d_ptr);
|
||||
std::vector<Elf_Dyn> symtab = Execute::ELFGetDynamicTag(File, DT_SYMTAB);
|
||||
Elf_Sym *symbols = (Elf_Sym *)((uintptr_t)Drv.BaseAddress + symtab[0].d_un.d_ptr);
|
||||
|
||||
std::vector<Elf64_Dyn> StrTab = Execute::ELFGetDynamicTag(File, DT_STRTAB);
|
||||
std::vector<Elf_Dyn> StrTab = Execute::ELFGetDynamicTag(File, DT_STRTAB);
|
||||
char *dynStr = (char *)((uintptr_t)Drv.BaseAddress + StrTab[0].d_un.d_ptr);
|
||||
|
||||
Elf64_Rela *rela = (Elf64_Rela *)(Drv.BaseAddress + dyn->d_un.d_ptr);
|
||||
for (size_t i = 0; i < (pltrelSize->d_un.d_val / sizeof(Elf64_Rela)); i++)
|
||||
Elf_Rela *rela = (Elf_Rela *)(Drv.BaseAddress + dyn->d_un.d_ptr);
|
||||
for (size_t i = 0; i < (pltrelSize->d_un.d_val / sizeof(Elf_Rela)); i++)
|
||||
{
|
||||
Elf64_Rela *r = &rela[i];
|
||||
Elf_Rela *r = &rela[i];
|
||||
uintptr_t *reloc = (uintptr_t *)(Drv.BaseAddress + r->r_offset);
|
||||
|
||||
switch (ELF64_R_TYPE(r->r_info))
|
||||
switch (ELF_R_TYPE(r->r_info))
|
||||
{
|
||||
case R_X86_64_JUMP_SLOT:
|
||||
{
|
||||
Elf64_Xword symIndex = ELF64_R_SYM(r->r_info);
|
||||
Elf64_Sym *sym = symbols + symIndex;
|
||||
Elf_Xword symIndex = ELF_R_SYM(r->r_info);
|
||||
Elf_Sym *sym = symbols + symIndex;
|
||||
|
||||
const char *symName = dynStr + sym->st_name;
|
||||
debug("Resolving symbol %s", symName);
|
||||
@ -544,8 +543,7 @@ namespace Driver
|
||||
}
|
||||
default:
|
||||
{
|
||||
fixme("Unhandled relocation type: %#lx",
|
||||
ELF64_R_TYPE(r->r_info));
|
||||
fixme("Unhandled relocation type: %#lx", ELF_R_TYPE(r->r_info));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
const char *trusted_drivers[] = {
|
||||
"ae08d2e120c8370278ca9e17085a6b9e2f4a470ab6cec824c77ab1f8706c7144f5d4e1c9820914ed4fc7a4fd22de4b18bfed7c3b5d9c1e604e82280d7d45a5c7",
|
||||
"66ff6a13e27cfee4b37e153fbdeeabb2de44f2a6a4d7f929f0b48d05a08b44c8c543f15c6cee05b5392166088f5ba260db5a64476d150ce81b295e4aa5a85d32",
|
||||
};
|
||||
const __SIZE_TYPE__ trusted_drivers_count = sizeof(trusted_drivers) / sizeof(trusted_drivers[0]);
|
||||
|
@ -65,9 +65,9 @@ namespace Execute
|
||||
uintptr_t *relPtr = (uintptr_t *)(((uintptr_t)BaseImage + target->sh_offset) + rel->r_offset);
|
||||
uintptr_t value = 0;
|
||||
|
||||
if (ELF64_R_SYM(rel->r_info) != SHN_UNDEF)
|
||||
if (ELF_R_SYM(rel->r_info) != SHN_UNDEF)
|
||||
{
|
||||
value = ELFGetSymbolValue(((Elf_Ehdr *)BaseImage), section->sh_link, ELF64_R_SYM(rel->r_info));
|
||||
value = ELFGetSymbolValue(((Elf_Ehdr *)BaseImage), section->sh_link, ELF_R_SYM(rel->r_info));
|
||||
if (value == (uintptr_t)-1)
|
||||
return;
|
||||
}
|
||||
|
@ -327,6 +327,7 @@ enum DynamicArrayTags
|
||||
#define ELF32_ST_BIND(info) ((info) >> 4)
|
||||
#define ELF32_ST_TYPE(info) ((info) & 0xf)
|
||||
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
|
||||
#define ELF64_ST_BIND(info) ((info) >> 4)
|
||||
#define ELF64_ST_TYPE(info) ((info) & 0xf)
|
||||
#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
@ -956,7 +957,7 @@ typedef struct
|
||||
char pr_psargs[ELF_PRARGSZ];
|
||||
} Elf64_Prpsinfo;
|
||||
|
||||
#if defined(__amd64__) || defined(__aarch64__)
|
||||
#ifdef __LP64__
|
||||
typedef Elf64_Addr Elf_Addr;
|
||||
typedef Elf64_Half Elf_Half;
|
||||
typedef Elf64_Off Elf_Off;
|
||||
@ -973,7 +974,16 @@ typedef Elf64_Rela Elf_Rela;
|
||||
typedef Elf64_Nhdr Elf_Nhdr;
|
||||
typedef Elf64_Prstatus Elf_Prstatus;
|
||||
typedef Elf64_Prpsinfo Elf_Prpsinfo;
|
||||
#elif defined(__i386__) || defined(__arm__)
|
||||
typedef Elf64_Xword Elf_Xword;
|
||||
|
||||
#define ELF_ST_BIND(info) ELF64_ST_BIND(info)
|
||||
#define ELF_ST_TYPE(info) ELF64_ST_TYPE(info)
|
||||
#define ELF_ST_INFO(bind, type) ELF64_ST_INFO(bind, type)
|
||||
#define ELF_ST_VISIBILITY(o) ELF64_ST_VISIBILITY(o)
|
||||
#define ELF_R_SYM(i) ELF64_R_SYM(i)
|
||||
#define ELF_R_TYPE(i) ELF64_R_TYPE(i)
|
||||
#define ELF_R_INFO(s, t) ELF64_R_INFO(s, t)
|
||||
#else
|
||||
typedef Elf32_Addr Elf_Addr;
|
||||
typedef Elf32_Half Elf_Half;
|
||||
typedef Elf32_Off Elf_Off;
|
||||
@ -990,6 +1000,15 @@ typedef Elf32_Rela Elf_Rela;
|
||||
typedef Elf32_Nhdr Elf_Nhdr;
|
||||
typedef Elf32_Prstatus Elf_Prstatus;
|
||||
typedef Elf32_Prpsinfo Elf_Prpsinfo;
|
||||
typedef Elf32_Word Elf_Xword;
|
||||
|
||||
#define ELF_ST_BIND(info) ELF32_ST_BIND(info)
|
||||
#define ELF_ST_TYPE(info) ELF32_ST_TYPE(info)
|
||||
#define ELF_ST_INFO(bind, type) ELF32_ST_INFO(bind, type)
|
||||
#define ELF_ST_VISIBILITY(o) ELF32_ST_VISIBILITY(o)
|
||||
#define ELF_R_SYM(i) ELF32_R_SYM(i)
|
||||
#define ELF_R_TYPE(i) ELF32_R_TYPE(i)
|
||||
#define ELF_R_INFO(s, t) ELF32_R_INFO(s, t)
|
||||
#endif
|
||||
|
||||
#endif // !__FENNIX_KERNEL_ELF_H__
|
||||
|
@ -46,7 +46,9 @@ namespace vfs
|
||||
if (FileSystemRoots->Children[Index] == nullptr)
|
||||
FileSystemRoots->Children[Index] = Root;
|
||||
else
|
||||
{
|
||||
debug("Root %ld already exists", Index);
|
||||
}
|
||||
}
|
||||
|
||||
bool Virtual::SetRootAt(Inode *Root, size_t Index)
|
||||
|
@ -42,6 +42,18 @@ namespace Subsystem::Linux
|
||||
FileNode *mnt = fs->ForceCreate(linux, "mnt", 0755);
|
||||
FileNode *opt = fs->ForceCreate(linux, "opt", 0755);
|
||||
FileNode *proc = fs->ForceCreate(linux, "proc", 0755);
|
||||
|
||||
UNUSED(bin);
|
||||
UNUSED(boot);
|
||||
UNUSED(dev);
|
||||
UNUSED(etc);
|
||||
UNUSED(home);
|
||||
UNUSED(lib);
|
||||
UNUSED(lib64);
|
||||
UNUSED(media);
|
||||
UNUSED(mnt);
|
||||
UNUSED(opt);
|
||||
UNUSED(proc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,12 @@ namespace Subsystem::Windows
|
||||
FileNode *programFilesX86 = fs->ForceCreate(windows, "Program Files (x86)", 0755);
|
||||
FileNode *programData = fs->ForceCreate(windows, "ProgramData", 0755);
|
||||
FileNode *users = fs->ForceCreate(windows, "Users", 0755);
|
||||
|
||||
UNUSED(windows);
|
||||
UNUSED(programFiles);
|
||||
UNUSED(programFilesX86);
|
||||
UNUSED(programData);
|
||||
UNUSED(users);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
49
Makefile
49
Makefile
@ -168,53 +168,82 @@ __ci-build-set-debug:
|
||||
ci-setup:
|
||||
$(MAKE) --quiet -C tools ci
|
||||
|
||||
ci-build:
|
||||
# Prepare
|
||||
$(MAKE) prepare
|
||||
$(MAKE) mkdir_rootfs
|
||||
$(MAKE) --quiet -C tools do_limine
|
||||
# amd64
|
||||
__ci-amd64-debug:
|
||||
$(MAKE) __ci-build-set-debug
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-amd64-debug.iso
|
||||
$(MAKE) clean
|
||||
|
||||
__ci-amd64-release:
|
||||
$(MAKE) __ci-build-set-release
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-amd64-release.iso
|
||||
$(MAKE) clean
|
||||
# i386
|
||||
|
||||
__ci-i386-debug:
|
||||
$(MAKE) __ci-build-set-debug
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = i386/' ./config.mk && cat config.mk | grep OSARCH
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-i386-debug.iso
|
||||
$(MAKE) clean
|
||||
|
||||
__ci-i386-release:
|
||||
$(MAKE) __ci-build-set-release
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = i386/' ./config.mk && cat config.mk | grep OSARCH
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-i386-release.iso
|
||||
$(MAKE) clean
|
||||
# ARM
|
||||
|
||||
__ci-arm-debug:
|
||||
$(MAKE) __ci-build-set-debug
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = arm/' ./config.mk && cat config.mk | grep OSARCH
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-arm-debug.iso
|
||||
$(MAKE) clean
|
||||
|
||||
__ci-arm-release:
|
||||
$(MAKE) __ci-build-set-release
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = arm/' ./config.mk && cat config.mk | grep OSARCH
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-arm-release.iso
|
||||
$(MAKE) clean
|
||||
# AArch64
|
||||
|
||||
__ci-aarch64-debug:
|
||||
$(MAKE) __ci-build-set-debug
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = aarch64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-aarch64-debug.iso
|
||||
$(MAKE) clean
|
||||
|
||||
__ci-aarch64-release:
|
||||
$(MAKE) __ci-build-set-release
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = aarch64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
$(MAKE) build
|
||||
mv Fennix.iso Fennix-aarch64-release.iso
|
||||
$(MAKE) clean
|
||||
# Restore original config
|
||||
|
||||
__ci-restore-config:
|
||||
$(MAKE) __ci-build-set-debug
|
||||
sed -i 's/.*OSARCH = .*/OSARCH = amd64/' ./config.mk && cat config.mk | grep OSARCH
|
||||
|
||||
ci-build:
|
||||
# Prepare
|
||||
$(MAKE) prepare
|
||||
$(MAKE) mkdir_rootfs
|
||||
$(MAKE) --quiet -C tools do_limine
|
||||
$(MAKE) clean
|
||||
|
||||
$(MAKE) __ci-amd64-debug
|
||||
$(MAKE) __ci-amd64-release
|
||||
$(MAKE) __ci-i386-debug
|
||||
$(MAKE) __ci-i386-release
|
||||
$(MAKE) __ci-arm-debug
|
||||
$(MAKE) __ci-arm-release
|
||||
$(MAKE) __ci-aarch64-debug
|
||||
$(MAKE) __ci-aarch64-release
|
||||
$(MAKE) __ci-restore-config
|
||||
# Move all files to artifacts directory
|
||||
mkdir -p artifacts
|
||||
$(MAKE) changelog
|
||||
|
34
Userspace/libc/runtime/fennix/aarch64/CMakeLists.txt
Normal file
34
Userspace/libc/runtime/fennix/aarch64/CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(FennixRuntime_${TARGET_OS}_${TARGET_ARCH})
|
||||
|
||||
find_program(COMPILER_PATH NAMES $ENV{CC} gcc REQUIRED)
|
||||
|
||||
set(LIB_OUTPUT_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
file(MAKE_DIRECTORY ${LIB_OUTPUT_DIR})
|
||||
|
||||
add_custom_target(copy_crt_files ALL
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=libgcc.a | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=crtbegin.o | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=crtend.o | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=crti.o | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=crtn.o | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMENT "Copying CRT files"
|
||||
)
|
||||
|
||||
file(GLOB CRT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
|
||||
set(OBJECT_FILES "")
|
||||
foreach(source ${CRT_SOURCES})
|
||||
get_filename_component(name ${source} NAME_WE)
|
||||
set(obj "${CMAKE_BINARY_DIR}/${name}.o")
|
||||
add_custom_command(
|
||||
OUTPUT ${obj}
|
||||
COMMAND ${COMPILER_PATH} -c ${source} -o ${obj}
|
||||
DEPENDS ${source}
|
||||
)
|
||||
list(APPEND OBJECT_FILES ${obj})
|
||||
endforeach()
|
||||
|
||||
if(OBJECT_FILES)
|
||||
add_custom_target(crt_objects ALL DEPENDS ${OBJECT_FILES})
|
||||
install(FILES ${OBJECT_FILES} DESTINATION lib)
|
||||
endif()
|
1
Userspace/libc/runtime/fennix/aarch64/Scrt1.c
Normal file
1
Userspace/libc/runtime/fennix/aarch64/Scrt1.c
Normal file
@ -0,0 +1 @@
|
||||
#include "crt1.c"
|
53
Userspace/libc/runtime/fennix/aarch64/crt1.c
Normal file
53
Userspace/libc/runtime/fennix/aarch64/crt1.c
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
__attribute__((naked, used, no_stack_protector, section(".text"))) void _start()
|
||||
{
|
||||
#warning "crt1.c: _start() is not implemented yet"
|
||||
}
|
||||
|
||||
/* These are declared in GNU ld */
|
||||
enum
|
||||
{
|
||||
NT_FNX_ABI_TAG = 1,
|
||||
NT_FNX_VERSION = 2,
|
||||
NT_FNX_BUILD_ID = 3,
|
||||
NT_FNX_ARCH = 4
|
||||
};
|
||||
|
||||
typedef struct Elf_Nhdr
|
||||
{
|
||||
__UINT32_TYPE__ n_namesz;
|
||||
__UINT32_TYPE__ n_descsz;
|
||||
__UINT32_TYPE__ n_type;
|
||||
char n_name[];
|
||||
} __attribute__((packed)) Elf_Nhdr;
|
||||
|
||||
const struct
|
||||
{
|
||||
Elf_Nhdr header;
|
||||
char name[4];
|
||||
__UINT32_TYPE__ desc[4];
|
||||
} __abi_tag __attribute__((used, aligned(4), section(".note.ABI-tag"))) = {
|
||||
.header = {
|
||||
.n_namesz = 4, /* "FNX" + '\0' */
|
||||
.n_descsz = sizeof(__UINT32_TYPE__) * 4, /* Description Size */
|
||||
.n_type = NT_FNX_ABI_TAG, /* Type */
|
||||
},
|
||||
.name = "FNX",
|
||||
.desc = {0, 0, 0, 0},
|
||||
};
|
34
Userspace/libc/runtime/fennix/arm/CMakeLists.txt
Normal file
34
Userspace/libc/runtime/fennix/arm/CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(FennixRuntime_${TARGET_OS}_${TARGET_ARCH})
|
||||
|
||||
find_program(COMPILER_PATH NAMES $ENV{CC} gcc REQUIRED)
|
||||
|
||||
set(LIB_OUTPUT_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
file(MAKE_DIRECTORY ${LIB_OUTPUT_DIR})
|
||||
|
||||
add_custom_target(copy_crt_files ALL
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=libgcc.a | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=crtbegin.o | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=crtend.o | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=crti.o | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=crtn.o | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMENT "Copying CRT files"
|
||||
)
|
||||
|
||||
file(GLOB CRT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
|
||||
set(OBJECT_FILES "")
|
||||
foreach(source ${CRT_SOURCES})
|
||||
get_filename_component(name ${source} NAME_WE)
|
||||
set(obj "${CMAKE_BINARY_DIR}/${name}.o")
|
||||
add_custom_command(
|
||||
OUTPUT ${obj}
|
||||
COMMAND ${COMPILER_PATH} -c ${source} -o ${obj}
|
||||
DEPENDS ${source}
|
||||
)
|
||||
list(APPEND OBJECT_FILES ${obj})
|
||||
endforeach()
|
||||
|
||||
if(OBJECT_FILES)
|
||||
add_custom_target(crt_objects ALL DEPENDS ${OBJECT_FILES})
|
||||
install(FILES ${OBJECT_FILES} DESTINATION lib)
|
||||
endif()
|
1
Userspace/libc/runtime/fennix/arm/Scrt1.c
Normal file
1
Userspace/libc/runtime/fennix/arm/Scrt1.c
Normal file
@ -0,0 +1 @@
|
||||
#include "crt1.c"
|
53
Userspace/libc/runtime/fennix/arm/crt1.c
Normal file
53
Userspace/libc/runtime/fennix/arm/crt1.c
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
__attribute__((naked, used, no_stack_protector, section(".text"))) void _start()
|
||||
{
|
||||
#warning "crt1.c: _start() is not implemented yet"
|
||||
}
|
||||
|
||||
/* These are declared in GNU ld */
|
||||
enum
|
||||
{
|
||||
NT_FNX_ABI_TAG = 1,
|
||||
NT_FNX_VERSION = 2,
|
||||
NT_FNX_BUILD_ID = 3,
|
||||
NT_FNX_ARCH = 4
|
||||
};
|
||||
|
||||
typedef struct Elf_Nhdr
|
||||
{
|
||||
__UINT32_TYPE__ n_namesz;
|
||||
__UINT32_TYPE__ n_descsz;
|
||||
__UINT32_TYPE__ n_type;
|
||||
char n_name[];
|
||||
} __attribute__((packed)) Elf_Nhdr;
|
||||
|
||||
const struct
|
||||
{
|
||||
Elf_Nhdr header;
|
||||
char name[4];
|
||||
__UINT32_TYPE__ desc[4];
|
||||
} __abi_tag __attribute__((used, aligned(4), section(".note.ABI-tag"))) = {
|
||||
.header = {
|
||||
.n_namesz = 4, /* "FNX" + '\0' */
|
||||
.n_descsz = sizeof(__UINT32_TYPE__) * 4, /* Description Size */
|
||||
.n_type = NT_FNX_ABI_TAG, /* Type */
|
||||
},
|
||||
.name = "FNX",
|
||||
.desc = {0, 0, 0, 0},
|
||||
};
|
34
Userspace/libc/runtime/fennix/i386/CMakeLists.txt
Normal file
34
Userspace/libc/runtime/fennix/i386/CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(FennixRuntime_${TARGET_OS}_${TARGET_ARCH})
|
||||
|
||||
find_program(COMPILER_PATH NAMES $ENV{CC} gcc REQUIRED)
|
||||
|
||||
set(LIB_OUTPUT_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
file(MAKE_DIRECTORY ${LIB_OUTPUT_DIR})
|
||||
|
||||
add_custom_target(copy_crt_files ALL
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=libgcc.a | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=crtbegin.o | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=crtend.o | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=crti.o | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMAND ${COMPILER_PATH} -print-file-name=crtn.o | xargs cp -t ${LIB_OUTPUT_DIR}
|
||||
COMMENT "Copying CRT files"
|
||||
)
|
||||
|
||||
file(GLOB CRT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
|
||||
set(OBJECT_FILES "")
|
||||
foreach(source ${CRT_SOURCES})
|
||||
get_filename_component(name ${source} NAME_WE)
|
||||
set(obj "${CMAKE_BINARY_DIR}/${name}.o")
|
||||
add_custom_command(
|
||||
OUTPUT ${obj}
|
||||
COMMAND ${COMPILER_PATH} -c ${source} -o ${obj}
|
||||
DEPENDS ${source}
|
||||
)
|
||||
list(APPEND OBJECT_FILES ${obj})
|
||||
endforeach()
|
||||
|
||||
if(OBJECT_FILES)
|
||||
add_custom_target(crt_objects ALL DEPENDS ${OBJECT_FILES})
|
||||
install(FILES ${OBJECT_FILES} DESTINATION lib)
|
||||
endif()
|
1
Userspace/libc/runtime/fennix/i386/Scrt1.c
Normal file
1
Userspace/libc/runtime/fennix/i386/Scrt1.c
Normal file
@ -0,0 +1 @@
|
||||
#include "crt1.c"
|
53
Userspace/libc/runtime/fennix/i386/crt1.c
Normal file
53
Userspace/libc/runtime/fennix/i386/crt1.c
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
This file is part of Fennix C Library.
|
||||
|
||||
Fennix C Library is free software: you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
Fennix C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Fennix C Library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
__attribute__((naked, used, no_stack_protector, section(".text"))) void _start()
|
||||
{
|
||||
#warning "crt1.c: _start() is not implemented yet"
|
||||
}
|
||||
|
||||
/* These are declared in GNU ld */
|
||||
enum
|
||||
{
|
||||
NT_FNX_ABI_TAG = 1,
|
||||
NT_FNX_VERSION = 2,
|
||||
NT_FNX_BUILD_ID = 3,
|
||||
NT_FNX_ARCH = 4
|
||||
};
|
||||
|
||||
typedef struct Elf_Nhdr
|
||||
{
|
||||
__UINT32_TYPE__ n_namesz;
|
||||
__UINT32_TYPE__ n_descsz;
|
||||
__UINT32_TYPE__ n_type;
|
||||
char n_name[];
|
||||
} __attribute__((packed)) Elf_Nhdr;
|
||||
|
||||
const struct
|
||||
{
|
||||
Elf_Nhdr header;
|
||||
char name[4];
|
||||
__UINT32_TYPE__ desc[4];
|
||||
} __abi_tag __attribute__((used, aligned(4), section(".note.ABI-tag"))) = {
|
||||
.header = {
|
||||
.n_namesz = 4, /* "FNX" + '\0' */
|
||||
.n_descsz = sizeof(__UINT32_TYPE__) * 4, /* Description Size */
|
||||
.n_type = NT_FNX_ABI_TAG, /* Type */
|
||||
},
|
||||
.name = "FNX",
|
||||
.desc = {0, 0, 0, 0},
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user