1
- .PHONY : % -build build rootfs-% -defconfig rootfs-% -savedefconfig % -nconfig % -menuconfig % -clean clean help rootfs-% initrd-% kernel-%
1
+ .PHONY : % -build build rootfs-% -defconfig rootfs-% -savedefconfig % -nconfig % -menuconfig % -clean clean help rootfs-% initrd-% kernel-% print-outpath- %
2
2
3
3
ROOTDIR := $(realpath .)
4
4
@@ -21,7 +21,7 @@ ROOTDIR := $(realpath .)
21
21
$(MAKE) -C buildroot O=$(ROOTDIR)/out/initrd/$(_ARCH) ROOTFS_CPIO_IMAGE_NAME=initrd all; \
22
22
;; \
23
23
kernel) \
24
- if [ $(_ARCH) == arm64 ]; then \
24
+ if [ $(_ARCH) = arm64 ]; then \
25
25
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/arm64 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- all; \
26
26
else \
27
27
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/amd64 all; \
@@ -64,7 +64,7 @@ build: ##@ Build all arch linux kernel and rootfs and initrd
64
64
$(MAKE) -C buildroot O=$(ROOTDIR)/out/initrd/$(_ARCH) BR2_EXTERNAL=$(ROOTDIR)/buildroot_external initrd_$(_ARCH)_defconfig; \
65
65
;; \
66
66
kernel) \
67
- if [ $(_ARCH) == arm64 ]; then \
67
+ if [ $(_ARCH) = arm64 ]; then \
68
68
mkdir -p $(ROOTDIR)/out/kernel/$(_ARCH)/arch/arm64/configs/; \
69
69
cp $(ROOTDIR)/kernel_external/configs/kernel_$(_ARCH)_defconfig $(ROOTDIR)/out/kernel/$(_ARCH)/arch/arm64/configs/; \
70
70
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/$(_ARCH) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- kernel_$(_ARCH)_defconfig; \
@@ -96,7 +96,7 @@ build: ##@ Build all arch linux kernel and rootfs and initrd
96
96
echo "generate $(ROOTDIR)/buildroot_external/configs/initrd_$(_ARCH)_defconfig"; \
97
97
;; \
98
98
kernel) \
99
- if [ $(_ARCH) == arm64 ]; then \
99
+ if [ $(_ARCH) = arm64 ]; then \
100
100
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/$(_ARCH) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- savedefconfig; \
101
101
else \
102
102
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/$(_ARCH) savedefconfig; \
@@ -123,7 +123,7 @@ build: ##@ Build all arch linux kernel and rootfs and initrd
123
123
$(MAKE) -C buildroot O=$(ROOTDIR)/out/initrd/$(_ARCH) nconfig; \
124
124
;; \
125
125
kernel) \
126
- if [ $(_ARCH) == arm64 ]; then \
126
+ if [ $(_ARCH) = arm64 ]; then \
127
127
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/arm64 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- nconfig; \
128
128
else \
129
129
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/amd64 nconfig; \
@@ -148,7 +148,7 @@ build: ##@ Build all arch linux kernel and rootfs and initrd
148
148
$(MAKE) -C buildroot O=$(ROOTDIR)/out/initrd/$(_ARCH) menuconfig; \
149
149
;; \
150
150
kernel) \
151
- if [ $(_ARCH) == arm64 ]; then \
151
+ if [ $(_ARCH) = arm64 ]; then \
152
152
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/arm64 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig; \
153
153
else \
154
154
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/amd64 menuconfig; \
@@ -234,6 +234,30 @@ clean: ##@ Clean all build files
234
234
# #@ Misc commands
235
235
# #@
236
236
237
+ print-outpath-% : # #@ Print out path of specified architecture
238
+ $(eval _TARGET := $(firstword $(subst -, ,$* ) ) )
239
+ $(eval _ARCH := $(word 2, $(subst -, ,$* ) ) )
240
+
241
+ @case $(_TARGET) in \
242
+ rootfs) \
243
+ echo -n $(ROOTDIR)/out/rootfs/$(_ARCH)/images/rootfs.erofs; \
244
+ ;; \
245
+ initrd) \
246
+ echo -n $(ROOTDIR)/out/initrd/$(_ARCH)/images/initrd.gz; \
247
+ ;; \
248
+ kernel) \
249
+ if [ $(_ARCH) = arm64 ]; then \
250
+ echo -n $(ROOTDIR)/out/kernel/arm64/arch/arm64/boot/Image; \
251
+ else \
252
+ echo -n $(ROOTDIR)/out/kernel/amd64/arch/x86/boot/bzImage; \
253
+ fi; \
254
+ ;; \
255
+ *) \
256
+ printf "Please specify a print-outpath command\n" \
257
+ exit 1 \
258
+ ;; \
259
+ esac \
260
+
237
261
help : # #@ (Default) Print listing of key targets with their descriptions
238
262
@printf " \nUsage: make <command>\n"
239
263
@grep -F -h " ##@" $(MAKEFILE_LIST ) | grep -F -v grep -F | sed -e ' s/\\$$//' | awk ' BEGIN {FS = ":*[[:space:]]*##@[[:space:]]*"}; \
0 commit comments