restructure dirs for easier target additions
This commit is contained in:
parent
4afedd00a2
commit
1dbea5251d
22
Makefile
22
Makefile
|
@ -4,14 +4,14 @@ KEY_DIR := keys
|
||||||
SRC_DIR := src
|
SRC_DIR := src
|
||||||
TARGET := local
|
TARGET := local
|
||||||
CACHE_DIR := cache
|
CACHE_DIR := cache
|
||||||
CONFIG_DIR := targets/$(TARGET)
|
CONFIG_DIR := config
|
||||||
TOOLCHAIN_DIR := toolchain
|
TOOLCHAIN_DIR := toolchain
|
||||||
SCRIPTS_DIR := scripts
|
SRC_DIR := src
|
||||||
USER := $(shell id -g):$(shell id -g)
|
USER := $(shell id -g):$(shell id -g)
|
||||||
CPUS := $(shell nproc)
|
CPUS := $(shell nproc)
|
||||||
ARCH := x86_64
|
ARCH := x86_64
|
||||||
|
|
||||||
include $(PWD)/config.env
|
include $(PWD)/config/global.env
|
||||||
include $(PWD)/make/keys.mk
|
include $(PWD)/make/keys.mk
|
||||||
include $(PWD)/make/fetch.mk
|
include $(PWD)/make/fetch.mk
|
||||||
include $(PWD)/toolchain/Makefile
|
include $(PWD)/toolchain/Makefile
|
||||||
|
@ -65,8 +65,8 @@ busybox-config:
|
||||||
# Run linux config menu and save output
|
# Run linux config menu and save output
|
||||||
.PHONY: linux-config
|
.PHONY: linux-config
|
||||||
linux-config:
|
linux-config:
|
||||||
rm $(CONFIG_DIR)/linux.config
|
rm $(CONFIG_DIR)/$(TARGET)/linux.config
|
||||||
make $(CONFIG_DIR)/linux.config
|
make $(CONFIG_DIR)/$(TARGET)/linux.config
|
||||||
|
|
||||||
# This can likely be eliminated with path fixes in toolchain/Makefile
|
# This can likely be eliminated with path fixes in toolchain/Makefile
|
||||||
$(OUT_DIR)/toolchain.tar:
|
$(OUT_DIR)/toolchain.tar:
|
||||||
|
@ -83,11 +83,11 @@ $(CONFIG_DIR)/busybox.config:
|
||||||
cp .config /config/busybox.config; \
|
cp .config /config/busybox.config; \
|
||||||
")
|
")
|
||||||
|
|
||||||
$(CONFIG_DIR)/linux.config:
|
$(CONFIG_DIR)/$(TARGET)/linux.config:
|
||||||
$(call toolchain,$(USER)," \
|
$(call toolchain,$(USER)," \
|
||||||
cd /cache/linux-$(LINUX_VERSION) && \
|
cd /cache/linux-$(LINUX_VERSION) && \
|
||||||
make menuconfig && \
|
make menuconfig && \
|
||||||
cp .config /config/linux.config; \
|
cp .config /config/$(TARGET)/linux.config; \
|
||||||
")
|
")
|
||||||
|
|
||||||
$(OUT_DIR)/busybox: \
|
$(OUT_DIR)/busybox: \
|
||||||
|
@ -126,7 +126,7 @@ $(OUT_DIR)/rootfs.cpio: \
|
||||||
mkdir -p $(CACHE_DIR)/rootfs/bin
|
mkdir -p $(CACHE_DIR)/rootfs/bin
|
||||||
ifeq ($(DEBUG), true)
|
ifeq ($(DEBUG), true)
|
||||||
cp $(OUT_DIR)/sample_init $(CACHE_DIR)/rootfs/sample_init
|
cp $(OUT_DIR)/sample_init $(CACHE_DIR)/rootfs/sample_init
|
||||||
cp $(SCRIPTS_DIR)/busybox_init $(CACHE_DIR)/rootfs/init
|
cp $(SRC_DIR)/scripts/busybox_init $(CACHE_DIR)/rootfs/init
|
||||||
cp $(OUT_DIR)/busybox $(CACHE_DIR)/rootfs/bin/
|
cp $(OUT_DIR)/busybox $(CACHE_DIR)/rootfs/bin/
|
||||||
else
|
else
|
||||||
cp $(OUT_DIR)/sample_init $(CACHE_DIR)/rootfs/init
|
cp $(OUT_DIR)/sample_init $(CACHE_DIR)/rootfs/init
|
||||||
|
@ -136,7 +136,9 @@ endif
|
||||||
find . -mindepth 1 -execdir touch -hcd "@0" "{}" + && \
|
find . -mindepth 1 -execdir touch -hcd "@0" "{}" + && \
|
||||||
find . -mindepth 1 -printf '%P\0' && \
|
find . -mindepth 1 -printf '%P\0' && \
|
||||||
cd /cache/linux-$(LINUX_VERSION) && \
|
cd /cache/linux-$(LINUX_VERSION) && \
|
||||||
usr/gen_initramfs.sh -o /out/rootfs.cpio /config/rootfs.list && \
|
usr/gen_initramfs.sh \
|
||||||
|
-o /out/rootfs.cpio \
|
||||||
|
/config/$(TARGET)/rootfs.list && \
|
||||||
cpio -itv < /out/rootfs.cpio && \
|
cpio -itv < /out/rootfs.cpio && \
|
||||||
sha256sum /out/rootfs.cpio; \
|
sha256sum /out/rootfs.cpio; \
|
||||||
")
|
")
|
||||||
|
@ -145,7 +147,7 @@ $(OUT_DIR)/bzImage: \
|
||||||
$(OUT_DIR)/rootfs.cpio
|
$(OUT_DIR)/rootfs.cpio
|
||||||
$(call toolchain,$(USER)," \
|
$(call toolchain,$(USER)," \
|
||||||
cd /cache/linux-$(LINUX_VERSION) && \
|
cd /cache/linux-$(LINUX_VERSION) && \
|
||||||
cp /config/linux.config .config && \
|
cp /config/$(TARGET)/linux.config .config && \
|
||||||
make olddefconfig && \
|
make olddefconfig && \
|
||||||
make -j$(CPUS) ARCH=$(ARCH) bzImage && \
|
make -j$(CPUS) ARCH=$(ARCH) bzImage && \
|
||||||
cp arch/x86_64/boot/bzImage /out/ && \
|
cp arch/x86_64/boot/bzImage /out/ && \
|
||||||
|
|
|
@ -20,11 +20,10 @@ define toolchain
|
||||||
--user=$(1) \
|
--user=$(1) \
|
||||||
--platform=linux/$(ARCH) \
|
--platform=linux/$(ARCH) \
|
||||||
--volume $(PWD)/$(CONFIG_DIR):/config \
|
--volume $(PWD)/$(CONFIG_DIR):/config \
|
||||||
--volume $(PWD)/$(KEY_DIR):/keys \
|
|
||||||
--volume $(PWD)/$(CACHE_DIR):/cache \
|
--volume $(PWD)/$(CACHE_DIR):/cache \
|
||||||
|
--volume $(PWD)/$(KEY_DIR):/keys \
|
||||||
--volume $(PWD)/$(OUT_DIR):/out \
|
--volume $(PWD)/$(OUT_DIR):/out \
|
||||||
--volume $(PWD)/$(SRC_DIR):/src \
|
--volume $(PWD)/$(SRC_DIR):/src \
|
||||||
--volume $(PWD)/$(SCRIPTS_DIR):/scripts \
|
|
||||||
--env GNUPGHOME=/cache/.gnupg \
|
--env GNUPGHOME=/cache/.gnupg \
|
||||||
--env ARCH=$(ARCH) \
|
--env ARCH=$(ARCH) \
|
||||||
--env KBUILD_BUILD_USER=$(KBUILD_BUILD_USER) \
|
--env KBUILD_BUILD_USER=$(KBUILD_BUILD_USER) \
|
||||||
|
|
Loading…
Reference in New Issue