bump to 19.07.4

add option to build from snapshot
master
Jordan Sokolic 2020-09-12 15:33:49 +03:00
parent 992202a787
commit 919afed11e
6 changed files with 31 additions and 24 deletions

View File

@ -7,12 +7,13 @@ build:
services:
- docker:dind
variables:
TAG: 19.07.3-x86_64
CURRENT_STABLE_RELEASE: '19.07.4'
TAG: $CURRENT_STABLE_RELEASE-x86_64
before_script:
- docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_TOKEN
script:
- cp openwrt.conf.example openwrt.conf
- sed -i -E "s@(BUILD_TAG=).+@\1$CI_IMAGE@" openwrt.conf
- sed -i -E "s@(IMAGE_TAG=).+@\1$CI_IMAGE@" openwrt.conf
- apk add make
- make build
- docker tag $CI_IMAGE $CI_IMAGE:$TAG
@ -38,7 +39,7 @@ build:
done
script:
- cp openwrt.conf.example openwrt.conf
- sed -i -E "s@(BUILD_TAG=).+@\1$CI_IMAGE@" openwrt.conf
- sed -i -E "s@(IMAGE_TAG=).+@\1$CI_IMAGE@" openwrt.conf
- wget -qO- $SRC_IMAGE | gzip -d > image.img
- LOOP_ARGS="=/tmp/dev/loop0" ./build-rpi.sh
- docker tag $CI_IMAGE $CI_IMAGE:$TAG
@ -49,24 +50,25 @@ build:
build-rpi2:
extends: .build-rpi
variables:
SRC_IMAGE: http://downloads.openwrt.org/releases/19.07.3/targets/brcm2708/bcm2709/openwrt-19.07.3-brcm2708-bcm2709-rpi-2-ext4-factory.img.gz
SRC_IMAGE: http://downloads.openwrt.org/releases/$CURRENT_STABLE_RELEASE/targets/brcm2708/bcm2709/openwrt-$CURRENT_STABLE_RELEASE-brcm2708-bcm2709-rpi-2-ext4-factory.img.gz
TAG: rpi2
build-rpi3:
extends: .build-rpi
variables:
SRC_IMAGE: https://downloads.openwrt.org/releases/19.07.3/targets/brcm2708/bcm2710/openwrt-19.07.3-brcm2708-bcm2710-rpi-3-ext4-factory.img.gz
SRC_IMAGE: https://downloads.openwrt.org/releases/$CURRENT_STABLE_RELEASE/targets/brcm2708/bcm2710/openwrt-$CURRENT_STABLE_RELEASE-brcm2708-bcm2710-rpi-3-ext4-factory.img.gz
TAG: rpi3
build-rpi4:
extends: .build-rpi
variables:
SRC_IMAGE: https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2711/openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz
# no stable release for RPi 4 (yet), so we use snapshot
VERSION: snapshot
TAG: rpi4
build-rpi-zero:
extends: .build-rpi
variables:
SRC_IMAGE: https://downloads.openwrt.org/releases/19.07.3/targets/brcm2708/bcm2708/openwrt-19.07.3-brcm2708-bcm2708-rpi-ext4-factory.img.gz
SRC_IMAGE: https://downloads.openwrt.org/releases/$CURRENT_STABLE_RELEASE/targets/brcm2708/bcm2708/openwrt-$CURRENT_STABLE_RELEASE-brcm2708-bcm2708-rpi-ext4-factory.img.gz
TAG: rpi-zero

View File

@ -1,6 +1,5 @@
FROM scratch
ARG OPENWRT_SOURCE_VER
ADD openwrt-${OPENWRT_SOURCE_VER}-x86-64-generic-rootfs.tar.gz /
ADD rootfs.tar.gz /
ARG ROOT_PW
RUN echo -e "${ROOT_PW}\n${ROOT_PW}" | passwd
RUN mkdir -p /var/lock
@ -15,7 +14,7 @@ RUN opkg remove dnsmasq && \
iperf3 \
dnsmasq-full \
iptables-mod-checksum
RUN opkg list-upgradable | awk '{print $1}' | xargs opkg upgrade
RUN opkg list-upgradable | awk '{print $1}' | xargs opkg upgrade || true
RUN echo "iptables -A POSTROUTING -t mangle -p udp --dport 68 -j CHECKSUM --checksum-fill" >> /etc/firewall.user
ARG ts

View File

@ -3,15 +3,23 @@
include openwrt.conf
export
build:
wget -q https://downloads.openwrt.org/releases/${OPENWRT_SOURCE_VER}/targets/x86/64/openwrt-${OPENWRT_SOURCE_VER}-x86-64-generic-rootfs.tar.gz
ifeq (${OPENWRT_SOURCE_VER}, snapshot)
ROOTFS_URL=https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-x86-64-rootfs.tar.gz
else
ROOTFS_URL=https://downloads.openwrt.org/releases/${OPENWRT_SOURCE_VER}/targets/x86/64/openwrt-${OPENWRT_SOURCE_VER}-x86-64-generic-rootfs.tar.gz
endif
rootfs.tar.gz:
wget ${ROOTFS_URL} -O rootfs.tar.gz
build: rootfs.tar.gz
docker build \
--build-arg ROOT_PW \
--build-arg OPENWRT_SOURCE_VER \
--build-arg ts="$(shell date)" \
--build-arg version="${OPENWRT_SOURCE_VER}" \
-t ${BUILD_TAG} .
rm openwrt-${OPENWRT_SOURCE_VER}-x86-64-generic-rootfs.tar.gz
-t ${IMAGE_TAG} .
rm rootfs.tar.gz
build-rpi:
./build-rpi.sh ${RPI_SOURCE_IMG}

View File

@ -34,7 +34,7 @@ docker_build() {
--build-arg ROOT_PW="${ROOT_PW}" \
--build-arg ts="$(date)" \
--build-arg version="${VERSION:-$OPENWRT_SOURCE_VER}" \
-t ${BUILD_TAG} -f Dockerfile.rpi ${tmpdir}
-t ${IMAGE_TAG} -f Dockerfile.rpi ${tmpdir}
}

View File

@ -21,9 +21,9 @@ You can build the OpenWRT docker image on the Pi itself, or on your x86 PC with
First download and extract the OpenWRT factory image for your Pi. Refer to the [OpenWrt Table of Hardware](https://openwrt.org/toh/raspberry_pi_foundation/raspberry_pi) to choose the right image. Then run the `make` target as root (need access to mount loop filesystems).
The variable `RPI_SOURCE_IMG` can be specified in openwrt.conf or on the command line:
The variable `RPI_SOURCE_IMG` can be specified in openwrt.conf or on the command line (defaults to `image.img`):
```
$ wget https://downloads.openwrt.org/releases/19.07.3/targets/brcm2708/bcm2708/openwrt-19.07.3-brcm2708-bcm2708-rpi-ext4-factory.img.gz -O image.img.gz
$ wget https://downloads.openwrt.org/releases/19.07.4/targets/brcm2708/bcm2708/openwrt-19.07.4-brcm2708-bcm2708-rpi-ext4-factory.img.gz -O image.img.gz
$ gzip -d image.img.gz
$ sudo make build-rpi
```

View File

@ -1,12 +1,10 @@
### Sample OpenWRT config file ###
### Sample OpenWrt config file ###
## General
# source image for Raspberry Pi build target
SOURCE_IMG=openwrt-19.07.3-brcm2708-bcm2708-rpi-ext4-factory.img
# source for build (x86) target
OPENWRT_SOURCE_VER=19.07.3
# OpenWrt version
OPENWRT_SOURCE_VER=19.07.4
# image tag for pre-built Docker image, or if building locally
BUILD_TAG=openwrt
IMAGE_TAG=oofnik/openwrt
# container name
CONTAINER=openwrt_1
ROOT_PW=changeme123
@ -14,14 +12,14 @@ ROOT_PW=changeme123
## Docker network settings
# name of the WAN Docker network
WAN_NAME=openwrt-wan
# host interface which will provide the WAN link for OpenWRT
# host interface which will provide the WAN link for OpenWrt
WAN_PARENT=eth0
# upstream DNS for OpenWrt
UPSTREAM_DNS_SERVER=8.8.8.8
# name of the LAN Docker network
LAN_NAME=openwrt-lan
# Host interface which will provide the LAN link for OpenWRT.
# Host interface which will provide the LAN link for OpenWrt.
# Can be a physical interface or a VLAN of the primary interface.
# For example if WAN_PARENT is eth0, LAN_PARENT can be eth0.10 for
# VLAN 10. VLAN interface will be created if it doesn't exist.