Build a TinyCore Linux kernel, modules, and firmware extensions
- Install build dependencies:
tce-load -wi git compiletc coreutils bc
- Clone this repository:
git clone https://github.com/jidoteki/tinycore-kernel
The default kernel is 4.19.34-tinycore64
make kernel
cd /tmp/tinycore-kernel-build
- The kernel will be named
vmlinuz64
Default modules extensions are all, base, filesystems, ipv6, mtd, netfilter, raid-dm, scsi, net-bridging
.
The all
extension will contain all the modules.
The base
extension will contain the base modules which are included of the OS core.gz/corepure64.gz
.
make extensions
cd /tmp/tinycore-kernel-build
- The module extensions will be named
<module>-4.9.66-tinycore64.tcz
The default OS will be searched for in /opt/tinycore/8.x/x86_64/release/distribution_files/
.
make os
cd /tmp/tinycore-kernel-build
- The compressed OS will be named
corepure64.gz
and uncompressed OS will be namedcorepure64
Many directories and files will be created in the WORKDIR
, to cleanup, simply type make clean
.
The following variables can be changed at build time, by specifying them as arguments, ex: make MODULES=ipv6
MODULES
: List of modules to buildKERNEL
: Kernel version to buildKERNEL_ARCH
: Kernel architecture to build, eitherx86_64
orx86
KERNEL_SOURCE
: URL of the kernel source package (.tar.xz or .txz
)KERNEL_SHA256
: SHA256 hash of the kernel source packageOSDIR
: Local system directory containing the TinyCore OS (core.gz or corepure64.gz
)WORKDIR
: Temporary work path to build all the files
TinyCore Linux kernel compiling comes with a few gotchas. The list below will hopefully help others who may run into these problems when manually compiling.
This occurs when you recompile the kernel (ex: vmlinuz64
) without recompiling the modules and/or module extensions. The base
modules in the OS (ex: corepure64.gz
) must be replaced, as well as any module extensions (ex: ipv6-4.9.66-tinycore64.tcz
).
The modules.dep
file should point to .ko.gz
kernel modules, but Linux compiles them as .ko
by default. The Makefile
in this repo gzips all modules, and then performs a sed
on the newly built modules.dep
to ensure it also contains .ko.gz
entries. This modules.dep
will be rebuilt on boot anyways, but it still needs to be correct initially.
The kernel.tclocal
symlink is also needed for kernel module extensions to be loaded. See the TinyCore Custom Kernel wiki page for more info.
If you edit the kernel config using make menuconfig
or other, and add new modules, you will need to create a new extension containing those modules. It is recommended to do that as opposed to adding them directly in the OS. Adding them to the OS can lead to problems in the future if you accidentally "forget" to include them when you update TinyCore.
The default TinyCore Linux kernel is compiled with a set of cosmetic/boot Linux kernel patches, and one patch for AGP. We excluded them in our newer kernel builds (ex: 3.16.38-tinycore64
), but you're better off patching your kernel with those patches if you experience strange system behaviour.
Please inspect WORKDIR
after building, if you want to package firmwares or additional modules.
If you find any bugs or issues, please create an issue.
If you want to improve this, please make a pull-request.
Copyright (c) 2016-2019 Alexander Williams, Unscramble [email protected]