Skip to content

Commit 441261c

Browse files
committed
chore(ci): add ci
Signed-off-by: Kevin Cui <[email protected]>
1 parent 737a251 commit 441261c

File tree

3 files changed

+87
-6
lines changed

3 files changed

+87
-6
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
6+
[*.yml]
7+
indent_style = space
8+
indent_size = 2

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- add-ci
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: true
17+
matrix:
18+
target:
19+
- initrd
20+
- rootfs
21+
- kernel
22+
arch:
23+
- arm64
24+
- amd64
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
29+
30+
- name: Update kernel submodules
31+
if: ${{ matrix.target == 'kernel'}}
32+
run: git submodule update --init kernel
33+
34+
- name: Update buildroot submodules
35+
if: ${{ matrix.target != 'kernel'}}
36+
run: git submodule update --init buildroot
37+
38+
- name: Defconfig
39+
run: make ${{ matrix.target }}-${{ matrix.arch }}-defconfig
40+
41+
- name: Install kernel arm64 deps
42+
if: ${{ matrix.target == 'kernel' && matrix.arch == 'arm64'}}
43+
run: sudo apt-get install -y gcc-aarch64-linux-gnu
44+
45+
- name: Build
46+
run: make ${{ matrix.target }}-${{ matrix.arch }}-build
47+
48+
- name: List file
49+
run: make print-outpath-${{ matrix.target }}-${{ matrix.arch }}

Makefile

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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-%
22

33
ROOTDIR := $(realpath .)
44

@@ -21,7 +21,7 @@ ROOTDIR := $(realpath .)
2121
$(MAKE) -C buildroot O=$(ROOTDIR)/out/initrd/$(_ARCH) ROOTFS_CPIO_IMAGE_NAME=initrd all; \
2222
;; \
2323
kernel) \
24-
if [ $(_ARCH) == arm64 ]; then \
24+
if [ $(_ARCH) = arm64 ]; then \
2525
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/arm64 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- all; \
2626
else \
2727
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/amd64 all; \
@@ -64,7 +64,7 @@ build: ##@ Build all arch linux kernel and rootfs and initrd
6464
$(MAKE) -C buildroot O=$(ROOTDIR)/out/initrd/$(_ARCH) BR2_EXTERNAL=$(ROOTDIR)/buildroot_external initrd_$(_ARCH)_defconfig; \
6565
;; \
6666
kernel) \
67-
if [ $(_ARCH) == arm64 ]; then \
67+
if [ $(_ARCH) = arm64 ]; then \
6868
mkdir -p $(ROOTDIR)/out/kernel/$(_ARCH)/arch/arm64/configs/; \
6969
cp $(ROOTDIR)/kernel_external/configs/kernel_$(_ARCH)_defconfig $(ROOTDIR)/out/kernel/$(_ARCH)/arch/arm64/configs/; \
7070
$(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
9696
echo "generate $(ROOTDIR)/buildroot_external/configs/initrd_$(_ARCH)_defconfig"; \
9797
;; \
9898
kernel) \
99-
if [ $(_ARCH) == arm64 ]; then \
99+
if [ $(_ARCH) = arm64 ]; then \
100100
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/$(_ARCH) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- savedefconfig; \
101101
else \
102102
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/$(_ARCH) savedefconfig; \
@@ -123,7 +123,7 @@ build: ##@ Build all arch linux kernel and rootfs and initrd
123123
$(MAKE) -C buildroot O=$(ROOTDIR)/out/initrd/$(_ARCH) nconfig; \
124124
;; \
125125
kernel) \
126-
if [ $(_ARCH) == arm64 ]; then \
126+
if [ $(_ARCH) = arm64 ]; then \
127127
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/arm64 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- nconfig; \
128128
else \
129129
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/amd64 nconfig; \
@@ -148,7 +148,7 @@ build: ##@ Build all arch linux kernel and rootfs and initrd
148148
$(MAKE) -C buildroot O=$(ROOTDIR)/out/initrd/$(_ARCH) menuconfig; \
149149
;; \
150150
kernel) \
151-
if [ $(_ARCH) == arm64 ]; then \
151+
if [ $(_ARCH) = arm64 ]; then \
152152
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/arm64 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig; \
153153
else \
154154
$(MAKE) -C kernel O=$(ROOTDIR)/out/kernel/amd64 menuconfig; \
@@ -234,6 +234,30 @@ clean: ##@ Clean all build files
234234
##@ Misc commands
235235
##@
236236

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+
237261
help: ##@ (Default) Print listing of key targets with their descriptions
238262
@printf "\nUsage: make <command>\n"
239263
@grep -F -h "##@" $(MAKEFILE_LIST) | grep -F -v grep -F | sed -e 's/\\$$//' | awk 'BEGIN {FS = ":*[[:space:]]*##@[[:space:]]*"}; \

0 commit comments

Comments
 (0)