first commit
This commit is contained in:
commit
72ed3b4f0f
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
components/*
|
||||||
|
cdroot/init.cpio
|
||||||
|
cdroot/bzImage
|
||||||
|
initramfs/*/*
|
62
Makefile
Normal file
62
Makefile
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
CORES := $(shell nproc)
|
||||||
|
PWD := $(shell pwd)
|
||||||
|
LINUX_DIR := $(PWD)/components/linux
|
||||||
|
MUSL_DIR := $(PWD)/components/musl
|
||||||
|
BUSYBOX_DIR := $(PWD)/components/busybox
|
||||||
|
LINUX_CFG := $(LINUX_DIR)/.config
|
||||||
|
MUSL_CFG := $(MUSL_DIR)/config.mak
|
||||||
|
BUSYBOX_CFG := $(BUSYBOX_DIR)/.config
|
||||||
|
LINUX_OUT := $(LINUX_DIR)/arch/x86/boot/bzImage
|
||||||
|
MUSL_OUT := $(MUSL_DIR)/lib/libc.so
|
||||||
|
BUSYBOX_OUT := $(BUSYBOX_DIR)/busybox
|
||||||
|
DOWNLOAD_SCRIPT := $(PWD)/scripts/download-components.sh
|
||||||
|
CONFIGS_DIR := $(PWD)/configs
|
||||||
|
|
||||||
|
MUSL_GCC := "${REALGCC:-gcc}" "$@" -specs "$(MUSL_DIR)/lib/musl-gcc.specs"
|
||||||
|
|
||||||
|
.PHONY: all deps linux busybox clean
|
||||||
|
|
||||||
|
all: deps linux busybox
|
||||||
|
|
||||||
|
deps:
|
||||||
|
@echo "Downloading dependencies..."
|
||||||
|
@$(DOWNLOAD_SCRIPT)
|
||||||
|
|
||||||
|
linux: $(LINUX_OUT)
|
||||||
|
|
||||||
|
$(LINUX_OUT): $(LINUX_CFG)
|
||||||
|
@echo "Building Linux kernel..."
|
||||||
|
@$(MAKE) -C $(LINUX_DIR) -j $(CORES)
|
||||||
|
|
||||||
|
$(LINUX_CFG):
|
||||||
|
@echo "Copying Linux config..."
|
||||||
|
@cp -r $(CONFIGS_DIR)/linux/. $(LINUX_DIR)/
|
||||||
|
|
||||||
|
musl: $(MUSL_OUT)
|
||||||
|
|
||||||
|
$(MUSL_SPECS): $(MUSL_OUT)
|
||||||
|
$(MUSL_OUT): $(MUSL_CFG)
|
||||||
|
make -C components/musl -j $(CORES)
|
||||||
|
|
||||||
|
$(MUSL_CFG):
|
||||||
|
@echo "Configuring musl..."
|
||||||
|
cd components/musl && ./configure --prefix=/usr
|
||||||
|
|
||||||
|
busybox: musl $(BUSYBOX_OUT)
|
||||||
|
|
||||||
|
$(BUSYBOX_OUT): $(BUSYBOX_CFG)
|
||||||
|
@echo "Building BusyBox..."
|
||||||
|
@$(MAKE) -C $(BUSYBOX_DIR) -j $(CORES) CC="$(MUSL_GCC)"
|
||||||
|
|
||||||
|
$(BUSYBOX_CFG):
|
||||||
|
@echo "Copying BusyBox config..."
|
||||||
|
@cp -r $(CONFIGS_DIR)/busybox/. $(BUSYBOX_DIR)/
|
||||||
|
|
||||||
|
install: linux busybox
|
||||||
|
@cp $(LINUX_OUT) cdroot/
|
||||||
|
$(MAKE) -C $(BUSYBOX_DIR) install CONFIG_PREFIX=$(PWD)/initramfs -j $(CORES)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo "Cleaning up build artifacts..."
|
||||||
|
@$(MAKE) -C $(LINUX_DIR) clean
|
||||||
|
@$(MAKE) -C $(BUSYBOX_DIR) clean
|
4
cdroot/isolinux.cfg
Normal file
4
cdroot/isolinux.cfg
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
DEFAULT linux
|
||||||
|
LABEL linux
|
||||||
|
KERNEL bzImage
|
||||||
|
INITRD init.cpio
|
BIN
cdroot/isolinux/isolinux.bin
Normal file
BIN
cdroot/isolinux/isolinux.bin
Normal file
Binary file not shown.
BIN
cdroot/isolinux/ldlinux.c32
Normal file
BIN
cdroot/isolinux/ldlinux.c32
Normal file
Binary file not shown.
1231
configs/busybox/.config
Normal file
1231
configs/busybox/.config
Normal file
File diff suppressed because it is too large
Load diff
4898
configs/linux/.config
Normal file
4898
configs/linux/.config
Normal file
File diff suppressed because it is too large
Load diff
1
initramfs/bin
Symbolic link
1
initramfs/bin
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
usr/bin
|
1
initramfs/lib
Symbolic link
1
initramfs/lib
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
usr/lib
|
1
initramfs/lib64
Symbolic link
1
initramfs/lib64
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
usr/lib
|
1
initramfs/sbin
Symbolic link
1
initramfs/sbin
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
usr/bin
|
57
scripts/download-components.sh
Executable file
57
scripts/download-components.sh
Executable file
|
@ -0,0 +1,57 @@
|
||||||
|
KERNEL_VERSION="6.7.4"
|
||||||
|
KERNEL_MAJOR="${KERNEL_VERSION%%.*}"
|
||||||
|
KERNEL_NAME="linux-$KERNEL_VERSION"
|
||||||
|
KERNEL_URL="https://cdn.kernel.org/pub/linux/kernel/v$KERNEL_MAJOR.x/$KERNEL_NAME.tar.xz"
|
||||||
|
|
||||||
|
BUSYBOX_VERSION="1.36.1"
|
||||||
|
BUSYBOX_URL="https://busybox.net/downloads/busybox-$BUSYBOX_VERSION.tar.bz2"
|
||||||
|
|
||||||
|
MUSL_VERSION="1.2.4"
|
||||||
|
MUSL_URL="https://musl.libc.org/releases/musl-$MUSL_VERSION.tar.gz"
|
||||||
|
|
||||||
|
mkdir -p components
|
||||||
|
cd components
|
||||||
|
|
||||||
|
download_kernel() {
|
||||||
|
echo "Checking for existing Linux directory..."
|
||||||
|
if [ -d linux ]; then
|
||||||
|
echo "Linux directory present, skipping."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Downloading Linux $KERNEL_VERSION from $KERNEL_URL"
|
||||||
|
curl -L $KERNEL_URL | tar -xJ
|
||||||
|
mv $KERNEL_NAME linux
|
||||||
|
}
|
||||||
|
|
||||||
|
download_busybox() {
|
||||||
|
echo "Checking for existing Busybox directory..."
|
||||||
|
if [ -d busybox ]; then
|
||||||
|
echo "Busybox directory present, skipping."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Downloading Busybox $BUSYBOX_VERSION from $BUSYBOX_URL"
|
||||||
|
curl -L $BUSYBOX_URL | tar -xj
|
||||||
|
mv busybox-$BUSYBOX_VERSION busybox
|
||||||
|
}
|
||||||
|
|
||||||
|
download_musl() {
|
||||||
|
echo "Checking for existing musl directory..."
|
||||||
|
if [ -d musl ]; then
|
||||||
|
echo "musl directory present, skipping."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Downloading musl $MUSL_VERSION from $MUSL_URL"
|
||||||
|
curl -L $MUSL_URL | tar -xz
|
||||||
|
mv musl-$MUSL_VERSION musl
|
||||||
|
}
|
||||||
|
|
||||||
|
download_components() {
|
||||||
|
download_kernel
|
||||||
|
download_busybox
|
||||||
|
download_musl
|
||||||
|
}
|
||||||
|
|
||||||
|
download_components
|
Loading…
Reference in a new issue