Showing 2,857 changed files with 79,777 additions and 196,980 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ Thanks for your contribution to OpenWrt!
To help keep the codebase consistent and readable,
and to help people review your contribution,
we ask you to follow the rules you find in the wiki at this link
https://lede-project.org/submitting-patches
https://openwrt.org/submitting-patches

Please remove this message before posting the pull request.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ ifneq ($(OPENWRT_BUILD),1)
export OPENWRT_BUILD
GREP_OPTIONS=
export GREP_OPTIONS
CDPATH=
export CDPATH
include $(TOPDIR)/include/debug.mk
include $(TOPDIR)/include/depends.mk
include $(TOPDIR)/include/toplevel.mk
Expand Down Expand Up @@ -85,7 +87,7 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages
fi

checksum: FORCE
$(call sha256sums,$(BIN_DIR))
$(call sha256sums,$(BIN_DIR),$(CONFIG_BUILDBOT))

diffconfig: FORCE
mkdir -p $(BIN_DIR)
Expand Down
37 changes: 21 additions & 16 deletions README
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
This is the buildsystem for the OpenWrt Linux distribution.
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------

Please use "make menuconfig" to choose your preferred
configuration for the toolchain and firmware.
This is the buildsystem for the OpenWrt Linux distribution.

You need to have installed gcc, binutils, bzip2, flex, python, perl, make,
find, grep, diff, unzip, gawk, getopt, subversion, libz-dev and libc headers.
To build your own firmware you need a Linux, BSD or MacOSX system (case
sensitive filesystem required). Cygwin is unsupported because of the lack
of a case sensitive file system.

Run "./scripts/feeds update -a" to get all the latest package definitions
defined in feeds.conf / feeds.conf.default respectively
and "./scripts/feeds install -a" to install symlinks of all of them into
package/feeds/.
You need gcc, binutils, bzip2, flex, python, perl, make, find, grep, diff,
unzip, gawk, getopt, subversion, libz-dev and libc headers installed.

Use "make menuconfig" to configure your image.
1. Run "./scripts/feeds update -a" to obtain all the latest package definitions
defined in feeds.conf / feeds.conf.default

Simply running "make" will build your firmware.
It will download all sources, build the cross-compile toolchain,
the kernel and all choosen applications.
2. Run "./scripts/feeds install -a" to install symlinks for all obtained
packages into package/feeds/

To build your own firmware you need to have access to a Linux, BSD or MacOSX system
(case-sensitive filesystem required). Cygwin will not be supported because of
the lack of case sensitiveness in the file system.
3. Run "make menuconfig" to select your preferred configuration for the
toolchain, target system & firmware packages.

4. Run "make" to build your firmware. This will download all sources, build
the cross-compile toolchain and then cross-compile the Linux kernel & all
chosen applications for your target system.

Sunshine!
Your OpenWrt Community
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Install openwrt via uboot web:

### **NB: need to flash transition image firstly, or it will be brick.**

The transition image is [**s1300-factory-to-openwrt.img**](https://github.com/gl-inet/openwrt/blob/openwrt-18.06-s1300/s1300-factory-to-openwrt.img)
when you install openwrt. So first time installation you need to access uboot web twice.
Afterwards, openwrt sysupgrade can be used.

- **Steps:**

1. Push reset button and plug in power, wifi led will blink, release button when middle led light on
2. Set ip to 192.168.1.0/24 and use web browser to access http://192.168.1.1
3. Choose file [**s1300-factory-to-openwrt.img**](https://github.com/gl-inet/openwrt/blob/openwrt-18.06-s1300/s1300-factory-to-openwrt.img) and click "Update Firmware"
(Steps 3 will consume about 30 seconds, then):
4. Poweroff router
5. Repeat step 1, 2, and when step 3 choose your compiled openwrt firmware file and update firmware
(When update finished, router will reboot automatically)

- **Why need transition image**

The kernel and rootfs of factory firmware is on eMMC, and openwrt firmware is on NOR flash.
The transition image includes U-boot and partition table, which decides where to load kernel and rootfs.
After you install openwrt image, you can switch between factory and openwrt firmware by flashing transition image.
Go back to factory firmware use transition image [**s1300-openwrt-to-factory.img**](https://github.com/gl-inet/openwrt/blob/openwrt-18.06-s1300/s1300-openwrt-to-factory.img)
4 changes: 4 additions & 0 deletions config/Config-build.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ menu "Global build settings"
bool "Cryptographically signed package lists"
default y

config SIGNATURE_CHECK
bool "Enable signature checking in opkg"
default SIGNED_PACKAGES

comment "General build options"

config DISPLAY_SUPPORT
Expand Down
4 changes: 2 additions & 2 deletions config/Config-images.in
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ menu "Target Images"

config TARGET_KERNEL_PARTSIZE
int "Kernel partition size (in MB)"
depends on GRUB_IMAGES
depends on GRUB_IMAGES || USES_BOOT_PART
default 16

config TARGET_ROOTFS_PARTSIZE
int "Root filesystem partition size (in MB)"
depends on GRUB_IMAGES || TARGET_ROOTFS_EXT4FS || TARGET_rb532 || TARGET_mvebu || TARGET_uml
depends on GRUB_IMAGES || USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_rb532 || TARGET_mvebu || TARGET_uml
default 256
help
Select the root filesystem partition size.
Expand Down
13 changes: 4 additions & 9 deletions feeds.conf.default
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
src-git packages https://git.openwrt.org/feed/packages.git
src-git luci https://git.openwrt.org/project/luci.git
src-git routing https://git.openwrt.org/feed/routing.git
src-git telephony https://git.openwrt.org/feed/telephony.git
#src-git video https://github.com/openwrt/video.git
#src-git targets https://github.com/openwrt/targets.git
#src-git management https://github.com/openwrt-management/packages.git
#src-git oldpackages http://git.openwrt.org/packages.git
#src-link custom /usr/src/openwrt/custom-feed
src-git packages https://git.openwrt.org/feed/packages.git;openwrt-18.06
src-git luci https://git.openwrt.org/project/luci.git;openwrt-18.06
src-git routing https://git.openwrt.org/feed/routing.git;openwrt-18.06
src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-18.06
4 changes: 2 additions & 2 deletions include/cmake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
endif

CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR))
CMAKE_SOURCE_DIR = $(PKG_BUILD_DIR)
HOST_CMAKE_SOURCE_DIR = $(HOST_BUILD_DIR)
CMAKE_SOURCE_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR))
HOST_CMAKE_SOURCE_DIR = $(HOST_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR))
MAKE_PATH = $(firstword $(CMAKE_BINARY_SUBDIR) .)

ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
Expand Down
17 changes: 6 additions & 11 deletions include/feeds.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@

FEEDS_INSTALLED:=$(notdir $(wildcard $(TOPDIR)/package/feeds/*))
FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n))
FEEDS_ENABLED:=$(foreach feed,$(FEEDS_AVAILABLE),$(if $(CONFIG_FEED_$(feed)),$(feed)))
FEEDS_DISABLED:=$(filter-out $(FEEDS_ENABLED),$(FEEDS_AVAILABLE))

PACKAGE_SUBDIRS=$(PACKAGE_DIR)
ifneq ($(CONFIG_PER_FEED_REPO),)
PACKAGE_SUBDIRS += $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/base
ifneq ($(CONFIG_PER_FEED_REPO_ADD_DISABLED),)
PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
else
PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_ENABLED),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
endif
PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
endif

opkg_package_files = $(wildcard \
Expand All @@ -39,10 +33,11 @@ endef
# 1: destination file
define FeedSourcesAppend
( \
echo "src/gz %d_core %U/targets/%S/packages"; \
echo 'src/gz %d_core %U/targets/%S/packages'; \
$(strip $(if $(CONFIG_PER_FEED_REPO), \
$(foreach feed,base $(FEEDS_ENABLED),echo "src/gz %d_$(feed) %U/packages/%A/$(feed)";) \
$(if $(CONFIG_PER_FEED_REPO_ADD_DISABLED), \
$(foreach feed,$(FEEDS_DISABLED),echo "$(if $(CONFIG_PER_FEED_REPO_ADD_COMMENTED),# )src/gz %d_$(feed) %U/packages/%A/$(feed)";)))) \
echo 'src/gz %d_base %U/packages/%A/base'; \
$(foreach feed,$(FEEDS_AVAILABLE), \
$(if $(CONFIG_FEED_$(feed)), \
echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )src/gz %d_$(feed) %U/packages/%A/$(feed)';)))) \
) >> $(1)
endef
2 changes: 1 addition & 1 deletion include/hardening.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ifdef CONFIG_PKG_CHECK_FORMAT_SECURITY
endif
ifdef CONFIG_PKG_ASLR_PIE
ifeq ($(strip $(PKG_ASLR_PIE)),1)
TARGET_CFLAGS += -fPIC
TARGET_CFLAGS += $(FPIC)
TARGET_LDFLAGS += -specs=$(INCLUDE_DIR)/hardened-ld-pie.specs
endif
endif
Expand Down
2 changes: 1 addition & 1 deletion include/host-build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ define Host/Exports/Default
$(1) : export STAGING_PREFIX=$$(HOST_BUILD_PREFIX)
$(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig:$$(HOST_BUILD_PREFIX)/lib/pkgconfig
$(1) : export PKG_CONFIG_LIBDIR=$$(HOST_BUILD_PREFIX)/lib/pkgconfig
$(1) : export CCACHE_DIR:=$(STAGING_DIR_HOST)/ccache
$(if $(CONFIG_CCACHE),$(1) : export CCACHE_DIR:=$(STAGING_DIR_HOST)/ccache)
$(if $(HOST_CONFIG_SITE),$(1) : export CONFIG_SITE:=$(HOST_CONFIG_SITE))
$(if $(IS_PACKAGE_BUILD),$(1) : export PATH=$$(TARGET_PATH_PKG))
endef
Expand Down
8 changes: 6 additions & 2 deletions include/image-commands.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ endef

define Build/netgear-dni
$(STAGING_DIR_HOST)/bin/mkdniimg \
-B $(NETGEAR_BOARD_ID) -v $(VERSION_DIST).$(REVISION) \
-B $(NETGEAR_BOARD_ID) -v $(VERSION_DIST).$(firstword $(subst -, ,$(REVISION))) \
$(if $(NETGEAR_HW_ID),-H $(NETGEAR_HW_ID)) \
-r "$(1)" \
-i $@ -o $@.new
Expand Down Expand Up @@ -135,7 +135,7 @@ define Build/lzma-no-dict
endef

define Build/gzip
gzip --force -9n -c $@ $(1) > $@.new
gzip -f -9n -c $@ $(1) > $@.new
@mv $@.new $@
endef

Expand Down Expand Up @@ -186,6 +186,10 @@ define Build/append-ubi
rm $@.tmp
endef

define Build/append-uboot
dd if=$(UBOOT_PATH) >> $@
endef

define Build/pad-to
dd if=$@ of=$@.new bs=$(1) conv=sync
mv $@.new $@
Expand Down
23 changes: 21 additions & 2 deletions include/image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ define Device/Init
CMDLINE:=

IMAGES :=
ARTIFACTS :=
IMAGE_PREFIX := $(IMG_PREFIX)-$(1)
IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1)-$$(2)
KERNEL_PREFIX = $$(IMAGE_PREFIX)
Expand Down Expand Up @@ -393,6 +394,7 @@ endef

define Device/Check/Common
_PROFILE_SET = $$(strip $$(foreach profile,$$(PROFILES) DEVICE_$(1),$$(call DEVICE_CHECK_PROFILE,$$(profile))))
DEVICE_PACKAGES += $$(call extra_packages,$$(DEVICE_PACKAGES))
ifdef TARGET_PER_DEVICE_ROOTFS
$$(eval $$(call merge_packages,_PACKAGES,$$(DEVICE_PACKAGES) $$(call DEVICE_EXTRA_PACKAGES,$(1))))
ROOTFS_ID/$(1) := $$(if $$(_PROFILE_SET),$$(call mkfs_packages_id,$$(_PACKAGES)))
Expand Down Expand Up @@ -497,6 +499,19 @@ define Device/Build/image

endef

define Device/Build/artifact
$$(_TARGET): $(BIN_DIR)/$(IMAGE_PREFIX)-$(1)
$(KDIR)/tmp/$(IMAGE_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE)
@rm -f $$@
$$(call concat_cmd,$(ARTIFACT/$(1)))

.IGNORE: $(BIN_DIR)/$(IMAGE_PREFIX)-$(1)

$(BIN_DIR)/$(IMAGE_PREFIX)-$(1): $(KDIR)/tmp/$(IMAGE_PREFIX)-$(1)
cp $$^ $$@

endef

define Device/Build
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(call Device/Build/initramfs,$(1)))
$(call Device/Build/kernel,$(1))
Expand All @@ -507,6 +522,10 @@ define Device/Build
$$(eval $$(foreach image,$$(IMAGES), \
$$(foreach fs,$$(filter $(TARGET_FILESYSTEMS),$$(FILESYSTEMS)), \
$$(call Device/Build/image,$$(fs),$$(image),$(1)))))

$$(eval $$(foreach artifact,$$(ARTIFACTS), \
$$(call Device/Build/artifact,$$(artifact))))

endef

define Device/DumpInfo
Expand Down Expand Up @@ -562,7 +581,7 @@ define BuildImage
$(call Image/Prepare)

legacy-images-prepare-make: image_prepare
$(MAKE) legacy-images-prepare
$(MAKE) legacy-images-prepare BIN_DIR="$(BIN_DIR)"

else
image_prepare:
Expand All @@ -586,7 +605,7 @@ define BuildImage

legacy-images-make: install-images
$(call Image/mkfs/ubifs/legacy)
$(MAKE) legacy-images
$(MAKE) legacy-images BIN_DIR="$(BIN_DIR)"

install: install-images
$(call Image/Manifest)
Expand Down
2 changes: 1 addition & 1 deletion include/kernel-build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ifneq ($(DUMP),1)
all: compile
endif

KERNEL_FILE_DEPENDS=$(BACKPORT_PATCH_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR)
KERNEL_FILE_DEPENDS=$(GENERIC_BACKPORT_DIR) $(GENERIC_PATCH_DIR) $(GENERIC_HACK_DIR) $(PATCH_DIR) $(GENERIC_FILES_DIR) $(FILES_DIR)
STAMP_PREPARED=$(LINUX_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,$(KERNEL_FILE_DEPENDS),)))
STAMP_CONFIGURED:=$(LINUX_DIR)/.configured
include $(INCLUDE_DIR)/download.mk
Expand Down
12 changes: 4 additions & 8 deletions include/kernel-version.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@

LINUX_RELEASE?=1

LINUX_VERSION-3.18 = .71
LINUX_VERSION-4.4 = .121
LINUX_VERSION-4.9 = .96
LINUX_VERSION-4.14 = .37
LINUX_VERSION-4.9 = .196
LINUX_VERSION-4.14 = .148

LINUX_KERNEL_HASH-3.18.71 = 5abc9778ad44ce02ed6c8ab52ece8a21c6d20d21f6ed8a19287b4a38a50c1240
LINUX_KERNEL_HASH-4.4.121 = 44a88268b5088dc326b30c9b9133ac35a9a200b636b7268d08f32abeae6ca729
LINUX_KERNEL_HASH-4.9.96 = 826f596eb5197f8b17304649c2990dd7b766f5c79076cae79f4261c40cea877f
LINUX_KERNEL_HASH-4.14.37 = 8197e7ed3620713e412905430a7bf93e2048384042ffba189a66f0eeb6908e92
LINUX_KERNEL_HASH-4.9.196 = e0ab12b04a975630ece2142a1ac15cfe45140b8c3359226b035c15ca7c92c6ef
LINUX_KERNEL_HASH-4.14.148 = 12d2b74003e13a6c1956064754255249fbe5c7af6cbdfb2ddeba45b5ed7c0fad

remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
Expand Down
6 changes: 3 additions & 3 deletions include/kernel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ else
LINUX_KERNEL:=$(KERNEL_BUILD_DIR)/vmlinux

LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.xz
TESTING:=$(if $(findstring -rc,$(LINUX_VERSION)),/testing,)
ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
LINUX_SITE:=@KERNEL/linux/kernel/v$(word 1,$(subst ., ,$(KERNEL_BASE))).x$(TESTING)
LINUX_SITE:=@KERNEL/linux/kernel/v$(word 1,$(subst ., ,$(KERNEL_BASE))).x
else
LINUX_UNAME_VERSION:=$(strip $(shell cat $(LINUX_DIR)/include/config/kernel.release 2>/dev/null))
endif
Expand Down Expand Up @@ -97,7 +96,7 @@ endif

KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS)

KERNEL_MAKE_FLAGS := \
KERNEL_MAKE_FLAGS = \
HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
CROSS_COMPILE="$(KERNEL_CROSS)" \
ARCH="$(LINUX_KARCH)" \
Expand Down Expand Up @@ -254,6 +253,7 @@ $(call KernelPackage/$(1)/config)
$$(eval $$(call BuildPackage,kmod-$(1)))

$$(IPKG_kmod-$(1)): $$(wildcard $$(FILES))

endef

version_filter=$(if $(findstring @,$(1)),$(shell $(SCRIPT_DIR)/package-metadata.pl version_filter $(KERNEL_PATCHVER) $(1)),$(1))
Expand Down
1 change: 1 addition & 0 deletions include/netfilter.mk
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ $(eval $(call nf_add,IPT_PHYSDEV,CONFIG_NETFILTER_XT_MATCH_PHYSDEV, $(P_XT)xt_ph
# filter

$(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_STRING, $(P_XT)xt_string))
$(eval $(call nf_add,IPT_FILTER,CONFIG_NETFILTER_XT_MATCH_BPF, $(P_XT)xt_bpf))


# ipopt
Expand Down
2 changes: 1 addition & 1 deletion include/package-ipkg.mk
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ $(_endef)
fi; \
done; $(Package/$(1)/extra_provides) \
) | sort -u > $(PKG_INFO_DIR)/$(1).provides
$(if $(PROVIDES),@for pkg in $(PROVIDES); do cp $(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/$$$$pkg.provides; done)
$(if $(PROVIDES),@for pkg in $(filter-out $(1),$(PROVIDES)); do cp $(PKG_INFO_DIR)/$(1).provides $(PKG_INFO_DIR)/$$$$pkg.provides; done)
$(CheckDependencies)

$(RSTRIP) $$(IDIR_$(1))
Expand Down
Loading