Make OpenWRT build target configurable

This commit is contained in:
klzgrad 2019-12-02 01:39:07 +08:00
parent 04d06b1e0e
commit 9ecb32d4ae
5 changed files with 16 additions and 2668 deletions

View File

@ -23,7 +23,7 @@ matrix:
- name: "openwrt-mipsel_24kc" - name: "openwrt-mipsel_24kc"
os: linux os: linux
dist: bionic dist: bionic
env: EXTRA_FLAGS='target_cpu="mipsel" mips_arch_variant="r2" mips_float_abi="soft" mips_tune="24kc" use_allocator="none" use_allocator_shim=false is_openwrt=true ldso_path="/lib/ld-musl-mipsel-sf.so.1"' OPENWRT_ARCH=mipsel_24kc OPENWRT_RELEASE=19.07.0-rc1 OPENWRT_GCC=gcc-7.4.0 env: EXTRA_FLAGS='target_cpu="mipsel" mips_arch_variant="r2" mips_float_abi="soft" mips_tune="24kc" use_allocator="none" use_allocator_shim=false is_openwrt=true ldso_path="/lib/ld-musl-mipsel-sf.so.1"' OPENWRT_FLAGS='arch=mipsel_24kc release=19.07.0-rc1 gcc_ver=7.4.0 target=ramips subtarget=rt305x'
- name: "osx" - name: "osx"
os: osx os: osx
osx_image: xcode10.2 osx_image: xcode10.2

View File

@ -12,7 +12,7 @@ build_sysroot() {
} }
if [ "$ARCH" = Linux ]; then if [ "$ARCH" = Linux ]; then
if [ "$OPENWRT_ARCH" ]; then if [ "$OPENWRT_FLAGS" ]; then
./get-openwrt.sh ./get-openwrt.sh
else else
eval "$EXTRA_FLAGS" eval "$EXTRA_FLAGS"

View File

@ -2,14 +2,7 @@
set -ex set -ex
arch=$OPENWRT_ARCH eval "$OPENWRT_FLAGS"
release=$OPENWRT_RELEASE
gcc_ver=$OPENWRT_GCC
case "$arch" in
mipsel_24kc) target=ramips subtarget=rt305x;;
*) exit 1;;
esac
sysroot=$PWD/out/sysroot-build/openwrt/$release/$arch sysroot=$PWD/out/sysroot-build/openwrt/$release/$arch
if [ -d $sysroot/lib ]; then if [ -d $sysroot/lib ]; then
@ -17,17 +10,20 @@ if [ -d $sysroot/lib ]; then
fi fi
mkdir -p $sysroot mkdir -p $sysroot
SDK_PATH=openwrt-sdk-$release-$target-${subtarget}_${gcc_ver}_musl.Linux-x86_64 SDK_PATH=openwrt-sdk-$release-$target-${subtarget}_gcc-${gcc_ver}_musl.Linux-x86_64
SDK_URL=https://downloads.openwrt.org/releases/$release/targets/$target/$subtarget/$SDK_PATH.tar.xz SDK_URL=https://downloads.openwrt.org/releases/$release/targets/$target/$subtarget/$SDK_PATH.tar.xz
rm -rf $SDK_PATH rm -rf $SDK_PATH
curl $SDK_URL | tar xJf - curl $SDK_URL | tar xJf -
cd $SDK_PATH cd $SDK_PATH
./scripts/feeds update base packages ./scripts/feeds update base packages
./scripts/feeds install libnss ./scripts/feeds install libnss
cp ../$target-$subtarget.config .config make defconfig
yes | make oldconfig for flag in ALL_NONSHARED ALL_KMODS ALL SIGNED_PACKAGES; do
sed -i "s/CONFIG_$flag=y/# CONFIG_$flag is not set/" .config
done
make oldconfig
make make
full_root=staging_dir/toolchain-${arch}_${gcc_ver}_musl full_root=staging_dir/toolchain-${arch}_gcc-${gcc_ver}_musl
cp -r staging_dir/target-${arch}_musl/usr $full_root cp -r staging_dir/target-${arch}_musl/usr $full_root
echo ' echo '
./include ./include

View File

@ -1,8 +1,11 @@
get_sysroot() { get_sysroot() {
if [ "$OPENWRT_FLAGS" ]; then
eval "$OPENWRT_FLAGS"
echo "out/sysroot-build/openwrt/$release/$arch"
return
fi
eval "$EXTRA_FLAGS" eval "$EXTRA_FLAGS"
if [ "$OPENWRT_ARCH" -a "$OPENWRT_RELEASE" ]; then if [ ! "$target_sysroot" ]; then
echo "out/sysroot-build/openwrt/$OPENWRT_RELEASE/$OPENWRT_ARCH"
elif [ ! "$target_sysroot" ]; then
local sysroot_type local sysroot_type
case "$target_cpu" in case "$target_cpu" in
x64) sysroot_type=amd64;; x64) sysroot_type=amd64;;

File diff suppressed because it is too large Load Diff