BSD Zero Clause License

项目介绍

Limine-Bootloader/limine-c-template 是一个托管在 GitHub 上的开源项目,主要使用 Makefile 编写,采用 BSD Zero Clause License 许可证,目前获得 17 个 Star、1 次 Fork。

仓库全名
Limine-Bootloader/limine-c-template
开源许可证
BSD Zero Clause License
Star 数
17
Fork 数
1

README 摘要

Limine C Template This repository will demonstrate how to set up a basic kernel in C using Limine. How to use this? Dependencies Any make command depends on GNU make (gmake) and is expected to be run using it. This usually means using make on most GNU/Linux distros, or gmake on other non-GNU systems. It is recommended to build this project using a standard UNIX-like system, using a Clang/LLVM toolchain capable of…

完整内容见 GitHub 原始 README 或本页 。

常见问题

limine-c-template 用什么语言开发?

主要使用 Makefile 编写,采用 BSD Zero Clause License 许可证,目前有 17 个 Star。

limine-c-template 可以免费商用吗?

仓库采用 BSD Zero Clause License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 limine-c-template 的源码?

可以直接克隆仓库:git clone https://github.com/Limine-Bootloader/limine-c-template.git;安装与运行步骤见仓库 README。

limine-c-template 最近还在维护吗?

仓库最近一次更新为 6月12日,当前没有未关闭的 Issue;Star 数为 17,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

A simple template for building a Limine-compliant kernel in C.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

语言占比

C
Linker Script
Makefile
Shell

README

Limine C Template

This repository will demonstrate how to set up a basic kernel in C using Limine.

How to use this?

Dependencies

Any make command depends on GNU make (gmake) and is expected to be run using it. This usually means using make on most GNU/Linux distros, or gmake on other non-GNU systems.

It is recommended to build this project using a standard UNIX-like system, using a Clang/LLVM toolchain capable of cross compilation.

Building also requires git, used to fetch the kernel’s dependencies (see kernel/get-deps), curl, used to download the Limine release and the EDK2 OVMF firmware images, and a C compiler for the host (cc by default, see the HOST_CC make variable), used to build the limine host utility.

Additionally, building an ISO with make all requires xorriso, and building a HDD/USB image with make all-hdd requires sgdisk (usually from gdisk or gptfdisk packages) and mtools.

Assembly files with the *.S extension are built using the same toolchain as the C sources. Only *.asm files, which are built for x86_64 alone and of which the template ships none, require nasm. The run targets require qemu.

Toolchain selection

The TOOLCHAIN and TOOLCHAIN_PREFIX make variables can be used to set the toolchain. TOOLCHAIN can be set to llvm to use Clang/LLVM.

For example:

make TOOLCHAIN=llvm

or:

make TOOLCHAIN_PREFIX=x86_64-elf-

The kernel is linked through the compiler driver, using its default linker for GCC and LLD for Clang. A different linker can be picked by adding a -fuse-ld= option to LDFLAGS.

Link-time optimisation can be enabled by adding -flto to CFLAGS, for example:

make CFLAGS='-g -O2 -pipe -flto'

Architectural targets

The ARCH make variable determines the target architecture to build the kernel and image for.

The default ARCH is x86_64. Other options include: aarch64, loongarch64, and riscv64.

Makefile targets

Running make all will compile the kernel (from the kernel/ directory) and then generate a bootable ISO image.

Running make all-hdd will compile the kernel and then generate a raw image suitable to be flashed onto a USB stick or hard drive/SSD.

Running make run will build the kernel and a bootable ISO (equivalent to make all) and then run it using qemu (if installed).

Running make run-hdd will build the kernel and a raw HDD image (equivalent to make all-hdd) and then run it using qemu (if installed).

For x86_64, the run-bios and run-hdd-bios targets are equivalent to their non -bios counterparts except that they boot qemu using the default SeaBIOS firmware instead of OVMF.

评论

暂无评论