Skip to content

Commit 44cebbd

Browse files
committed
Add initial 3.16.6 and 3.16.38 kernels, update README and LICENSE. Add Makefile for building.
1 parent 3f99bf2 commit 44cebbd

File tree

21 files changed

+16823
-2
lines changed

21 files changed

+16823
-2
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 Jidoteki
3+
Copyright (c) 2016 Alexander Williams, Unscramble <[email protected]>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Makefile
2+
#
3+
# Build a TinyCore Linux kernel, modules, and firmware extensions
4+
#
5+
# Usage:
6+
# make kernel extensions os
7+
# make all
8+
9+
MODULES ?= all base filesystems ipv6 mtd netfilter raid-dm scsi
10+
KERNEL ?= 3.16.6
11+
KERNEL_ARCH ?= x86_64
12+
KERNEL_SOURCE ?= http://repo.tinycorelinux.net/6.x/x86_64/release/src/kernel/linux-3.16.6-patched.txz
13+
KERNEL_SHA256 ?= a0a45e4a81ae8ea5685e420b15a4532c9deb8f623069bbccf2838dcbeea25378
14+
OSDIR ?= /opt/tinycore/6.x/x86_64/release/distribution_files
15+
WORKDIR ?= /tmp/tinycore-kernel-build
16+
17+
curdir := $(realpath .)
18+
filename := $(notdir $(KERNEL_SOURCE))
19+
kerneldir := $(WORKDIR)/linux-$(KERNEL)
20+
21+
ifeq ($(KERNEL_ARCH),x86_64)
22+
ostype := 64
23+
osfile := corepure64
24+
kernelname := $(KERNEL)-tinycore$(ostype)
25+
else
26+
ostype :=
27+
osfile := core
28+
kernelname := $(KERNEL)-tinycore
29+
endif
30+
31+
.PHONY: all clean kernel extensions verify-kernel build-kernel compress-modules pkg-modules os
32+
33+
all:
34+
$(MAKE) kernel
35+
$(MAKE) extensions
36+
37+
kernel:
38+
$(MAKE) $(WORKDIR)/$(filename)
39+
$(MAKE) verify-kernel
40+
$(MAKE) build-kernel
41+
42+
extensions:
43+
$(MAKE) compress-modules
44+
$(MAKE) pkg-modules
45+
46+
$(WORKDIR)/$(filename):
47+
cd $(WORKDIR) && \
48+
wget $(KERNEL_SOURCE)
49+
50+
verify-kernel:
51+
cd $(WORKDIR) && \
52+
echo -n "$(KERNEL_SHA256) $(filename)" | sha256sum -c -
53+
54+
build-kernel:
55+
rm -rf $(kerneldir)
56+
cd $(WORKDIR) && \
57+
tar -Jxf $(filename) -C $(WORKDIR)
58+
cp -v $(curdir)/kernels/config-$(kernelname) $(kerneldir)/.config
59+
$(MAKE) -C $(kerneldir) oldconfig
60+
$(MAKE) -C $(kerneldir) bzImage
61+
$(MAKE) -C $(kerneldir) modules
62+
$(MAKE) -C $(kerneldir) INSTALL_MOD_PATH=$(WORKDIR)/modules-$(KERNEL) modules_install firmware_install
63+
cp -v $(kerneldir)/arch/x86/boot/bzImage $(WORKDIR)/vmlinuz$(ostype)
64+
65+
compress-modules:
66+
cd $(WORKDIR)/modules-$(KERNEL) && \
67+
find . -type f -name "*.ko" -exec strip --strip-unneeded {} \; && \
68+
find . -type f -name "*.ko" -exec gzip {} \;
69+
70+
$(WORKDIR)/%-$(kernelname).tcz:
71+
cd $(WORKDIR) && \
72+
rm -rf modules-$* && \
73+
mkdir -p modules-$*/usr/local/lib/modules/$(kernelname)
74+
cd $(WORKDIR)/modules-$(KERNEL)/lib/modules/$(kernelname) && \
75+
for i in `cat $(curdir)/modules/$(kernelname)/$*.txt`; do \
76+
cp -v --parents $$i $(WORKDIR)/modules-$*/usr/local/lib/modules/$(kernelname)/; \
77+
done
78+
79+
cd $(WORKDIR) && \
80+
mksquashfs modules-$* $@
81+
82+
pkg-modules:
83+
for module in $(MODULES); do \
84+
[ -f "$(curdir)/modules/$(kernelname)/$$module.txt" ] && $(MAKE) $(WORKDIR)/$$module-$(kernelname).tcz || { >&2 echo "Missing module file: $(curdir)/modules/$(kernelname)/$$module.txt"; exit 127; }; \
85+
done
86+
87+
os:
88+
rm -rf $(WORKDIR)/os-$(osfile)
89+
mkdir -p $(WORKDIR)/os-$(osfile)
90+
cd $(WORKDIR)/os-$(osfile) && \
91+
gunzip -c $(OSDIR)/$(osfile).gz | cpio -id && \
92+
rm -rf lib/modules/* && \
93+
mkdir -p lib/modules/$(kernelname) && \
94+
cp -rp $(WORKDIR)/modules-base/usr/local/lib/modules/$(kernelname)/kernel lib/modules/$(kernelname)/
95+
cd $(WORKDIR)/modules-$(KERNEL)/lib/modules/$(kernelname) && \
96+
cp modules.alias modules.dep $(WORKDIR)/os-$(osfile)/lib/modules/$(kernelname)/
97+
ln -sf /usr/local/lib/modules/$(kernelname)/kernel $(WORKDIR)/os-$(osfile)/lib/modules/$(kernelname)/kernel.tclocal
98+
cd $(WORKDIR)/os-$(osfile)/lib/modules/$(kernelname) && \
99+
sed -i 's/.ko/.ko.gz/g' modules.dep
100+
$(MAKE) $(WORKDIR)/$(osfile)
101+
102+
$(WORKDIR)/$(osfile):
103+
cd $(WORKDIR)/os-$(osfile) && \
104+
find | sort | cpio -o -H newc > $(WORKDIR)/$(osfile)
105+
$(MAKE) $(WORKDIR)/$(osfile).gz
106+
107+
$(WORKDIR)/$(osfile).gz:
108+
cd $(WORKDIR) && \
109+
gzip -c $(osfile) > $(osfile).gz
110+
111+
clean:
112+
rm -rf $(kerneldir) $(WORKDIR)/$(filename) $(WORKDIR)/modules-* $(WORKDIR)/vmlinuz$(ostype) $(WORKDIR)/*$(kernelname).tcz $(WORKDIR)/$(osfile)* $(WORKDIR)/os-$(osfile)

README.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,67 @@
11
# tinycore-kernel
2-
TinyCore Linux kernel and module compile scripts
2+
3+
Build a [TinyCore Linux](http://tinycorelinux.net/) kernel, modules, and firmware extensions
4+
5+
# Getting Started
6+
7+
Clone this repository.
8+
9+
### Building a kernel from scratch
10+
11+
The default kernel is `3.16.6-tinycore64`
12+
13+
1. `make kernel`
14+
2. `cd /tmp/tinycore-kernel-build`
15+
3. The kernel will be named `vmlinuz64`
16+
17+
### Building default module extensions
18+
19+
Default modules extensions are `all, base, filesystems, ipv6, mtd, netfilter, raid-dm, scsi`.
20+
21+
The `all` extension will contain _all_ the modules.
22+
23+
The `base` extension will contain the _base_ modules which are included of the OS `core.gz/corepure64.gz`.
24+
25+
1. `make extensions`
26+
2. `cd /tmp/tinycore-kernel-build`
27+
3. The module extensions will be named `<module>-3.16.6-tinycore64.tcz`
28+
29+
### Rebuilding the OS (remaster) with new modules
30+
31+
The default OS will be searched for in `/opt/tinycore/6.x/x86_64/release/distribution_files/`.
32+
33+
1. `make os`
34+
2. `cd /tmp/tinycore-kernel-build`
35+
3. The compressed OS will be named `corepure64.gz` and uncompressed OS will be named `corepure64`
36+
37+
### Cleaning up
38+
39+
Many directories and files will be created in the `WORKDIR`, to cleanup, simply type `make clean`.
40+
41+
# Makefile variables
42+
43+
The following variables can be changed at build time, by specifying them as arguments, ex: `make MODULES=ipv6`
44+
45+
* `MODULES`: List of modules to build
46+
* `KERNEL`: Kernel version to build
47+
* `KERNEL_ARCH`: Kernel architecture to build, either `x86_64` or `x86`
48+
* `KERNEL_SOURCE`: URL of the kernel source package (`.tar.xz or .txz`)
49+
* `KERNEL_SHA256`: SHA256 hash of the kernel source package
50+
* `OSDIR`: Local system directory containing the TinyCore OS (`core.gz or corepure64.gz`)
51+
* `WORKDIR`: Temporary work path to build all the files
52+
53+
# Notes
54+
55+
This is a very early initial release, so it may be buggy, and might not be complete. Please inspect `WORKDIR` after building, if you want to package firmwares or additional modules.
56+
57+
# Contributing
58+
59+
If you find any bugs or issues, please [create an issue](https://github.com/jidoteki/tinycore-kernel/issues/new).
60+
61+
If you want to improve this, please make a pull-request.
62+
63+
# License
64+
65+
[MIT License](LICENSE)
66+
67+
Copyright (c) 2016 Alexander Williams, Unscramble <[email protected]>

0 commit comments

Comments
 (0)