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
 * update feeds to trunk
 * change feed url from git -> https://
 * rename ar71xx -> ar71xx_generic
  • Loading branch information
lynxis committed Jun 2, 2016
1 parent 8632416 commit cd1ae9b
Show file tree
Hide file tree
Showing 16 changed files with 71 additions and 675 deletions.
96 changes: 48 additions & 48 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/$(TARGET).config $(FW_DIR)/configs/common.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,51 +26,51 @@ 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)
cd $(OPENWRT_DIR); \
# clean up lede working copy
lede-clean: stamp-clean-lede-cleaned .stamp-lede-cleaned
.stamp-lede-cleaned: config.mk | $(LEDE_DIR)
cd $(LEDE_DIR); \
./scripts/feeds clean && \
git clean -dff && git fetch && git reset --hard HEAD && \
rm -rf bin .config feeds.conf build_dir/target-* logs/
touch $@

# 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
ln -s $(FW_DIR)/patches $(OPENWRT_DIR)
# patches require updated lede working copy
$(LEDE_DIR)/patches: | .stamp-lede-updated
ln -s $(FW_DIR)/patches $(LEDE_DIR)

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

# update feeds
feeds-update: stamp-clean-feeds-updated .stamp-feeds-updated
.stamp-feeds-updated: $(OPENWRT_DIR)/feeds.conf
+cd $(OPENWRT_DIR); \
.stamp-feeds-updated: $(LEDE_DIR)/feeds.conf
+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 @@ -85,27 +85,27 @@ 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

# openwrt config
$(OPENWRT_DIR)/.config: .stamp-feeds-updated $(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-feeds-updated $(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
.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
$(UMASK); \
$(MAKE) -C $(OPENWRT_DIR) $(MAKE_ARGS)
$(MAKE) -C $(LEDE_DIR) $(MAKE_ARGS)
touch $@

# fill firmwares-directory with:
Expand All @@ -116,8 +116,8 @@ 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 $(OPENWRT_DIR)/bin/$(MAINTARGET)/OpenWrt-ImageBuilder-*+$(FW_REVISION)*.tar.bz2))
$(eval TOOLCHAIN_PATH := $(shell printf "%s:" $(LEDE_DIR)/staging_dir/toolchain-*/bin))
$(eval IB_FILE := $(shell ls $(LEDE_DIR)/bin/targets/$(MAINTARGET)/$(SUBTARGET)/*-imagebuilder-*.tar.bz2))
cd $(IB_BUILD_DIR); tar xf $(IB_FILE)
# shorten dir name to prevent too long paths
mv $(IB_BUILD_DIR)/$(shell basename $(IB_FILE) .tar.bz2) $(IB_BUILD_DIR)/imgbldr
Expand Down Expand Up @@ -152,12 +152,12 @@ firmwares: stamp-clean-firmwares .stamp-firmwares
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 @@ -169,9 +169,9 @@ firmwares: stamp-clean-firmwares .stamp-firmwares
rm -rf $$TARGET_DIR; \
mv $$DIR_ABS $$TARGET_DIR; \
cp $(FW_TARGET_DIR)/$$VERSION_FILE $$TARGET_DIR/; \
for FILE in $$TARGET_DIR/openwrt*; do \
for FILE in $$TARGET_DIR/lede*; do \
[ -e "$$FILE" ] || continue; \
NEWNAME="$${FILE/openwrt-/kathleen-}"; \
NEWNAME="$${FILE/lede-/kathleen-}"; \
NEWNAME="$${NEWNAME/ar71xx-generic-/}"; \
NEWNAME="$${NEWNAME/mpc85xx-generic-/}"; \
NEWNAME="$${NEWNAME/squashfs-/}"; \
Expand All @@ -180,12 +180,12 @@ firmwares: stamp-clean-firmwares .stamp-firmwares
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-*+$(FW_REVISION)*.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 @@ -195,8 +195,8 @@ stamp-clean-%:
stamp-clean:
rm -f .stamp-*

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

.PHONY: openwrt-clean openwrt-update patch feeds-update prepare compile firmwares stamp-clean clean
.PHONY: lede-clean lede-update patch feeds-update prepare compile firmwares stamp-clean clean
.NOTPARALLEL:
.FORCE:
6 changes: 3 additions & 3 deletions config.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# default parameters for Makefile
SHELL:=$(shell which bash)
TARGET=ar71xx
TARGET=ar71xx_generic
PACKAGES_LIST_DEFAULT=default backbone
OPENWRT_SRC=git://git.openwrt.org/15.05/openwrt.git
OPENWRT_COMMIT=64e116779c0f7da6d98068b8e7c50f528c8a91f2
LEDE_SRC=https://git.lede-project.org/source.git
LEDE_COMMIT=9128ed33b5d476eecbc0d5ec37c9002a8b103b81
MAKE_ARGS=
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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^c3ed91a734366ac5e455c383f8e8beda344a11d3
src-git luci git://github.com/openwrt/luci.git^7a4741ebbdf29d53d60cc1599512ee1cd09ac2ac
src-git routing git://github.com/openwrt-routing/packages.git^4e5c403a52af6e3939438cdf6cd5aad8eb2b7779
src-git packages_berlin git://github.com/freifunk-berlin/firmware-packages.git^857b3cd5d081dfed2c65581b141992ee9ebd8051
src-git packages https://github.com/openwrt/packages.git^891e20baf5150109a6895140bf1aec1ac6bd431e
src-git luci https://github.com/openwrt/luci.git^b6cdf3706b3dfc9fb7fff7a517a68663a6e1f84d
src-git routing https://github.com/openwrt-routing/packages.git^c9a41eb08e1603a181e565f704a8602de26ffe22
src-git packages_berlin https://github.com/freifunk-berlin/firmware-packages.git^857b3cd5d081dfed2c65581b141992ee9ebd8051

##
# 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
34 changes: 15 additions & 19 deletions patches/002-banner-info.patch
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
Index: openwrt/package/base-files/files/etc/banner
Index: lede/package/base-files/files/etc/banner
===================================================================
--- openwrt.orig/package/base-files/files/etc/banner
+++ openwrt/package/base-files/files/etc/banner
@@ -1,14 +1,21 @@
- _______ ________ __
- | |.-----.-----.-----.| | | |.----.| |_
- | - || _ | -__| || | | || _|| _|
- |_______|| __|_____|__|__||________||__| |____|
- |__| W I R E L E S S F R E E D O M
--- lede.orig/package/base-files/files/etc/banner 2016-06-02 02:43:57.601381806 +0200
+++ lede/package/base-files/files/etc/banner 2016-06-02 02:46:17.928201514 +0200
@@ -1,10 +1,20 @@
- _________
- / /\ _ ___ ___ ___
- / LE / \ | | | __| \| __|
- / DE / \ | |__| _|| |) | _|
- /________/ LE \ |____|___|___/|___| lede-project.org
- \ \ DE /
- \ LE \ / -----------------------------------------------------------
- \ DE \ / %N (%C, %R)
- \________\/ -----------------------------------------------------------
+ _____ _ __ _
+ | ___| (_)/ _| | |
+ | |_ _ __ ___ _| |_ _ _ _ __ | | __
+ | _| '__/ _ \ | _| | | | '_ \| |/ /
+ | | | | | __/ | | | |_| | | | | <
+ \_| |_| \___|_|_| \__,_|_| |_|_|\_\
+
-----------------------------------------------------
- CHAOS CALMER (%C, %R)
- -----------------------------------------------------
- * 1 1/2 oz Gin Shake with a glassful
- * 1/4 oz Triple Sec of broken ice and pour
- * 3/4 oz Lime Juice unstrained into a goblet.
- * 1 1/2 oz Orange Juice
- * 1 tsp. Grenadine Syrup
+ Firmware Berlin (%N %C rev %R)
+ %P - %S
+ https://wiki.freifunk.net/Berlin:Firmware
+ https://github.com/freifunk-berlin
-----------------------------------------------------
+ -----------------------------------------------------
+
+ If you find bugs please report them at:
+
+ https://github.com/freifunk-berlin/firmware/issues
+
+ For questions write a mail to <berlin@berlin.freifunk.net>
+ or come to our weekly meetings at cbase/wikimedia in Berlin.
+
17 changes: 0 additions & 17 deletions patches/021-fix-mt7620-failsafe.patch

This file was deleted.

Loading

0 comments on commit cd1ae9b

Please sign in to comment.