File makefile deleted (index 5fe71f5..0000000) |
1 |
|
include conf.mk |
|
2 |
|
|
|
3 |
|
.PHONY:all dirs clean am_i_root help check_env |
|
4 |
|
|
|
5 |
|
DIRS=\ |
|
6 |
|
$(S_DIR) \ |
|
7 |
|
$(OBJ_DIR) \ |
|
8 |
|
$(MODULES_DIR) \ |
|
9 |
|
$(CPIO_DIR)/dev \ |
|
10 |
|
$(CPIO_DIR)/newroot |
|
11 |
|
|
|
12 |
|
OBJS=\ |
|
13 |
|
$(OBJ_DIR)/init.o \ |
|
14 |
|
$(OBJ_DIR)/modules.o \ |
|
15 |
|
$(OBJ_DIR)/uevents.o \ |
|
16 |
|
$(OBJ_DIR)/uevent.o \ |
|
17 |
|
$(OBJ_DIR)/ramfs.o |
|
18 |
|
|
|
19 |
|
ULINUX_OBJS=\ |
|
20 |
|
$(OBJ_DIR)/decimal.o \ |
|
21 |
|
$(OBJ_DIR)/string.o \ |
|
22 |
|
$(OBJ_DIR)/mem.o |
|
23 |
|
OBJS+= $(ULINUX_OBJS) |
|
24 |
|
|
|
25 |
|
ifndef QUIET |
|
26 |
|
ULINUX_NQUIET_OBJS+= \ |
|
27 |
|
$(OBJ_DIR)/vsprintf.o |
|
28 |
|
OBJS+= $(ULINUX_NQUIET_OBJS) |
|
29 |
|
endif |
|
30 |
|
|
|
31 |
|
#****************************************************************************** |
|
32 |
|
help: |
|
33 |
|
@echo "targets are 'all', 'help'(this output), 'clean'" |
|
34 |
|
@echo -e "you can configure the build with the following variables:\\n\ |
|
35 |
|
SYSROOT, KERNEL_VERSION (mandatory), ARCH, MODULES, CC, LD, CFLAGS,\\n\ |
|
36 |
|
LDFLAGS (you can tune the conf.mk file)" |
|
37 |
|
|
|
38 |
|
all:am_i_root check_env dirs ulinux/arch $(BUILD_DIR)/$(KERNEL_VERSION).cpio.xz |
|
39 |
|
|
|
40 |
|
check_env: |
|
41 |
|
@if test -z "$${KERNEL_VERSION}";then echo "Missing KERNEL_VERSION";false;fi |
|
42 |
|
|
|
43 |
|
am_i_root: |
|
44 |
|
@if [ $$(whoami) != root ];then echo *ERROR* must be root to build;false;fi |
|
45 |
|
|
|
46 |
|
dirs:$(DIRS) |
|
47 |
|
$(DIRS): |
|
48 |
|
-mkdir -p $@ |
|
49 |
|
|
|
50 |
|
ulinux/arch: |
|
51 |
|
ln -s archs/$(ARCH) ulinux/arch |
|
52 |
|
|
|
53 |
|
#=============================================================================== |
|
54 |
|
ifndef QUIET |
|
55 |
|
$(S_DIR)/vsprintf.s:ulinux/utils/ascii/string/vsprintf.c |
|
56 |
|
$(CC) $(CFLAGS) $< -o $@ |
|
57 |
|
$(OBJ_DIR)/vsprintf.o:$(S_DIR)/vsprintf.s |
|
58 |
|
$(AS) $(ASFLAGS) $< -o $@ |
|
59 |
|
endif |
|
60 |
|
#=============================================================================== |
|
61 |
|
|
|
62 |
|
#=============================================================================== |
|
63 |
|
#ulinux objets |
|
64 |
|
$(S_DIR)/mem.s:ulinux/arch/utils/mem.c |
|
65 |
|
$(CC) $(CFLAGS) $< -o $@ |
|
66 |
|
$(OBJ_DIR)/mem.o:$(S_DIR)/mem.s |
|
67 |
|
$(AS) $(ASFLAGS) $< -o $@ |
|
68 |
|
|
|
69 |
|
$(S_DIR)/decimal.s:ulinux/utils/ascii/string/conv/decimal/decimal.c |
|
70 |
|
$(CC) $(CFLAGS) $< -o $@ |
|
71 |
|
$(OBJ_DIR)/decimal.o:$(S_DIR)/decimal.s |
|
72 |
|
$(AS) $(ASFLAGS) $< -o $@ |
|
73 |
|
|
|
74 |
|
$(S_DIR)/string.s:ulinux/utils/ascii/string/string.c |
|
75 |
|
$(CC) $(CFLAGS) $< -o $@ |
|
76 |
|
$(OBJ_DIR)/string.o:$(S_DIR)/string.s |
|
77 |
|
$(AS) $(ASFLAGS) $< -o $@ |
|
78 |
|
#=============================================================================== |
|
79 |
|
|
|
80 |
|
#the default kernel included initramfs has /dev/console and more |
|
81 |
|
#the external initramfs is an overlay of this internal default initramfs |
|
82 |
|
#see linux/usr |
|
83 |
|
$(CPIO_DIR)/dev/console: |
|
84 |
|
mknod --mode=0600 $(CPIO_DIR)/dev/console c 5 1 |
|
85 |
|
|
|
86 |
|
$(BUILD_DIR)/$(KERNEL_VERSION).cpio:$(CPIO_DIR)/init $(CPIO_DIR)/dev/console |
|
87 |
|
chown -R 0:0 $(CPIO_DIR) |
|
88 |
|
DEST_FILE=$$(realpath $(BUILD_DIR))/$(KERNEL_VERSION).cpio;\ |
|
89 |
|
cd $(CPIO_DIR);\ |
|
90 |
|
find . -print | cpio --format=newc --create >$${DEST_FILE} |
|
91 |
|
|
|
92 |
|
$(BUILD_DIR)/$(KERNEL_VERSION).cpio.xz:$(BUILD_DIR)/$(KERNEL_VERSION).cpio |
|
93 |
|
xz --force --check=crc32 --extreme --stdout $< >$@ |
|
94 |
|
|
|
95 |
|
$(S_DIR)/modules.s:modules.c modules_list.h globals.h |
|
96 |
|
$(CC) $(CFLAGS) $< -o $@ |
|
97 |
|
$(OBJ_DIR)/modules.o:$(S_DIR)/modules.s |
|
98 |
|
$(AS) $(ASFLAGS) $< -o $@ |
|
99 |
|
|
|
100 |
|
$(S_DIR)/uevent.s:uevent.c globals.h |
|
101 |
|
$(CC) $(CFLAGS) $< -o $@ |
|
102 |
|
$(OBJ_DIR)/uevent.o:$(S_DIR)/uevent.s |
|
103 |
|
$(AS) $(ASFLAGS) $< -o $@ |
|
104 |
|
|
|
105 |
|
$(S_DIR)/uevents.s:uevents.c globals.h |
|
106 |
|
$(CC) $(CFLAGS) $< -o $@ |
|
107 |
|
$(OBJ_DIR)/uevents.o:$(S_DIR)/uevents.s |
|
108 |
|
$(AS) $(ASFLAGS) $< -o $@ |
|
109 |
|
|
|
110 |
|
$(S_DIR)/ramfs.s:ramfs.c globals.h |
|
111 |
|
$(CC) $(CFLAGS) $< -o $@ |
|
112 |
|
$(OBJ_DIR)/ramfs.o:$(S_DIR)/ramfs.s |
|
113 |
|
$(AS) $(ASFLAGS) $< -o $@ |
|
114 |
|
|
|
115 |
|
$(S_DIR)/init.s:init.c modules.h uevents.h ramfs.h globals.h |
|
116 |
|
$(CC) $(CFLAGS) $< -o $@ |
|
117 |
|
$(OBJ_DIR)/init.o:$(S_DIR)/init.s |
|
118 |
|
$(AS) $(ASFLAGS) $< -o $@ |
|
119 |
|
|
|
120 |
|
$(CPIO_DIR)/init:$(OBJS) |
|
121 |
|
$(LD) $(LDFLAGS) $(OBJS) --output $@ |
|
122 |
|
|
|
123 |
|
modules_list.h: |
|
124 |
|
./script/modules_list.sh >$@ |
|
125 |
|
|
|
126 |
|
clean: |
|
127 |
|
-rm -f ulinux/arch |
|
128 |
|
-rm -Rf $(BUILD_DIR) |
|
129 |
|
-rm -f modules_list.h |
|