Skip to content

Commit

Permalink
add support for LEDE
Browse files Browse the repository at this point in the history
 * replace:
   * OpenWrt -> LEDE
   * OPENWRT -> LEDE
   * openwrt -> lede
 * fix imagebuilder/toolchain/sdk file name because it's now lowercase
 * refresh patches
 * use LEDE-commit of 2016-12-23
 * update feeds to trunk of 2016-12-23
 * change feed url from git -> https://
 * rename ar71xx -> ar71xx_generic

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>

This is backported and updated to the master-branch. orginal commit
was cd1ae9b

 * refresh all software
 * change NAME and VERSION to reflect LEDE-branch-build
   * according to proposal: #24 (comment)
 * profiles: update new default of ar71xx-mikrotik
   * LEDE: "ar71xx: create a proper default profile for the mikrotik subtarget, drop other profiles"
     (e53e44a0ad4873645c7a22)
 * remove luci-bootstrap-input-css.patch, as this was fixed upstream
 * remove add_package_snmp-mibs.patch went upstream

Signed-off-by: Sven Roederer <freifunk@it-solution.geroedel.de>
  • Loading branch information
lynxis authored and SvenRoederer committed Feb 9, 2017
1 parent ebe7cf9 commit 8c73f02
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 2,464 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
patches/*~
bin
openwrt
/lede/
firmwares
dl
106 changes: 53 additions & 53 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ REVISION=git describe --always

# set dir and file names
FW_DIR=$(shell pwd)
OPENWRT_DIR=$(FW_DIR)/openwrt
LEDE_DIR=$(FW_DIR)/lede
TARGET_CONFIG=$(FW_DIR)/configs/common.config $(FW_DIR)/configs/$(TARGET).config
IB_BUILD_DIR=$(FW_DIR)/imgbldr_tmp
FW_TARGET_DIR=$(FW_DIR)/firmwares/$(TARGET)
UMASK=umask 022

# if any of the following files have been changed: clean up openwrt dir
# if any of the following files have been changed: clean up lede dir
DEPS=$(TARGET_CONFIG) feeds.conf patches $(wildcard patches/*)

# profiles to be built (router models)
Expand All @@ -26,54 +26,54 @@ FW_REVISION=$(shell $(REVISION))

default: firmwares

# clone openwrt
$(OPENWRT_DIR):
git clone $(OPENWRT_SRC) $(OPENWRT_DIR)
# clone lede
$(LEDE_DIR):
git clone $(LEDE_SRC) $(LEDE_DIR)

# clean up openwrt working copy
openwrt-clean: stamp-clean-openwrt-cleaned .stamp-openwrt-cleaned
.stamp-openwrt-cleaned: config.mk | $(OPENWRT_DIR) openwrt-clean-bin
cd $(OPENWRT_DIR); \
# clean up lede working copy
lede-clean: stamp-clean-lede-cleaned .stamp-lede-cleaned
.stamp-lede-cleaned: config.mk | $(LEDE_DIR) lede-clean-bin
cd $(LEDE_DIR); \
./scripts/feeds clean && \
git clean -dff && git fetch && git reset --hard HEAD && \
rm -rf .config feeds.conf build_dir/target-* logs/
touch $@

openwrt-clean-bin:
rm -rf $(OPENWRT_DIR)/bin
lede-clean-bin:
rm -rf $(LEDE_DIR)/bin

# update openwrt and checkout specified commit
openwrt-update: stamp-clean-openwrt-updated .stamp-openwrt-updated
.stamp-openwrt-updated: .stamp-openwrt-cleaned
cd $(OPENWRT_DIR); git checkout --detach $(OPENWRT_COMMIT)
# update lede and checkout specified commit
lede-update: stamp-clean-lede-updated .stamp-lede-updated
.stamp-lede-updated: .stamp-lede-cleaned
cd $(LEDE_DIR); git checkout --detach $(LEDE_COMMIT)
touch $@

# patches require updated openwrt working copy
$(OPENWRT_DIR)/patches: | .stamp-openwrt-updated
# patches require updated lede working copy
$(LEDE_DIR)/patches: | .stamp-lede-updated
ln -s $(FW_DIR)/patches $@

# feeds
$(OPENWRT_DIR)/feeds.conf: .stamp-openwrt-updated feeds.conf
$(LEDE_DIR)/feeds.conf: .stamp-lede-updated feeds.conf
cp $(FW_DIR)/feeds.conf $@

# update feeds
feeds-update: stamp-clean-feeds-updated .stamp-feeds-updated
.stamp-feeds-updated: $(OPENWRT_DIR)/feeds.conf unpatch
+cd $(OPENWRT_DIR); \
.stamp-feeds-updated: $(LEDE_DIR)/feeds.conf unpatch
+cd $(LEDE_DIR); \
./scripts/feeds uninstall -a && \
./scripts/feeds update && \
./scripts/feeds install -a
touch $@

# prepare patch
pre-patch: stamp-clean-pre-patch .stamp-pre-patch
.stamp-pre-patch: .stamp-feeds-updated $(wildcard $(FW_DIR)/patches/*) | $(OPENWRT_DIR)/patches
.stamp-pre-patch: .stamp-feeds-updated $(wildcard $(FW_DIR)/patches/*) | $(LEDE_DIR)/patches
touch $@

# patch openwrt working copy
# patch lede working copy
patch: stamp-clean-patched .stamp-patched
.stamp-patched: .stamp-pre-patch
cd $(OPENWRT_DIR); quilt push -a
cd $(LEDE_DIR); quilt push -a
touch $@

.stamp-build_rev: .FORCE
Expand All @@ -88,31 +88,31 @@ endif
# share download dir
$(FW_DIR)/dl:
mkdir $(FW_DIR)/dl
$(OPENWRT_DIR)/dl: $(FW_DIR)/dl
ln -s $(FW_DIR)/dl $(OPENWRT_DIR)/dl
$(LEDE_DIR)/dl: $(FW_DIR)/dl
ln -s $(FW_DIR)/dl $(LEDE_DIR)/dl

# make embedded-files avail to openwrt
$(OPENWRT_DIR)/files: $(FW_DIR)/embedded-files
ln -s $(FW_DIR)/embedded-files $(OPENWRT_DIR)/files
# make embedded-files avail to lede
$(LEDE_DIR)/files: $(FW_DIR)/embedded-files
ln -s $(FW_DIR)/embedded-files $(LEDE_DIR)/files

# openwrt config
$(OPENWRT_DIR)/.config: .stamp-patched $(TARGET_CONFIG) .stamp-build_rev $(OPENWRT_DIR)/dl
cat $(TARGET_CONFIG) >$(OPENWRT_DIR)/.config
sed -i "/^CONFIG_VERSION_NUMBER=/ s/\"$$/\+$(FW_REVISION)\"/" $(OPENWRT_DIR)/.config
# lede config
$(LEDE_DIR)/.config: .stamp-patched $(TARGET_CONFIG) .stamp-build_rev $(LEDE_DIR)/dl
cat $(TARGET_CONFIG) >$(LEDE_DIR)/.config
sed -i "/^CONFIG_VERSION_NUMBER=/ s/\"$$/\+$(FW_REVISION)\"/" $(LEDE_DIR)/.config
$(UMASK); \
$(MAKE) -C $(OPENWRT_DIR) defconfig
$(MAKE) -C $(LEDE_DIR) defconfig

# prepare openwrt working copy
# prepare lede working copy
prepare: stamp-clean-prepared .stamp-prepared $(OPENWRT_DIR)/files
.stamp-prepared: .stamp-patched $(OPENWRT_DIR)/.config
sed -i 's,^# REVISION:=.*,REVISION:=$(FW_REVISION),g' $(OPENWRT_DIR)/include/version.mk
.stamp-prepared: .stamp-patched $(LEDE_DIR)/.config
sed -i 's,^# REVISION:=.*,REVISION:=$(FW_REVISION),g' $(LEDE_DIR)/include/version.mk
touch $@

# compile
compile: stamp-clean-compiled .stamp-compiled
.stamp-compiled: .stamp-prepared openwrt-clean-bin
.stamp-compiled: .stamp-prepared lede-clean-bin
$(UMASK); \
$(MAKE) -C $(OPENWRT_DIR) $(MAKE_ARGS)
$(MAKE) -C $(LEDE_DIR) $(MAKE_ARGS)
touch $@

# fill firmwares-directory with:
Expand All @@ -123,21 +123,21 @@ firmwares: stamp-clean-firmwares .stamp-firmwares
.stamp-firmwares: .stamp-compiled
rm -rf $(IB_BUILD_DIR)
mkdir -p $(IB_BUILD_DIR)
$(eval TOOLCHAIN_PATH := $(shell printf "%s:" $(OPENWRT_DIR)/staging_dir/toolchain-*/bin))
$(eval IB_FILE := $(shell ls -tr $(OPENWRT_DIR)/bin/$(MAINTARGET)/OpenWrt-ImageBuilder-*.tar.bz2 | tail -n1))
$(eval TOOLCHAIN_PATH := $(shell printf "%s:" $(LEDE_DIR)/staging_dir/toolchain-*/bin))
$(eval IB_FILE := $(shell ls -tr $(LEDE_DIR)/bin/targets/$(MAINTARGET)/$(SUBTARGET)/*-imagebuilder-*.tar.bz2 | tail -n1))
mkdir -p $(FW_TARGET_DIR)
# Create version info file
GIT_BRANCH_ESC=$(shell $(GIT_BRANCH) | tr '/' '_'); \
VERSION_FILE=$(FW_TARGET_DIR)/VERSION.txt; \
echo "https://github.com/freifunk-berlin/firmware" > $$VERSION_FILE; \
echo "https://wiki.freifunk.net/Berlin:Firmware" >> $$VERSION_FILE; \
echo "Firmware: git branch \"$$GIT_BRANCH_ESC\", revision $(FW_REVISION)" >> $$VERSION_FILE; \
# add openwrt revision with data from config.mk \
OPENWRT_REVISION=`cd $(OPENWRT_DIR); $(REVISION)`; \
echo "OpenWRT: repository from $(OPENWRT_SRC), git branch \"$(OPENWRT_COMMIT)\", revision $$OPENWRT_REVISION" >> $$VERSION_FILE; \
# add lede revision with data from config.mk \
LEDE_REVISION=`cd $(LEDE_DIR); $(REVISION)`; \
echo "OpenWRT: repository from $(LEDE_SRC), git branch \"$(LEDE_COMMIT)\", revision $$LEDE_REVISION" >> $$VERSION_FILE; \
# add feed revisions \
for FEED in `cd $(OPENWRT_DIR); ./scripts/feeds list -n`; do \
FEED_DIR=$(addprefix $(OPENWRT_DIR)/feeds/,$$FEED); \
for FEED in `cd $(LEDE_DIR); ./scripts/feeds list -n`; do \
FEED_DIR=$(addprefix $(LEDE_DIR)/feeds/,$$FEED); \
FEED_GIT_REPO=`cd $$FEED_DIR; $(GIT_REPO)`; \
FEED_GIT_BRANCH_ESC=`cd $$FEED_DIR; $(GIT_BRANCH) | tr '/' '_'`; \
FEED_REVISION=`cd $$FEED_DIR; $(REVISION)`; \
Expand All @@ -156,12 +156,12 @@ firmwares: stamp-clean-firmwares .stamp-firmwares
for file in `find $(RELPATH) -name "openwrt-*"` ; do mv $$file $${file/openwrt-/kathleen-}; done
# copy imagebuilder, sdk and toolchain (if existing)
# remove old versions
rm -f $(FW_TARGET_DIR)/OpenWrt-*.tar.bz2
cp -a $(OPENWRT_DIR)/bin/$(MAINTARGET)/OpenWrt-*.tar.bz2 $(FW_TARGET_DIR)/
rm -f $(FW_TARGET_DIR)/*.tar.bz2
cp -a $(LEDE_DIR)/bin/targets/$(MAINTARGET)/$(SUBTARGET)/*{imagebuilder,sdk,toolchain}*.tar.bz2 $(FW_TARGET_DIR)/
# copy packages
PACKAGES_DIR="$(FW_TARGET_DIR)/packages"; \
rm -rf $$PACKAGES_DIR; \
cp -a $(OPENWRT_DIR)/bin/$(MAINTARGET)/packages $$PACKAGES_DIR
cp -a $(LEDE_DIR)/bin/$(MAINTARGET)/$(SUBTARGET)/packages $$PACKAGES_DIR
rm -rf $(IB_BUILD_DIR)
touch $@

Expand All @@ -171,14 +171,14 @@ stamp-clean-%:
stamp-clean:
rm -f .stamp-*

# unpatch needs "patches/" in openwrt
unpatch: $(OPENWRT_DIR)/patches
# unpatch needs "patches/" in lede
unpatch: $(LEDE_DIR)/patches
# RC = 2 of quilt --> nothing to be done
cd $(OPENWRT_DIR); quilt pop -a -f || [ $$? = 2 ] && true
cd $(LEDE_DIR); quilt pop -a -f || [ $$? = 2 ] && true
rm -f .stamp-patched

clean: stamp-clean .stamp-openwrt-cleaned
clean: stamp-clean .stamp-lede-cleaned

.PHONY: openwrt-clean openwrt-clean-bin openwrt-update patch feeds-update prepare compile firmwares stamp-clean clean
.PHONY: lede-clean lede-clean-bin lede-update patch feeds-update prepare compile firmwares stamp-clean clean
.NOTPARALLEL:
.FORCE:
4 changes: 2 additions & 2 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
SHELL:=$(shell which bash)
TARGET=ar71xx-generic
PACKAGES_LIST_DEFAULT=default backbone
OPENWRT_SRC=git://github.com/openwrt/openwrt.git
OPENWRT_COMMIT=1b6dc2e48ce654a004a7d0b98d7070a515424595
LEDE_SRC=https://git.lede-project.org/source.git
LEDE_COMMIT=5c4b2eb3dd9261d9e604dcdff2c93860a6313582
MAKE_ARGS=
5 changes: 3 additions & 2 deletions configs/common.config
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ CONFIG_VERSIONOPT=y
CONFIG_VERSION_DIST="Freifunk Berlin"
CONFIG_VERSION_HWREV=""
CONFIG_VERSION_MANUFACTURER=""
CONFIG_VERSION_NICK="Kathleen"
CONFIG_VERSION_NUMBER="experimental"
CONFIG_VERSION_NICK="Hedy"
CONFIG_VERSION_NUMBER="0.3.0-alpha"
CONFIG_VERSION_CODE=""
CONFIG_VERSION_PRODUCT=""
CONFIG_VERSION_REPO="http://buildbot.berlin.freifunk.net/buildbot/stable/%V/%T/packages"
# CONFIG_OPENVPN_polarssl_ENABLE_DEF_AUTH is not set
Expand Down
10 changes: 5 additions & 5 deletions feeds.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
src-git packages git://github.com/openwrt/packages.git^e3e9f341e605a06d3c79b8530341a30df57d9d3f
src-git luci git://github.com/openwrt/luci.git^90474569d218cefb789f0c9cd804ccde44b532da
src-git routing git://github.com/openwrt-routing/packages.git^d580d71309f0867022ab7f47badb8c2a1860fc83
src-git packages_berlin git://github.com/freifunk-berlin/firmware-packages.git^34d859b8eb5e7e56738a3de6bcc74e8f31072f18
src-git packages https://github.com/openwrt/packages.git^5c749ad53ed466c0fb1b981a0f662bd0f4dec5c4
src-git luci https://github.com/openwrt/luci.git^e306ee6c93c1ef600012f47e40dd75020d4ab555
src-git routing https://github.com/openwrt-routing/packages.git^dd36dd47bbd75defcb3c517cafe7a19ee425f0af
src-git packages_berlin https://github.com/freifunk-berlin/firmware-packages.git^3186386056cf52ebea3c7298b0a57fa8eafc851e

##
# just for reference (syntax of different feed-sources)
# see https://wiki.openwrt.org/doc/devel/feeds for more info
##
#src-git packages_berlin git://github.com/freifunk-berlin/firmware-packages.git;master
#src-git packages_berlin https://github.com/freifunk-berlin/firmware-packages.git;master
#src-link packages_berlin ../../../firmware-packages
17 changes: 0 additions & 17 deletions patches/000-fix-mt7620-failsafe.patch

This file was deleted.

Loading

0 comments on commit 8c73f02

Please sign in to comment.