3 .PHONY
:all dirs
clean am_i_root help check_env
14 $(OBJ_DIR
)/modules.o \
15 $(OBJ_DIR
)/uevents.o \
20 $(OBJ_DIR
)/decimal.o \
26 ULINUX_NQUIET_OBJS
+= \
28 OBJS
+= $(ULINUX_NQUIET_OBJS
)
31 #******************************************************************************
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)"
38 all:am_i_root check_env dirs ulinux
/arch
$(BUILD_DIR
)/$(KERNEL_VERSION
).cpio.xz
41 @if
test -z
"$${KERNEL_VERSION}";then echo
"Missing KERNEL_VERSION";false
;fi
44 @if
[ $$(whoami
) != root
];then echo
*ERROR
* must be root to build
;false
;fi
51 ln
-s archs
/$(ARCH
) ulinux
/arch
53 #===============================================================================
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
$@
60 #===============================================================================
62 #===============================================================================
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
$@
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
$@
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 #===============================================================================
80 #the default kernel included initramfs has /dev/console and more
81 #the external initramfs is an overlay of this internal default initramfs
83 $(CPIO_DIR
)/dev
/console
:
84 mknod
--mode
=0600 $(CPIO_DIR
)/dev
/console c
5 1
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
;\
90 find .
-print | cpio
--format
=newc
--create
>$${DEST_FILE}
92 $(BUILD_DIR
)/$(KERNEL_VERSION
).cpio.xz
:$(BUILD_DIR
)/$(KERNEL_VERSION
).cpio
93 xz
--force --check=crc32
--extreme
--stdout
$< >$@
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
$@
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
$@
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
$@
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
$@
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
$@
120 $(CPIO_DIR
)/init
:$(OBJS
)
121 $(LD
) $(LDFLAGS
) $(OBJS
) --output
$@
124 .
/script
/modules_list.sh
>$@
129 -rm -f modules_list.h