/makefile (f1ab6368bf5226ead56d46d4a83daec21155ae7a) (3511 bytes) (mode 100644) (type blob)
include conf.mk
.PHONY:all dirs clean am_i_root help check_env
DIRS=\
$(S_DIR) \
$(OBJ_DIR) \
$(MODULES_DIR) \
$(CPIO_DIR)/dev \
$(CPIO_DIR)/newroot
OBJS=\
$(OBJ_DIR)/init.o \
$(OBJ_DIR)/modules.o \
$(OBJ_DIR)/uevents.o \
$(OBJ_DIR)/uevent.o \
$(OBJ_DIR)/ramfs.o
ULINUX_OBJS=\
$(OBJ_DIR)/decimal.o \
$(OBJ_DIR)/string.o \
$(OBJ_DIR)/mem.o
OBJS+= $(ULINUX_OBJS)
ifndef QUIET
ULINUX_NQUIET_OBJS+= \
$(OBJ_DIR)/vsprintf.o
OBJS+= $(ULINUX_NQUIET_OBJS)
endif
#******************************************************************************
help:
@echo "targets are 'all', 'help'(this output), 'clean'"
@echo -e "you can configure the build with the following variables:\\n\
SYSROOT, KERNEL_VERSION (mandatory), ARCH, MODULES, CC, LD, CFLAGS,\\n\
LDFLAGS (you can tune the conf.mk file)"
all:am_i_root check_env dirs ulinux/arch $(BUILD_DIR)/initramfs.cpio.xz
check_env:
@if test -z "$${KERNEL_VERSION}";then echo "Missing KERNEL_VERSION";false;fi
am_i_root:
@if [ $$(whoami) != root ];then echo *ERROR* must be root to build;false;fi
dirs:$(DIRS)
$(DIRS):
-mkdir -p $@
ulinux/arch:
ln -s archs/$(ARCH) ulinux/arch
#===============================================================================
ifndef QUIET
$(S_DIR)/vsprintf.s:ulinux/utils/ascii/string/vsprintf.c
$(CC) $(CFLAGS) $< -o $@
$(OBJ_DIR)/vsprintf.o:$(S_DIR)/vsprintf.s
$(AS) $(ASFLAGS) $< -o $@
endif
#===============================================================================
#===============================================================================
#ulinux objets
$(S_DIR)/mem.s:ulinux/arch/utils/mem.c
$(CC) $(CFLAGS) $< -o $@
$(OBJ_DIR)/mem.o:$(S_DIR)/mem.s
$(AS) $(ASFLAGS) $< -o $@
$(S_DIR)/decimal.s:ulinux/utils/ascii/string/conv/decimal/decimal.c
$(CC) $(CFLAGS) $< -o $@
$(OBJ_DIR)/decimal.o:$(S_DIR)/decimal.s
$(AS) $(ASFLAGS) $< -o $@
$(S_DIR)/string.s:ulinux/utils/ascii/string/string.c
$(CC) $(CFLAGS) $< -o $@
$(OBJ_DIR)/string.o:$(S_DIR)/string.s
$(AS) $(ASFLAGS) $< -o $@
#===============================================================================
#the default kernel included initramfs has /dev/console and more
#the external initramfs is an overlay of this internal default initramfs
#see linux/usr
$(CPIO_DIR)/dev/console:
mknod --mode=0600 $(CPIO_DIR)/dev/console c 5 1
$(BUILD_DIR)/initramfs.cpio:$(CPIO_DIR)/init $(CPIO_DIR)/dev/console
chown -R 0:0 $(CPIO_DIR)
DEST_FILE=$$(realpath $(BUILD_DIR))/initramfs.cpio;\
cd $(CPIO_DIR);\
find . -print | cpio --format=newc --create >$${DEST_FILE}
$(BUILD_DIR)/initramfs.cpio.xz:$(BUILD_DIR)/initramfs.cpio
xz --force --check=crc32 --extreme --stdout $< >$@
$(S_DIR)/modules.s:modules.c modules_list.h globals.h
$(CC) $(CFLAGS) $< -o $@
$(OBJ_DIR)/modules.o:$(S_DIR)/modules.s
$(AS) $(ASFLAGS) $< -o $@
$(S_DIR)/uevent.s:uevent.c globals.h
$(CC) $(CFLAGS) $< -o $@
$(OBJ_DIR)/uevent.o:$(S_DIR)/uevent.s
$(AS) $(ASFLAGS) $< -o $@
$(S_DIR)/uevents.s:uevents.c globals.h
$(CC) $(CFLAGS) $< -o $@
$(OBJ_DIR)/uevents.o:$(S_DIR)/uevents.s
$(AS) $(ASFLAGS) $< -o $@
$(S_DIR)/ramfs.s:ramfs.c globals.h
$(CC) $(CFLAGS) $< -o $@
$(OBJ_DIR)/ramfs.o:$(S_DIR)/ramfs.s
$(AS) $(ASFLAGS) $< -o $@
$(S_DIR)/init.s:init.c modules.h uevents.h ramfs.h globals.h
$(CC) $(CFLAGS) $< -o $@
$(OBJ_DIR)/init.o:$(S_DIR)/init.s
$(AS) $(ASFLAGS) $< -o $@
$(CPIO_DIR)/init:$(OBJS)
$(LD) $(LDFLAGS) $(OBJS) --output $@
modules_list.h:
./script/modules_list.sh >$@
clean:
-rm -f ulinux/arch
-rm -Rf $(BUILD_DIR)
-rm -f modules_list.h
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
34500 |
d5445e7ac8422305d107420de4ab8e1ee6227cca |
LICENSE.md |
100644 |
blob |
474 |
7a42d994441512f51ef00734953e94e3cb89548b |
README |
100644 |
blob |
92 |
1d211b5e32c93edc091f1b1bd3f0ff9b06e1d765 |
TODO |
100644 |
blob |
1035 |
cb6010e68bf5ec8eace28d721b635dc0a4bee52c |
conf.mk |
100644 |
blob |
715 |
736621ea6373728f5ea091cf7f0705225b93f7b6 |
globals.h |
100644 |
blob |
5046 |
3989b586f4c49cf5c07d69a9088228f0c0b2028d |
init.c |
100644 |
blob |
3511 |
f1ab6368bf5226ead56d46d4a83daec21155ae7a |
makefile |
100644 |
blob |
1714 |
b701806637f3779cd8697b53f6533ef5d9c8f80e |
modules.c |
100644 |
blob |
406 |
f5e162a64baf80fef122ef374b138aa50fc4158b |
modules.h |
100644 |
blob |
3264 |
d0b3b3d53097117b7919f5b35936ad6f44a44dd0 |
ramfs.c |
100644 |
blob |
403 |
4e38d9f1f1c8c5235493322737469627277f86c4 |
ramfs.h |
040000 |
tree |
- |
05675bc0e91096e2d9be441909dd301c49e7f6d2 |
script |
100644 |
blob |
3358 |
6c62952dc3479ba202b797f412a2f203d58ca52b |
uevent.c |
100644 |
blob |
416 |
867f22d10d93effd2a58227deded6274f63ebcfd |
uevent.h |
100644 |
blob |
4158 |
cef85f6fdac6d626135a76df290eb774056b9532 |
uevents.c |
100644 |
blob |
463 |
233e58ec60a14a4fd0d984fb96fb70326ddb0654 |
uevents.h |
040000 |
tree |
- |
2c408b1f2db0904b4a75faa48e2a0904eccd626b |
ulinux |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/sylware/cinitramfs
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/sylware/cinitramfs
Clone this repository using git:
git clone git://git.rocketgit.com/user/sylware/cinitramfs
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main