Skip to content

Commit 481d5b3

Browse files
committed
Initial commit
1 parent 35deafa commit 481d5b3

45 files changed

Lines changed: 4882 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
#=================================================
2+
# Description: Build OpenWrt using GitHub Actions
3+
# Lisence: MIT
4+
5+
name: NanoPi R2S 21.02
6+
7+
on:
8+
# release:
9+
# types: published
10+
#push:
11+
# branches:
12+
# - 21.02
13+
# paths:
14+
# - '.github/workflows/openwrt-rockchip-2102.yml'
15+
# - 'step/00-prepare_openwrt.sh'
16+
# - 'step/01-prepare_package.sh'
17+
# - 'seed/rockchip.seed'
18+
#schedule:
19+
# - cron: 30 21 * * *
20+
watch:
21+
types: started
22+
workflow_dispatch:
23+
24+
jobs:
25+
build:
26+
runs-on: ubuntu-18.04
27+
if: github.event.repository.owner.id == github.event.sender.id
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@main
32+
33+
- name: Show CPU Model and Free Space
34+
run: |
35+
echo -e "Total CPU cores\t: $(nproc)"
36+
cat /proc/cpuinfo | grep 'model name'
37+
free -h
38+
- name: Set env
39+
run: |
40+
echo "SSH_ACTIONS=false" >> $GITHUB_ENV
41+
echo "UPLOAD_BIN_DIR=false" >> $GITHUB_ENV
42+
echo "UPLOAD_FIRMWARE=true" >> $GITHUB_ENV
43+
echo "UPLOAD_RELEASE=true" >> $GITHUB_ENV
44+
echo "TZ=Europe/Paris" >>$GITHUB_ENV
45+
echo "Build_Date=$(date +%Y.%m.%d)" >> $GITHUB_ENV
46+
echo "RELTAG=v$(date +'%Y%m%d.%H%M%S')" >> $GITHUB_ENV
47+
48+
- name: Show env
49+
run: echo $GITHUB_ENV
50+
51+
- name: free disk space
52+
run: |
53+
df -h
54+
sudo swapoff -a
55+
sudo rm -f /swapfile
56+
sudo apt clean
57+
docker rmi $(docker image ls -aq)
58+
df -h
59+
/bin/bash ./workflow-scripts/free_disk_space.sh
60+
- name: Initialization environment
61+
env:
62+
DEBIAN_FRONTEND: noninteractive
63+
run: |
64+
sudo -E rm -rf /etc/apt/sources.list.d
65+
sudo -E apt-get update -y
66+
sudo -E apt-get install -y build-essential rsync asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core p7zip p7zip-full msmtp libssl-dev texinfo libreadline-dev libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint ccache curl wget vim nano python3 python3-pip python3-ply haveged lrzsz device-tree-compiler scons
67+
wget -qO - https://raw.githubusercontent.com/friendlyarm/build-env-on-ubuntu-bionic/master/install.sh | sed 's/python-/python3-/g' | /bin/bash
68+
sudo -E apt-get clean -y
69+
git config --global user.name 'GitHub Actions' && git config --global user.email 'noreply@github.com'
70+
df -h
71+
- name: Get OpenWrt source 21.02
72+
run: |
73+
./steps/01_clone_openwrt_2102.sh
74+
- name: Get ImmortalWrt source 21.02
75+
run: |
76+
./steps/01_clone_immortal_2102.sh
77+
- name: Make working copy of OpenWrt source
78+
run: |
79+
./steps/02_prepare_openwrt_folder_2102.sh
80+
- name: Patch OpenWrt source R2S / 21.02
81+
run: |
82+
./steps/r2s/03_patch_openwrt_2102.sh
83+
- name: Prepare package
84+
run: |
85+
./steps/04-prepare_package.sh
86+
- name: Add ACL
87+
run: |
88+
./steps/05-create_luci_acl.sh
89+
- name: Load ao Config
90+
run: |
91+
./steps/06-create_config_from_seed.sh
92+
93+
- name: Download package
94+
id: package
95+
run: |
96+
cd build/openwrt
97+
make defconfig
98+
make download -j128
99+
find dl -size -1024c -exec ls -l {} \;
100+
find dl -size -1024c -exec rm -f {} \;
101+
102+
- name: Make toolchain-aarch64
103+
id: compiletoolchain
104+
continue-on-error: true
105+
run: |
106+
cd build/openwrt
107+
let make_process=$(nproc)+1
108+
make toolchain/install -j${make_process} V=s
109+
- name: If toolchain Error
110+
if: steps.compiletoolchain.outcome == 'failure'
111+
run: |
112+
echo '================================================================'
113+
cd build/openwrt && make toolchain/install -j1 V=s
114+
- name: Compile OpenWRT for R2S & R4S
115+
id: compileopenwrt
116+
continue-on-error: true
117+
run: |
118+
cd build/openwrt
119+
let make_process=$(nproc)+1
120+
make -j${make_process} V=s || make -j${make_process} V=s
121+
- name: If compile openwrt Error
122+
if: steps.compileopenwrt.outcome == 'failure'
123+
run: |
124+
cat build/openwrt/.config
125+
echo '================================================================'
126+
cd build/openwrt && make -j1 V=s
127+
- name: Organize files
128+
id: organize
129+
run: |
130+
rm -rf ./artifact/
131+
mkdir -p ./artifact/
132+
mv build/openwrt/bin/targets/rockchip/armv8/*sysupgrade.img* ./artifact/
133+
cd ./artifact/
134+
ls -Ahl
135+
gzip -d *.gz && exit 0
136+
gzip --best *.img
137+
ls -Ahl
138+
sha256sum openwrt*r2s* | tee NanoPI-R2S-AO-$(date +%Y%m%d)-21.02.sha256sum
139+
sha256sum openwrt*r4s* | tee NanoPI-R4S-AO-$(date +%Y%m%d)-21.02.sha256sum
140+
zip NanoPI-R2S-AO-$(date +%Y%m%d)-21.02-ext4.zip *r2s*ext4*
141+
zip NanoPI-R2S-AO-$(date +%Y%m%d)-21.02-sfs.zip *r2s*squashfs*
142+
zip NanoPI-R4S-AO-$(date +%Y%m%d)-21.02-ext4.zip *r4s*ext4*
143+
zip NanoPI-R4S-AO-$(date +%Y%m%d)-21.02-sfs.zip *r4s*squashfs*
144+
cp ../build/openwrt/*.config ./
145+
ls -Ahl
146+
- name: Upload artifact
147+
uses: actions/upload-artifact@main
148+
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
149+
with:
150+
name: OpenWRT_21.02
151+
path: ./artifact/
152+
153+
- name: Set env
154+
run: |
155+
echo "TZ=Europe/Paris" >>$GITHUB_ENV
156+
echo "Build_Date=$(date +%Y-%m-%d %H:%M)" >> $GITHUB_ENV
157+
echo "RELTAG=v$(date +'%Y%m%d.%H%M%S')" >> $GITHUB_ENV
158+
159+
- name: Create release
160+
id: create_release
161+
uses: ncipollo/release-action@v1.8.0
162+
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
163+
with:
164+
name: OpenWrt 21.02 ${{ env.Build_Date }}
165+
allowUpdates: true
166+
tag: ${{ env.RELTAG }}
167+
commit: main
168+
replacesArtifacts: true
169+
token: ${{ secrets.GITHUB_TOKEN }}
170+
bodyFile: "release-info-r2s-21.02.md"
171+
artifacts: ./artifact/*.zip,./artifact/*.config,./artifact/*.sha256sum

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## OpenWrt for Rockchip rk3328/rk3399, include Nanopi R2S/R4S
2+
#### ⚠ WARNING: USE IT UNDER YOUR OWN RISK. Non profit use only ⚠
3+
[![NanoPi R2S 21.02](https://github.com/anaelorlinski/OpenWrt-NanoPi-R2S-R4S-Builds/actions/workflows/NanoPi-r2s-21.02.yml/badge.svg)](https://github.com/anaelorlinski/OpenWrt-NanoPi-R2S-R4S-Builds/actions/workflows/NanoPi-r2s-21.02.yml)
4+
5+
##### Download: [Releases](https://github.com/anaelorlinski/OpenWrt-NanoPi-R2S-R4S-Builds/releases) or [Actions](https://github.com/anaelorlinski/OpenWrt-NanoPi-R2S-R4S-Builds/actions) \(Login Needed\)
6+
- - -
7+
## Introduction
8+
- ### Config
9+
OpenWRT 21.02 / Kernel 5.4 / NanoPi r2s/r4s patches / r8168 ethernet driver<br/>
10+
11+
- ### Applications
12+
Only applications from official OpenWrt package feed
13+
- - -
14+
15+
### Thanks to Original Project:
16+
- [quintus-lab](https://github.com/quintus-lab/OpenWRT-Rockchip)
17+
18+
### License
19+
[MIT](https://github.com/anaelorlinski/OpenWRT-Rockchip/blob/master/LICENSE)

local-scripts/data/uboot/Makefile

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#
2+
# This is free software, licensed under the GNU General Public License v2.
3+
# See /LICENSE for more information.
4+
#
5+
include $(TOPDIR)/rules.mk
6+
include $(INCLUDE_DIR)/kernel.mk
7+
8+
PKG_VERSION:=2021.04
9+
PKG_RELEASE:=1
10+
11+
PKG_HASH:=0d438b1bb5cceb57a18ea2de4a0d51f7be5b05b98717df05938636e0aadfe11a
12+
13+
PKG_MAINTAINER:=Tobias Maedel <openwrt@tbspace.de>
14+
15+
include $(INCLUDE_DIR)/u-boot.mk
16+
include $(INCLUDE_DIR)/package.mk
17+
18+
define U-Boot/Default
19+
BUILD_TARGET:=rockchip
20+
UENV:=default
21+
HIDDEN:=1
22+
endef
23+
24+
25+
# RK3328 boards
26+
27+
define U-Boot/nanopi-r2s-rk3328
28+
BUILD_SUBTARGET:=armv8
29+
NAME:=NanoPi R2S
30+
BUILD_DEVICES:= \
31+
friendlyarm_nanopi-r2s
32+
DEPENDS:=+PACKAGE_u-boot-nanopi-r2s-rk3328:arm-trusted-firmware-rockchip
33+
PKG_BUILD_DEPENDS:=arm-trusted-firmware-rockchip
34+
ATF:=rk3328_bl31.elf
35+
OF_PLATDATA:=$(1)
36+
endef
37+
38+
39+
# RK3399 boards
40+
41+
define U-Boot/nanopi-r4s-rk3399
42+
BUILD_SUBTARGET:=armv8
43+
NAME:=NanoPi R4S
44+
BUILD_DEVICES:= \
45+
friendlyarm_nanopi-r4s
46+
DEPENDS:=+PACKAGE_u-boot-nanopi-r4s-rk3399:arm-trusted-firmware-rockchip
47+
PKG_BUILD_DEPENDS:=arm-trusted-firmware-rockchip
48+
ATF:=rk3399_bl31.elf
49+
endef
50+
51+
define U-Boot/rock-pi-4-rk3399
52+
BUILD_SUBTARGET:=armv8
53+
NAME:=Rock Pi 4
54+
BUILD_DEVICES:= \
55+
radxa_rock-pi-4
56+
DEPENDS:=+PACKAGE_u-boot-rock-pi-4-rk3399:arm-trusted-firmware-rockchip
57+
PKG_BUILD_DEPENDS:=arm-trusted-firmware-rockchip
58+
ATF:=rk3399_bl31.elf
59+
endef
60+
61+
define U-Boot/rockpro64-rk3399
62+
BUILD_SUBTARGET:=armv8
63+
NAME:=RockPro64
64+
BUILD_DEVICES:= \
65+
pine64_rockpro64
66+
DEPENDS:=+PACKAGE_u-boot-rockpro64-rk3399:arm-trusted-firmware-rockchip
67+
PKG_BUILD_DEPENDS:=arm-trusted-firmware-rockchip
68+
ATF:=rk3399_bl31.elf
69+
endef
70+
71+
UBOOT_TARGETS := \
72+
nanopi-r4s-rk3399 \
73+
rock-pi-4-rk3399 \
74+
rockpro64-rk3399 \
75+
nanopi-r2s-rk3328
76+
77+
UBOOT_CONFIGURE_VARS += USE_PRIVATE_LIBGCC=yes
78+
79+
UBOOT_MAKE_FLAGS += \
80+
BL31=$(STAGING_DIR_IMAGE)/$(ATF)
81+
82+
define Build/Configure
83+
$(call Build/Configure/U-Boot)
84+
85+
ifneq ($(OF_PLATDATA),)
86+
mkdir -p $(PKG_BUILD_DIR)/tpl/dts
87+
mkdir -p $(PKG_BUILD_DIR)/include/generated
88+
89+
$(CP) $(PKG_BUILD_DIR)/of-platdata/$(OF_PLATDATA)/dt-plat.c $(PKG_BUILD_DIR)/tpl/dts/dt-plat.c
90+
$(CP) $(PKG_BUILD_DIR)/of-platdata/$(OF_PLATDATA)/dt-structs-gen.h $(PKG_BUILD_DIR)/include/generated/dt-structs-gen.h
91+
endif
92+
93+
$(SED) 's#CONFIG_MKIMAGE_DTC_PATH=.*#CONFIG_MKIMAGE_DTC_PATH="$(PKG_BUILD_DIR)/scripts/dtc/dtc"#g' $(PKG_BUILD_DIR)/.config
94+
echo 'CONFIG_IDENT_STRING=" OpenWrt"' >> $(PKG_BUILD_DIR)/.config
95+
endef
96+
97+
define Build/InstallDev
98+
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
99+
$(CP) $(PKG_BUILD_DIR)/idbloader.img $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-idbloader.img
100+
$(CP) $(PKG_BUILD_DIR)/u-boot.itb $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-u-boot.itb
101+
endef
102+
103+
define Package/u-boot/install/default
104+
endef
105+
106+
$(eval $(call BuildPackage/U-Boot))

local-scripts/refresh_uboot.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
ROOTDIR=$(pwd)
3+
echo $ROOTDIR
4+
if [ ! -e "$ROOTDIR/build" ]; then
5+
echo "Please run from root / no build dir"
6+
exit 1
7+
fi
8+
9+
BUILDDIR="$ROOTDIR/build"
10+
SCRIPTDIR=$(dirname $(readlink -f $0))
11+
12+
if [ ! -e "$BUILDDIR/immortal-fresh-master" ]; then
13+
echo "Please run from root / no immortal-fresh-master ! please clone first"
14+
exit 1
15+
fi
16+
17+
rm -rf $ROOTDIR/package/uboot-rockchip
18+
cp -R $BUILDDIR/immortal-fresh-master/package/boot/uboot-rockchip $ROOTDIR/package/uboot-rockchip
19+
20+
# use custom makefile, so there is no need of arm-trusted-firmware-rk3288
21+
# and use generic version arm-trusted-firmware-rockchip
22+
cp $SCRIPTDIR/data/uboot/Makefile $ROOTDIR/package/uboot-rockchip/Makefile

local-scripts/script_dir.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
ROOTDIR=$(pwd)
3+
echo $ROOTDIR
4+
5+
SCRIPTDIR=$(dirname $(readlink -f $0))
6+
echo $SCRIPTDIR

0 commit comments

Comments
 (0)