-
-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (169 loc) · 5.58 KB
/
ox64-special.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
## Special Build and Test: NuttX for Ox64
name: Special Test of NuttX for Ox64
permissions:
## Allow publishing of GitHub Release
contents: write
on:
## Run every day at 0:00 UTC
## schedule:
## - cron: '0 0 * * *'
## Run on every commit to this branch
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Build Tools
run: |
sudo apt -y update
sudo apt -y install \
bison flex gettext texinfo libncurses5-dev libncursesw5-dev \
gperf automake libtool pkg-config build-essential gperf genromfs \
libgmp-dev libmpc-dev libmpfr-dev libisl-dev binutils-dev libelf-dev \
libexpat-dev gcc-multilib g++-multilib u-boot-tools util-linux \
kconfig-frontends \
wget u-boot-tools
- name: Install Toolchain
run: |
wget --no-check-certificate https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz
tar -xf riscv64-unknown-elf-toolchain*.tar.gz
- name: Checkout Source Files
run: |
mkdir nuttx
cd nuttx
git clone \
https://github.com/apache/nuttx \
--branch master \
nuttx
## git clone https://github.com/apache/nuttx nuttx
git clone https://github.com/apache/nuttx-apps apps
- name: Build
run: |
## Add toolchain to PATH
export PATH=$PATH:$PWD/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin
cd nuttx/nuttx
## Dump the git hash
hash1=`git rev-parse HEAD`
pushd ../apps
hash2=`git rev-parse HEAD`
popd
echo NuttX Source: https://github.com/apache/nuttx/tree/$hash1 >nuttx.hash
echo NuttX Apps: https://github.com/apache/nuttx-apps/tree/$hash2 >>nuttx.hash
cat nuttx.hash
## Show the GCC version
riscv64-unknown-elf-gcc -v
## Configure the build
tools/configure.sh ox64:nsh
## Preserve the build config
cp .config nuttx.config
## Run the build
make
## Export the Binary Image to nuttx.bin
riscv64-unknown-elf-objcopy \
-O binary \
nuttx \
nuttx.bin
## Build Apps Filesystem
make export
pushd ../apps
./tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
make import
popd
## Generate Initial RAM Disk
genromfs -f initrd -d ../apps/bin -V "NuttXBootVol"
## Prepare a Padding with 64 KB of zeroes
head -c 65536 /dev/zero >/tmp/nuttx.pad
## Append Padding and Initial RAM Disk to NuttX Kernel
cat nuttx.bin /tmp/nuttx.pad initrd \
>Image
## Show the size
riscv64-unknown-elf-size nuttx
## Dump the disassembly to nuttx.S
riscv64-unknown-elf-objdump \
--syms --source --reloc --demangle --line-numbers --wide \
--debugging \
nuttx \
>nuttx.S \
2>&1
## Dump the init disassembly to init.S
riscv64-unknown-elf-objdump \
--syms --source --reloc --demangle --line-numbers --wide \
--debugging \
../apps/bin/init \
>init.S \
2>&1
## Dump the hello disassembly to hello.S
riscv64-unknown-elf-objdump \
--syms --source --reloc --demangle --line-numbers --wide \
--debugging \
../apps/bin/hello \
>hello.S \
2>&1
- name: Upload Build Outputs as Artifacts
uses: actions/upload-artifact@v4
with:
name: nuttx.zip
path: |
nuttx/nuttx/nuttx*
nuttx/nuttx/initrd
nuttx/nuttx/init.S
nuttx/nuttx/hello.S
nuttx/nuttx/Image
nuttx/nuttx/System.map
- name: Zip Build Outputs for GitHub Release
run: |
cd nuttx/nuttx
zip nuttx.zip nuttx* initrd init.S hello.S Image System.map
- name: Get Current Date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M-%S')"
- name: Publish the GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: special-ox64-${{ steps.date.outputs.date }}
draft: false
prerelease: false
generate_release_notes: false
files: |
nuttx/nuttx/nuttx.zip
nuttx/nuttx/nuttx
nuttx/nuttx/nuttx.S
nuttx/nuttx/nuttx.bin
nuttx/nuttx/nuttx.map
nuttx/nuttx/nuttx.hex
nuttx/nuttx/nuttx.config
nuttx/nuttx/nuttx.manifest
nuttx/nuttx/nuttx.hash
nuttx/nuttx/nuttx-export*
nuttx/nuttx/initrd
nuttx/nuttx/init.S
nuttx/nuttx/hello.S
nuttx/nuttx/Image
nuttx/nuttx/System.map
- name: Install Emulator Build Tools
run: |
sudo apt -y update
sudo apt -y install \
expect libcurl4-openssl-dev libssl-dev zlib1g-dev libsdl2-dev wget
- name: Checkout Emulator Source Files
run: |
git clone https://github.com/lupyuen/ox64-tinyemu
- name: Build Ox64 BL808 Emulator
run: |
cd ox64-tinyemu
make
cp temu ..
- name: Download Test Script
run: |
cd nuttx/nuttx
cp ../../temu .
wget https://github.com/lupyuen/nuttx-ox64/raw/main/nuttx.cfg
wget https://github.com/lupyuen/nuttx-ox64/raw/main/nuttx.exp
chmod +x nuttx.exp
ls -l
cat nuttx.hash
- name: Run Test
run: |
cd nuttx/nuttx
./nuttx.exp