Skip to content

Commit f4ebaea

Browse files
committed
Use GHA to build
1 parent 4ca4397 commit f4ebaea

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed

.github/workflows/build.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
13+
- name: Install dependencies
14+
run: |
15+
sudo apt update
16+
sudo apt install make imagemagick ttf-dejavu
17+
18+
- name: Download toolchain
19+
run: |
20+
curl -L -O https://redirect.armbian.com/_toolchain/gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz
21+
tar xvf ./gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz
22+
23+
- name: Build
24+
run: |
25+
export PATH="$PATH:$(pwd)/gcc-linaro-arm-none-eabi-4.8-2014.04_linux/bin"
26+
27+
make distclean
28+
make m8b_onecloud_config
29+
make -j$(nproc)
30+
31+
- name: Download AmlImg
32+
run: |
33+
ver="v0.3.0"
34+
curl -L -o ./AmlImg https://github.com/hzyitc/AmlImg/releases/download/$ver/AmlImg_${ver}_linux_amd64
35+
chmod +x ./AmlImg
36+
37+
- name: Generate resource
38+
run: |
39+
mkdir -p resource
40+
41+
convert \
42+
-size 640x360 \
43+
-background black \
44+
-gravity center -font "DejaVu-Sans" -pointsize 64 -fill white label:"U-Boot" \
45+
BMP3:resource/bootup.bmp
46+
47+
cat <<EOF >resource/list.txt
48+
090000:bootup:bootup.bmp
49+
EOF
50+
./AmlImg res_pack build/resource.img resource/
51+
52+
- name: Generate eMMC burn image
53+
run: |
54+
mkdir -p pack
55+
56+
cp build/ddr_init.bin pack/DDR.USB
57+
cp build/u-boot-comp.bin pack/UBOOT_COMP.USB
58+
59+
cat <<EOF >pack/aml_sdc_burn.ini
60+
[common]
61+
erase_bootloader = 1
62+
erase_flash = 0
63+
reboot = 0
64+
65+
;package will filled by sdacard burning tool
66+
[burn_ex]
67+
package = aml_upgrade_package.img
68+
;media =
69+
EOF
70+
71+
cat <<EOF >pack/platform.conf
72+
Platform:0x0801
73+
BinPara:0xd9010000
74+
DDRLoad:0xd9000000
75+
DDRRun:0xd9000030
76+
Uboot_down:0x200000
77+
Uboot_decomp:0xd9000030
78+
EOF
79+
80+
cp build/u-boot.bin pack/bootloader.img
81+
echo -n "sha1sum $(sha1sum pack/bootloader.img | awk '{print $1}')" >pack/bootloader.VERIFY
82+
83+
cp build/resource.img pack/resource.img
84+
echo -n "sha1sum $(sha1sum pack/resource.img | awk '{print $1}')" >pack/resource.VERIFY
85+
86+
cat <<EOF >pack/commands.txt
87+
USB:DDR:normal:DDR.USB
88+
USB:UBOOT_COMP:normal:UBOOT_COMP.USB
89+
90+
ini:aml_sdc_burn:normal:aml_sdc_burn.ini
91+
conf:platform:normal:platform.conf
92+
93+
PARTITION:bootloader:normal:bootloader.img
94+
VERIFY:bootloader:normal:bootloader.VERIFY
95+
96+
PARTITION:resource:normal:resource.img
97+
VERIFY:resource:normal:resource.VERIFY
98+
99+
# PARTITION:boot:normal:boot.img
100+
# VERIFY:boot:normal:boot.VERIFY
101+
# PARTITION:rootfs:normal:rootfs.img
102+
# VERIFY:rootfs:normal:rootfs.VERIFY
103+
EOF
104+
105+
./AmlImg pack build/eMMC.burn.img pack/
106+
107+
- name: Upload artifacts
108+
uses: actions/upload-artifact@v2
109+
with:
110+
path: |
111+
build/*.bin
112+
build/resource.img
113+
build/eMMC.burn.img
114+
115+
- name: Release
116+
run: |
117+
time="${{ github.event.head_commit.timestamp }}"
118+
sha="${GITHUB_SHA:0:8}"
119+
tag="build-$(date +'%Y%m%d-%H%M' -d "$time")"
120+
message="Auto-Build $(date +'%Y-%m-%d %H:%M' -d "$time")"
121+
hub release create -t "$GITHUB_SHA" "$tag" -m "$message" \
122+
$(for a in build/*.bin; do echo -a $a; done) \
123+
-a build/resource.img \
124+
-a build/eMMC.burn.img
125+
env:
126+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)