disable debug by default, and favor sample 'hello world' init binary

This commit is contained in:
Lance Vick 2022-07-27 17:27:16 -07:00
parent 6ba4832be4
commit 4afedd00a2
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
3 changed files with 26 additions and 1 deletions

View File

@ -1,6 +1,7 @@
DEBUG := true
DEBUG := false
OUT_DIR := out
KEY_DIR := keys
SRC_DIR := src
TARGET := local
CACHE_DIR := cache
CONFIG_DIR := targets/$(TARGET)
@ -100,6 +101,14 @@ $(OUT_DIR)/busybox: \
cp busybox /out/; \
")
$(OUT_DIR)/sample_init:
$(call toolchain,$(USER)," \
gcc \
-static \
-static-libgcc /src/sample/init.c \
-o /out/sample_init; \
")
$(CACHE_DIR)/linux-$(LINUX_VERSION)/usr/gen_init_cpio: \
$(CACHE_DIR)/linux-$(LINUX_VERSION) \
$(CACHE_DIR)/linux-$(LINUX_VERSION) \
@ -112,10 +121,16 @@ $(CACHE_DIR)/linux-$(LINUX_VERSION)/usr/gen_init_cpio: \
$(OUT_DIR)/rootfs.cpio: \
$(OUT_DIR)/busybox \
$(OUT_DIR)/sample_init \
$(CACHE_DIR)/linux-$(LINUX_VERSION)/usr/gen_init_cpio
mkdir -p $(CACHE_DIR)/rootfs/bin
ifeq ($(DEBUG), true)
cp $(OUT_DIR)/sample_init $(CACHE_DIR)/rootfs/sample_init
cp $(SCRIPTS_DIR)/busybox_init $(CACHE_DIR)/rootfs/init
cp $(OUT_DIR)/busybox $(CACHE_DIR)/rootfs/bin/
else
cp $(OUT_DIR)/sample_init $(CACHE_DIR)/rootfs/init
endif
$(call toolchain,$(USER)," \
cd /cache/rootfs && \
find . -mindepth 1 -execdir touch -hcd "@0" "{}" + && \

9
src/sample/init.c Normal file
View File

@ -0,0 +1,9 @@
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv) {
(void) argc;
(void) argv;
puts("Appliance Linux Sample Init");
sleep(0xFFFFFFFF);
}

View File

@ -23,6 +23,7 @@ define toolchain
--volume $(PWD)/$(KEY_DIR):/keys \
--volume $(PWD)/$(CACHE_DIR):/cache \
--volume $(PWD)/$(OUT_DIR):/out \
--volume $(PWD)/$(SRC_DIR):/src \
--volume $(PWD)/$(SCRIPTS_DIR):/scripts \
--env GNUPGHOME=/cache/.gnupg \
--env ARCH=$(ARCH) \