sync build script for OpenWrt 19.07

This commit is contained in:
coolsnowwolf 2020-02-21 02:41:00 +08:00
parent 6561323807
commit 9f8000a6d6
63 changed files with 978 additions and 546 deletions

View File

@ -180,6 +180,9 @@ menu "Global build settings"
config USE_UCLIBCXX
bool "uClibc++"
config USE_LIBCXX
bool "libc++"
config USE_LIBSTDCXX
bool "libstdc++"
endchoice

View File

@ -39,7 +39,9 @@ define autoreconf
[ -e $(p)/config.rpath ] || \
ln -s $(SCRIPT_DIR)/config.rpath $(p)/config.rpath; \
touch NEWS AUTHORS COPYING ABOUT-NLS ChangeLog; \
$(AM_TOOL_PATHS) $(STAGING_DIR_HOST)/bin/autoreconf -v -f -i -s \
$(AM_TOOL_PATHS) \
LIBTOOLIZE='$(STAGING_DIR_HOST)/bin/libtoolize --install' \
$(STAGING_DIR_HOST)/bin/autoreconf -v -f -i -s \
$(if $(word 2,$(3)),--no-recursive) \
-B $(STAGING_DIR_HOST)/share/aclocal \
$(patsubst %,-I %,$(5)) \

View File

@ -103,6 +103,7 @@ define Host/Configure/Default
-DCMAKE_INSTALL_PREFIX=$(HOST_BUILD_PREFIX) \
-DCMAKE_PREFIX_PATH=$(HOST_BUILD_PREFIX) \
-DCMAKE_SKIP_RPATH=TRUE \
-DCMAKE_INSTALL_LIBDIR=lib \
$(CMAKE_HOST_OPTIONS) \
$(HOST_CMAKE_SOURCE_DIR) \
)

View File

@ -55,7 +55,8 @@ define dl_pack
$(if $(dl_pack/$(call ext,$(1))),$(dl_pack/$(call ext,$(1))),$(dl_pack/unknown))
endef
define dl_tar_pack
$(TAR) --numeric-owner --owner=0 --group=0 --sort=name $$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | $(call dl_pack,$(1))
$(TAR) --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name \
$$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | $(call dl_pack,$(1))
endef
ifdef CHECK
@ -288,6 +289,7 @@ endef
define Download/default
FILE:=$(PKG_SOURCE)
URL:=$(PKG_SOURCE_URL)
URL_FILE:=$(PKG_SOURCE_URL_FILE)
SUBDIR:=$(PKG_SOURCE_SUBDIR)
PROTO:=$(PKG_SOURCE_PROTO)
$(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR)))

View File

@ -6,10 +6,10 @@
# See /LICENSE for more information.
#
-include $(TMP_DIR)/.packagesubdirs
-include $(TMP_DIR)/.packageauxvars
FEEDS_INSTALLED:=$(notdir $(wildcard $(TOPDIR)/package/feeds/*))
FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n))
FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n 2>/dev/null))
PACKAGE_SUBDIRS=$(PACKAGE_DIR)
ifneq ($(CONFIG_PER_FEED_REPO),)

View File

@ -190,11 +190,11 @@ ifndef DUMP
host-install: host-compile
host-clean-build: FORCE
$(call Host/Uninstall)
rm -rf $(HOST_BUILD_DIR) $(HOST_STAMP_BUILT)
host-clean: host-clean-build
$(call Host/Clean)
$(call Host/Uninstall)
rm -rf $(HOST_STAMP_INSTALLED)
ifneq ($(CONFIG_AUTOREMOVE),)

View File

@ -319,7 +319,7 @@ endef
define Build/qsdk-ipq-factory-nor
$(TOPDIR)/scripts/mkits-qsdk-ipq-image.sh \
$@.its kernel $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS)
$@.its hlos $(IMAGE_KERNEL) rootfs $(IMAGE_ROOTFS)
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
@mv $@.new $@
endef

View File

@ -157,18 +157,13 @@ endif
# Disable noisy checks by default as in upstream
ifeq ($(strip $(call kernel_patchver_ge,4.7.0)),1)
DTC_FLAGS += -Wno-unit_address_vs_reg
endif
ifeq ($(strip $(call kernel_patchver_ge,4.12.0)),1)
DTC_FLAGS += \
-Wno-unit_address_vs_reg \
-Wno-simple_bus_reg \
-Wno-unit_address_format \
-Wno-pci_bridge \
-Wno-pci_device_bus_num \
-Wno-pci_device_reg
endif
DTC_FLAGS += \
-Wno-unit_address_vs_reg \
-Wno-simple_bus_reg \
-Wno-unit_address_format \
-Wno-pci_bridge \
-Wno-pci_device_bus_num \
-Wno-pci_device_reg
ifeq ($(strip $(call kernel_patchver_ge,4.17.0)),1)
DTC_FLAGS += \
-Wno-avoid_unnecessary_addr_size \
@ -593,7 +588,7 @@ define Device/Build/image
DEVICE_ALT2_VARIANT="$(DEVICE_ALT2_VARIANT)" \
DEVICE_TITLE="$(DEVICE_TITLE)" \
TARGET="$(BOARD)" \
SUBTARGET="$(SUBTARGET)" \
SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
VERSION_NUMBER="$(VERSION_NUMBER)" \
VERSION_CODE="$(VERSION_CODE)" \
SUPPORTED_DEVICES="$(SUPPORTED_DEVICES)" \

View File

@ -131,10 +131,16 @@ define BuildKernel
$(Kernel/Configure)
touch $$@
$(LINUX_DIR)/.modules: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
$(LINUX_DIR)/.modules: export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig
$(LINUX_DIR)/.modules: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
$(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
$(Kernel/CompileModules)
touch $$@
$(LINUX_DIR)/.image: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
$(LINUX_DIR)/.image: export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig
$(LINUX_DIR)/.image: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
$(LINUX_DIR)/.image: $(STAMP_CONFIGURED) $(if $(CONFIG_STRIP_KERNEL_EXPORTS),$(KERNEL_BUILD_DIR)/symtab.h) FORCE
$(Kernel/CompileImage)
$(Kernel/CollectDebug)
@ -157,8 +163,11 @@ define BuildKernel
$(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config
$(_SINGLE)$(KERNEL_MAKE) \
$(if $(findstring Darwin,$(HOST_OS)),HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses") \
YACC=$(STAGING_DIR_HOST)/bin/bison \
$$@
$(LINUX_RECONF_DIFF) $(LINUX_DIR)/.config > $(LINUX_RECONFIG_TARGET)
$(LINUX_RECONF_DIFF) $(LINUX_DIR)/.config | \
grep -vE '(CONFIG_CC_(HAS_ASM_GOTO|IS_GCC|IS_CLANG)|GCC_VERSION)=' \
> $(LINUX_RECONFIG_TARGET)
install: $(LINUX_DIR)/.image
+$(MAKE) -C image compile install TARGET_BUILD=

View File

@ -146,6 +146,7 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
define Kernel/CompileImage/Initramfs
$(call Kernel/Configure/Initramfs)
$(CP) $(GENERIC_PLATFORM_DIR)/other-files/init $(TARGET_DIR)/init
$(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(TARGET_DIR)/init)
rm -rf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/usr/initramfs_data.cpio*
+$(KERNEL_MAKE) $(if $(KERNELNAME),$(KERNELNAME),all) modules
$(call Kernel/CopyImage,-initramfs)

View File

@ -40,4 +40,4 @@ KERNEL_PATCHVER ?= $(KERNEL)
# disable the md5sum check for unknown kernel versions
LINUX_KERNEL_HASH:=$(LINUX_KERNEL_HASH-$(strip $(LINUX_VERSION)))
LINUX_KERNEL_HASH?=x
LINUX_KERNEL_HASH?=x

View File

@ -77,7 +77,7 @@ else
TARGET_MODULES_DIR:=$(LINUX_TARGET_DIR)/$(MODULES_SUBDIR)
ifneq ($(TARGET_BUILD),1)
PKG_BUILD_DIR ?= $(KERNEL_BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
PKG_BUILD_DIR ?= $(KERNEL_BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
endif
endif
@ -104,6 +104,7 @@ endif
KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS)
KERNEL_MAKE_FLAGS = \
KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR)))" \
HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
CROSS_COMPILE="$(KERNEL_CROSS)" \
ARCH="$(LINUX_KARCH)" \
@ -113,6 +114,7 @@ KERNEL_MAKE_FLAGS = \
KBUILD_BUILD_TIMESTAMP="$(KBUILD_BUILD_TIMESTAMP)" \
KBUILD_BUILD_VERSION="0" \
HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib" \
KBUILD_HOSTLDLIBS="-L$(STAGING_DIR_HOST)/lib" \
CONFIG_SHELL="$(BASH)" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
$(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) \
@ -129,6 +131,11 @@ ifdef CONFIG_USE_SPARSE
KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse
endif
ifneq ($(HOST_OS),Linux)
KERNEL_MAKEOPTS += CONFIG_STACK_VALIDATION=
export SKIP_STACK_VALIDATION:=1
endif
PKG_EXTMOD_SUBDIRS ?= .
define populate_module_symvers
@ -141,7 +148,10 @@ endef
define collect_module_symvers
for subdir in $(PKG_EXTMOD_SUBDIRS); do \
grep -F $$$$(readlink -f $(PKG_BUILD_DIR)) $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \
realdir=$$$$(readlink -f $(PKG_BUILD_DIR)); \
grep -F $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \
[ "$(PKG_BUILD_DIR)" = "$$$$realdir" ] || \
grep -F $$$$realdir $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \
done; \
sort -u $(PKG_BUILD_DIR)/Module.symvers.tmp > $(PKG_BUILD_DIR)/Module.symvers; \
mv $(PKG_BUILD_DIR)/Module.symvers $(PKG_INFO_DIR)/$(PKG_NAME).symvers
@ -243,7 +253,7 @@ $(call KernelPackage/$(1)/config)
exit 1; \
fi; \
done;
$(call ModuleAutoLoad,$(1),$$(1),$(filter-out 0-,$(word 1,$(AUTOLOAD))-),$(filter-out 0,$(word 2,$(AUTOLOAD))),$(wordlist 3,99,$(AUTOLOAD)))
$(call ModuleAutoLoad,$(1),$$(1),$(filter-out 0-,$(word 1,$(AUTOLOAD))-),$(filter-out 0,$(word 2,$(AUTOLOAD))),$(sort $(wordlist 3,99,$(AUTOLOAD))))
$(call KernelPackage/$(1)/install,$$(1))
endef
$(if $(CONFIG_PACKAGE_kmod-$(1)),

View File

@ -185,7 +185,7 @@ $(eval $(call nf_add,IPT_IPV6_EXTRA,CONFIG_IP6_NF_MATCH_RT, $(P_V6)ip6t_rt))
# kernel only
$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT, $(P_XT)nf_nat),))
$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_REDIRECT, $(P_XT)nf_nat_redirect, ge 3.19.0),))
$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_REDIRECT, $(P_XT)nf_nat_redirect),))
$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_IPV4, $(P_V4)nf_nat_ipv4),))
$(eval $(if $(NF_KMOD),$(call nf_add,NF_NAT,CONFIG_NF_NAT_MASQUERADE_IPV4, $(P_V4)nf_nat_masquerade_ipv4, lt 4.18),))
@ -261,8 +261,8 @@ $(eval $(call nf_add,IPT_DEBUG,CONFIG_NETFILTER_XT_TARGET_TRACE, $(P_XT)xt_TRACE
# tproxy
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NETFILTER_XT_MATCH_SOCKET, $(P_XT)xt_socket))
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV4, $(P_V4)nf_socket_ipv4, ge 4.10))
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV6, $(P_V6)nf_socket_ipv6, ge 4.10))
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV4, $(P_V4)nf_socket_ipv4))
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_SOCKET_IPV6, $(P_V6)nf_socket_ipv6))
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NETFILTER_XT_TARGET_TPROXY, $(P_XT)xt_TPROXY))
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_TPROXY_IPV4, $(P_V4)nf_tproxy_ipv4, ge 4.18))
$(eval $(call nf_add,IPT_TPROXY,CONFIG_NF_TPROXY_IPV6, $(P_V6)nf_tproxy_ipv6, ge 4.18))
@ -273,8 +273,8 @@ $(eval $(call nf_add,IPT_LED,CONFIG_NETFILTER_XT_TARGET_LED, $(P_XT)xt_LED))
# tee
$(eval $(call nf_add,IPT_TEE,CONFIG_NETFILTER_XT_TARGET_TEE, $(P_XT)xt_TEE))
$(eval $(if $(NF_KMOD),$(call nf_add,IPT_TEE,CONFIG_NF_DUP_IPV4, $(P_V4)nf_dup_ipv4, ge 4.3),))
$(eval $(if $(NF_KMOD),$(call nf_add,IPT_TEE,CONFIG_NF_DUP_IPV6, $(P_V6)nf_dup_ipv6, ge 4.3),))
$(eval $(if $(NF_KMOD),$(call nf_add,IPT_TEE,CONFIG_NF_DUP_IPV4, $(P_V4)nf_dup_ipv4),))
$(eval $(if $(NF_KMOD),$(call nf_add,IPT_TEE,CONFIG_NF_DUP_IPV6, $(P_V6)nf_dup_ipv6),))
# u32
@ -336,25 +336,26 @@ $(eval $(call nf_add,EBTABLES_WATCHERS,CONFIG_BRIDGE_EBT_NFQUEUE, $(P_EBT)ebt_nf
# nftables
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES, $(P_XT)nf_tables),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_INET, $(P_XT)nf_tables_inet, lt 4.17),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_EXTHDR, $(P_XT)nft_exthdr),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_META, $(P_XT)nft_meta),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_NUMGEN, $(P_XT)nft_numgen, ge 4.9.0),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CT, $(P_XT)nft_ct),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_RBTREE, $(P_XT)nft_set_rbtree, ge 4.9.0),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_RBTREE, $(P_XT)nft_rbtree, lt 4.9.0),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_HASH, $(P_XT)nft_set_hash, ge 4.9.0),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_HASH, $(P_XT)nft_hash, lt 4.9.0),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV4, $(P_V4)nf_tables_ipv4, lt 4.17),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV6, $(P_V6)nf_tables_ipv6, lt 4.17),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_SET, $(P_XT)nf_tables_set, ge 4.18),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV4, $(P_V4)nft_chain_route_ipv4),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV6, $(P_V6)nft_chain_route_ipv6),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_COUNTER, $(P_XT)nft_counter),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LOG, $(P_XT)nft_log),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CT, $(P_XT)nft_ct),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_EXTHDR, $(P_XT)nft_exthdr),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_HASH, $(P_XT)nft_hash),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LIMIT, $(P_XT)nft_limit),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_LOG, $(P_XT)nft_log),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_META, $(P_XT)nft_meta),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_NUMGEN, $(P_XT)nft_numgen),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_OBJREF, $(P_XT)nft_objref),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_QUOTA, $(P_XT)nft_quota),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REDIR, $(P_XT)nft_redir),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REJECT, $(P_XT)nft_reject $(P_V4)nft_reject_ipv4 $(P_V6)nft_reject_ipv6),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REJECT_INET, $(P_XT)nft_reject_inet),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV4, $(P_V4)nf_tables_ipv4, lt 4.17),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV4, $(P_V4)nft_chain_route_ipv4),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NF_TABLES_IPV6, $(P_V6)nf_tables_ipv6, lt 4.17),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_CHAIN_ROUTE_IPV6, $(P_V6)nft_chain_route_ipv6),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_REDIR, $(P_XT)nft_redir, ge 3.19.0),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_QUOTA, $(P_XT)nft_quota, ge 4.9.0),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_HASH, $(P_XT)nft_set_hash, lt 4.18),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_CORE,CONFIG_NFT_SET_RBTREE, $(P_XT)nft_set_rbtree, lt 4.18),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_ARP,CONFIG_NF_TABLES_ARP, $(P_V4)nf_tables_arp, lt 4.17),))
@ -364,11 +365,11 @@ $(eval $(if $(NF_KMOD),$(call nf_add,NFT_BRIDGE,CONFIG_NFT_BRIDGE_REJECT, $(P_EB
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_NAT, $(P_XT)nft_nat),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_CHAIN_NAT_IPV4, $(P_V4)nft_chain_nat_ipv4),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_REDIR_IPV4, $(P_V4)nft_redir_ipv4, ge 3.19.0),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_REDIR_IPV4, $(P_V4)nft_redir_ipv4),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_MASQ, $(P_XT)nft_masq),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT,CONFIG_NFT_MASQ_IPV4, $(P_V4)nft_masq_ipv4),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_REDIR_IPV6, $(P_V6)nft_redir_ipv6, ge 3.19.0),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_REDIR_IPV6, $(P_V6)nft_redir_ipv6),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_CHAIN_NAT_IPV6, $(P_V6)nft_chain_nat_ipv6),))
$(eval $(if $(NF_KMOD),$(call nf_add,NFT_NAT6,CONFIG_NFT_MASQ_IPV6, $(P_V6)nft_masq_ipv6),))

View File

@ -24,7 +24,8 @@ $(if $(MENU),Menu: $(MENU)
)$(if $(DEFAULT),Default: $(DEFAULT)
)$(if $(findstring $(PREREQ_CHECK),1),Prereq-Check: 1
)Version: $(VERSION)
Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS))
$(if $(ABI_VERSION),ABIVersion: $(ABI_VERSION)
)Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS))
Conflicts: $(CONFLICTS)
Menu-Depends: $(MDEPENDS)
Provides: $(PROVIDES)

View File

@ -35,7 +35,8 @@ PARENR :=)
dep_split=$(subst :,$(space),$(1))
dep_rem=$(subst !,,$(subst $(strip $(PARENL)),,$(subst $(strip $(PARENR)),,$(word 1,$(call dep_split,$(1))))))
dep_confvar=$(strip $(foreach cond,$(subst ||, ,$(call dep_rem,$(1))),$(CONFIG_$(cond))))
dep_and=dep_and_res:=$$(and $(subst $(space),$(comma),$(foreach cond,$(subst &&, ,$(1)),$$(CONFIG_$(cond)))))
dep_confvar=$(strip $(foreach cond,$(subst ||, ,$(call dep_rem,$(1))),$(eval $(call dep_and,$(cond)))$(dep_and_res)))
dep_pos=$(if $(call dep_confvar,$(1)),$(call dep_val,$(1)))
dep_neg=$(if $(call dep_confvar,$(1)),,$(call dep_val,$(1)))
dep_if=$(if $(findstring !,$(1)),$(call dep_neg,$(1)),$(call dep_pos,$(1)))
@ -123,6 +124,8 @@ ifeq ($(DUMP),)
endif
$(PKG_INSTALL_STAMP).$(1): prepare-package-install
echo "$(1)" >> $(PKG_INSTALL_STAMP)
else
$(if $(CONFIG_PACKAGE_$(1)),$$(warning WARNING: skipping $(1) -- package has no install section))
endif
endif
@ -162,7 +165,7 @@ Package: $(1)$$(ABIV_$(1))
Version: $(VERSION)
$$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
)$$(call addfield,Conflicts,$$(call mergelist,$(CONFLICTS))
)$$(call addfield,Provides,$$(call mergelist,$(PROVIDES)$$(if $$(ABIV_$(1)), $(1)))
)$$(call addfield,Provides,$$(call mergelist,$$(filter-out $(1)$$(ABIV_$(1)),$(PROVIDES)$$(if $$(ABIV_$(1)), $(1) $(foreach provide,$(PROVIDES),$(provide)$$(call GetABISuffix,$(provide))))))
)$$(call addfield,Alternatives,$$(call mergelist,$(ALTERNATIVES))
)$$(call addfield,Source,$(SOURCE)
)$$(call addfield,SourceName,$(1)
@ -199,6 +202,15 @@ $(_endef)
$(CheckDependencies)
$(RSTRIP) $$(IDIR_$(1))
ifneq ($$(CONFIG_IPK_FILES_CHECKSUMS),)
(cd $$(IDIR_$(1)); \
( \
find . -type f \! -path ./CONTROL/\* -exec sha256sum \{\} \; 2> /dev/null | \
sed 's|\([[:blank:]]\)\./|\1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \
) || true \
)
endif
(cd $$(IDIR_$(1))/CONTROL; \
( \
echo "$$$$CONTROL"; \

View File

@ -11,7 +11,7 @@ all: $(if $(DUMP),dumpinfo,$(if $(CHECK),check,compile))
include $(INCLUDE_DIR)/download.mk
PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
PKG_BUILD_DIR ?= $(BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
PKG_BUILD_PARALLEL ?=
PKG_USE_MIPS16 ?= 1
@ -40,6 +40,10 @@ include $(INCLUDE_DIR)/prereq.mk
include $(INCLUDE_DIR)/unpack.mk
include $(INCLUDE_DIR)/depends.mk
ifneq ($(wildcard $(TOPDIR)/git-src/$(PKG_NAME)/.git),)
USE_GIT_SRC_CHECKOUT:=1
QUILT:=1
endif
ifneq ($(if $(CONFIG_SRC_TREE_OVERRIDE),$(wildcard ./git-src)),)
USE_GIT_TREE:=1
QUILT:=1
@ -53,14 +57,26 @@ endif
include $(INCLUDE_DIR)/quilt.mk
find_library_dependencies = $(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \
$(filter-out $(BUILD_PACKAGES),$(foreach dep, \
$(filter-out @%, $(patsubst +%,%,$(1))), \
$(if $(findstring :,$(dep)), \
$(word 2,$(subst :,$(space),$(dep))), \
$(dep) \
) \
))))
find_library_dependencies = \
$(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \
$(sort $(foreach dep4, \
$(sort $(foreach dep3, \
$(sort $(foreach dep2, \
$(sort $(foreach dep1, \
$(sort $(foreach dep0, \
$(Package/$(1)/depends), \
$(Package/$(dep0)/depends) $(dep0) \
)), \
$(Package/$(dep1)/depends) $(dep1) \
)), \
$(Package/$(dep2)/depends) $(dep2) \
)), \
$(Package/$(dep3)/depends) $(dep3) \
)), \
$(Package/$(dep4)/depends) $(dep4) \
)), \
))
PKG_DIR_NAME:=$(lastword $(subst /,$(space),$(CURDIR)))
STAMP_NO_AUTOREBUILD=$(wildcard $(PKG_BUILD_DIR)/.no_autorebuild)
@ -81,9 +97,10 @@ STAGING_FILES_LIST:=$(PKG_DIR_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),).lis
define CleanStaging
rm -f $(STAMP_INSTALLED)
@-(\
cd "$(STAGING_DIR)"; \
if [ -f packages/$(STAGING_FILES_LIST) ]; then \
cat packages/$(STAGING_FILES_LIST) | xargs -r rm -f 2>/dev/null; \
if [ -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) ]; then \
$(SCRIPT_DIR)/clean-package.sh \
"$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)" \
"$(STAGING_DIR)"; \
fi; \
)
endef
@ -116,6 +133,18 @@ ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
endif
endif
ifdef USE_GIT_SRC_CHECKOUT
define Build/Prepare/Default
mkdir -p $(PKG_BUILD_DIR)
ln -s $(TOPDIR)/git-src/$(PKG_NAME)/.git $(PKG_BUILD_DIR)/.git
( cd $(PKG_BUILD_DIR); \
git checkout .; \
git submodule update --recursive; \
git submodule foreach git config --unset core.worktree; \
git submodule foreach git checkout .; \
)
endef
endif
ifdef USE_GIT_TREE
define Build/Prepare/Default
mkdir -p $(PKG_BUILD_DIR)
@ -235,7 +264,7 @@ define Build/CoreTargets
endef
define Build/DefaultTargets
$(if $(USE_SOURCE_DIR)$(USE_GIT_TREE),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
$(if $(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
$(if $(DUMP),,$(Build/CoreTargets))
define Build/DefaultTargets
@ -257,7 +286,7 @@ endef
endif
BUILD_PACKAGES += $(1)
$(STAMP_PREPARED): $$(if $(QUILT)$(DUMP),,$(call find_library_dependencies,$(DEPENDS)))
$(STAMP_PREPARED): $$(if $(QUILT)$(DUMP),,$(call find_library_dependencies,$(1)))
$(foreach FIELD, TITLE CATEGORY SECTION VERSION,
ifeq ($($(FIELD)),)

View File

@ -24,7 +24,7 @@ $(eval $(call TestHostCommand,case-sensitive-fs, \
$(eval $(call TestHostCommand,proper-umask, \
Please build with umask 022 - other values produce broken packages, \
umask | grep -xE 00[012][012]))
umask | grep -xE 0?0[012][012]))
$(eval $(call SetupHostCommand,gcc, \
Please install the GNU C Compiler (gcc) 4.8 or later, \
@ -105,9 +105,9 @@ $(eval $(call SetupHostCommand,cp,Please install GNU fileutils, \
gcp --help 2>&1 | grep 'Copy SOURCE', \
cp --help 2>&1 | grep 'Copy SOURCE'))
$(eval $(call SetupHostCommand,seq,, \
$(eval $(call SetupHostCommand,seq,Please install seq, \
gseq --version, \
seq --version))
seq --version 2>&1 | grep seq))
$(eval $(call SetupHostCommand,awk,Please install GNU 'awk', \
gawk --version 2>&1 | grep GNU, \
@ -141,10 +141,21 @@ $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \
$(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
perl --version | grep "perl.*v5"))
$(eval $(call SetupHostCommand,python,Please install Python 2.x, \
python2.7 -V 2>&1 | grep Python, \
python2 -V 2>&1 | grep Python, \
python -V 2>&1 | grep Python))
$(eval $(call CleanupPython2))
$(eval $(call SetupHostCommand,python,Please install Python >= 3.5, \
python3.8 -V 2>&1 | grep 'Python 3', \
python3.7 -V 2>&1 | grep 'Python 3', \
python3.6 -V 2>&1 | grep 'Python 3', \
python3.5 -V 2>&1 | grep 'Python 3', \
python3 -V 2>&1 | grep -E 'Python 3\.[5-9]\.?'))
$(eval $(call SetupHostCommand,python3,Please install Python >= 3.5, \
python3.8 -V 2>&1 | grep 'Python 3', \
python3.7 -V 2>&1 | grep 'Python 3', \
python3.6 -V 2>&1 | grep 'Python 3', \
python3.5 -V 2>&1 | grep 'Python 3', \
python3 -V 2>&1 | grep -E 'Python 3\.[5-9]\.?'))
$(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))

View File

@ -66,6 +66,18 @@ define RequireHeader
$$(eval $$(call Require,$(1),$(2)))
endef
define CleanupPython2
define Require/python2-cleanup
if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \
$(STAGING_DIR_HOST)/bin/python -V 2>&1 | \
grep -q 'Python 2'; then \
rm $(STAGING_DIR_HOST)/bin/python; \
fi
endef
$$(eval $$(call Require,python2-cleanup))
endef
define QuoteHostCommand
'$(subst ','"'"',$(strip $(1)))'
endef

View File

@ -94,17 +94,17 @@ endef
kernel_files=$(foreach fdir,$(GENERIC_FILES_DIR) $(FILES_DIR),$(fdir)/.)
define Kernel/Patch/Default
$(if $(QUILT),rm -rf $(PKG_BUILD_DIR)/patches; mkdir -p $(PKG_BUILD_DIR)/patches)
$(if $(QUILT),rm -rf $(LINUX_DIR)/patches; mkdir -p $(LINUX_DIR)/patches)
$(if $(kernel_files),$(CP) $(kernel_files) $(LINUX_DIR)/)
find $(LINUX_DIR)/ -name \*.rej -or -name \*.orig | $(XARGS) rm -f
if [ -d $(GENERIC_PLATFORM_DIR)/patches$(if $(wildcard $(GENERIC_PLATFORM_DIR)/patches-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER)) ]; then \
echo "generic patches directory is present. please move your patches to the pending directory" ; \
exit 1; \
fi
$(call PatchDir,$(PKG_BUILD_DIR),$(GENERIC_BACKPORT_DIR),generic-backport/)
$(call PatchDir,$(PKG_BUILD_DIR),$(GENERIC_PATCH_DIR),generic/)
$(call PatchDir,$(PKG_BUILD_DIR),$(GENERIC_HACK_DIR),generic-hack/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR),platform/)
$(call PatchDir,$(LINUX_DIR),$(GENERIC_BACKPORT_DIR),generic-backport/)
$(call PatchDir,$(LINUX_DIR),$(GENERIC_PATCH_DIR),generic/)
$(call PatchDir,$(LINUX_DIR),$(GENERIC_HACK_DIR),generic-hack/)
$(call PatchDir,$(LINUX_DIR),$(PATCH_DIR),platform/)
endef
define Quilt/RefreshDir

View File

@ -78,7 +78,13 @@ define prepare_rootfs
done; \
for script in ./etc/init.d/*; do \
grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script enable; \
if ! echo " $(3) " | grep -q " $$(basename $$script) "; then \
IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script enable; \
echo "Enabling" $$(basename $$script); \
else \
IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script disable; \
echo "Disabling" $$(basename $$script); \
fi; \
done || true \
)
$(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(1)/usr/lib/opkg/status)
@ -93,4 +99,5 @@ define prepare_rootfs
rm -rf $(1)/boot
$(call clean_ipkg,$(1))
$(call mklibs,$(1))
$(if $(SOURCE_DATE_EPOCH),find $(1)/ -mindepth 1 -execdir touch -hcd "@$(SOURCE_DATE_EPOCH)" "{}" +)
endef

View File

@ -12,26 +12,35 @@ OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE)
export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
define feedname
$(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1))))
endef
ifeq ($(SCAN_NAME),target)
SCAN_DEPS=image/Makefile profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk image/*.mk
else
SCAN_DEPS=$(TOPDIR)/include/package*.mk
ifneq ($(call feedname,$(SCAN_DIR)),)
SCAN_DEPS += $(TOPDIR)/feeds/$(call feedname,$(SCAN_DIR))/*.mk
endif
endif
ifeq ($(IS_TTY),1)
define progress
ifneq ($(strip $(NO_COLOR)),1)
define progress
printf "\033[M\r$(1)" >&2;
endef
endef
else
define progress
printf "\r$(1)" >&2;
endef
endif
else
define progress
:;
endef
endif
define feedname
$(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1))))
endef
define PackageDir
$(TMP_DIR)/.$(SCAN_TARGET): $(TMP_DIR)/info/.$(SCAN_TARGET)-$(1)
$(TMP_DIR)/info/.$(SCAN_TARGET)-$(1): $(SCAN_DIR)/$(2)/Makefile $(foreach DEP,$(DEPS_$(SCAN_DIR)/$(2)/Makefile) $(SCAN_DEPS),$(wildcard $(if $(filter /%,$(DEP)),$(DEP),$(SCAN_DIR)/$(2)/$(DEP))))

View File

@ -1,23 +0,0 @@
export PLATFORM=posix
SCONS_VARS = \
CC="$(TARGET_CC_NOCACHE)" \
CXX="$(TARGET_CXX_NOCACHE)" \
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
CXXFLAGS="$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)" \
CPPFLAGS="$(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
DESTDIR="$(PKG_INSTALL_DIR)"
define Build/Configure/Default
(cd $(PKG_BUILD_DIR); \
$(SCONS_VARS) \
scons \
prefix=/usr \
$(SCONS_OPTIONS) \
install \
)
endef
define Build/Compile
endef

View File

@ -21,7 +21,7 @@ luci-app-pptp-server luci-app-arpbind luci-app-vlmcsd luci-app-wol luci-app-ramf
luci-app-sfe luci-app-flowoffload luci-app-nlbwmon luci-app-accesscontrol \
ddns-scripts_aliyun ddns-scripts_dnspod
# For nas targets
DEFAULT_PACKAGES.nas:=fdisk lsblk mdadm automount autosamba luci-app-usb-printer
DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm
# For router targets
DEFAULT_PACKAGES.router:=dnsmasq-full iptables ppp ppp-mod-pppoe firewall kmod-ipt-offload kmod-tcp-bbr
DEFAULT_PACKAGES.bootloader:=
@ -57,10 +57,6 @@ else
endif
endif
ifneq ($(filter 4.9,$(KERNEL_PATCHVER)),)
DEFAULT_PACKAGES.router:=$(filter-out kmod-ipt-offload,$(DEFAULT_PACKAGES.router))
endif
# Add device specific packages (here below to allow device type set from subtarget)
DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE))
@ -186,7 +182,6 @@ ifeq ($(DUMP),1)
CPU_TYPE ?= pentium
CPU_CFLAGS_pentium = -march=pentium-mmx
CPU_CFLAGS_pentium4 = -march=pentium4
CPU_CFLAGS_core2 = -march=core2
endif
ifneq ($(findstring arm,$(ARCH)),)
CPU_TYPE ?= xscale
@ -232,6 +227,9 @@ ifeq ($(DUMP),1)
.SILENT: $(TMP_CONFIG)
.PRECIOUS: $(TMP_CONFIG)
ifdef KERNEL_TESTING_PATCHVER
FEATURES += testing-kernel
endif
ifneq ($(CONFIG_OF),)
FEATURES += dt
endif
@ -290,6 +288,7 @@ define BuildTargets/DumpCurrent
echo 'Target-Optimization: $(if $(CFLAGS),$(CFLAGS),$(DEFAULT_CFLAGS))'; \
echo 'CPU-Type: $(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))'; \
echo 'Linux-Version: $(LINUX_VERSION)'; \
$(if $(LINUX_TESTING_VERSION),echo 'Linux-Testing-Version: $(LINUX_TESTING_VERSION)';) \
echo 'Linux-Release: $(LINUX_RELEASE)'; \
echo 'Linux-Kernel-Arch: $(LINUX_KARCH)'; \
$(if $(SUBTARGET),,$(if $(DEFAULT_SUBTARGET), echo 'Default-Subtarget: $(DEFAULT_SUBTARGET)'; )) \

View File

@ -12,6 +12,7 @@ HOST_BUILD_PREFIX:=$(TOOLCHAIN_DIR)
BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/hardening.mk
HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared

View File

@ -88,9 +88,9 @@ prepare-tmpinfo: FORCE
f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \
[ "$$t" -nt "$$f" ] || ./scripts/$${type}-metadata.pl $(_ignore) config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \
done
[ tmp/.config-feeds.in -nt tmp/.packagesubdirs ] || ./scripts/feeds feed_config > tmp/.config-feeds.in
[ tmp/.config-feeds.in -nt tmp/.packageauxvars ] || ./scripts/feeds feed_config > tmp/.config-feeds.in
./scripts/package-metadata.pl mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; }
./scripts/package-metadata.pl subdirs tmp/.packageinfo > tmp/.packagesubdirs || { rm -f tmp/.packagesubdirs; false; }
./scripts/package-metadata.pl pkgaux tmp/.packageinfo > tmp/.packageauxvars || { rm -f tmp/.packageauxvars; false; }
touch $(TOPDIR)/tmp/.build
.config: ./scripts/config/conf $(if $(CONFIG_HAVE_DOT_CONFIG),,prepare-tmpinfo)
@ -99,13 +99,18 @@ prepare-tmpinfo: FORCE
$(_SINGLE)$(NO_TRACE_MAKE) menuconfig $(PREP_MK); \
fi
ifneq ($(DISTRO_PKG_CONFIG),)
scripts/config/mconf: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
endif
scripts/config/mconf:
@$(_SINGLE)$(SUBMAKE) -s -C scripts/config all CC="$(HOSTCC_WRAPPER)"
$(eval $(call rdep,scripts/config,scripts/config/mconf))
scripts/config/qconf:
@$(_SINGLE)$(SUBMAKE) -s -C scripts/config qconf CC="$(HOSTCC_WRAPPER)"
@$(_SINGLE)$(SUBMAKE) -s -C scripts/config qconf \
CC="$(HOSTCC_WRAPPER)" \
DISTRO-PKG-CONFIG="$(DISTRO_PKG_CONFIG)"
scripts/config/conf:
@$(_SINGLE)$(SUBMAKE) -s -C scripts/config conf CC="$(HOSTCC_WRAPPER)"
@ -145,7 +150,7 @@ xconfig: scripts/config/qconf prepare-tmpinfo FORCE
fi
$< Config.in
prepare_kernel_conf: .config FORCE
prepare_kernel_conf: .config toolchain/install FORCE
ifeq ($(wildcard staging_dir/host/bin/quilt),)
prepare_kernel_conf:
@ -157,6 +162,10 @@ endif
kernel_oldconfig: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux oldconfig
ifneq ($(DISTRO_PKG_CONFIG),)
kernel_menuconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
kernel_nconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
endif
kernel_menuconfig: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig

View File

@ -42,7 +42,7 @@ TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET))
UBOOT_MAKE_FLAGS = \
HOSTCC="$(HOSTCC)" \
HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS)" \
HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \
HOSTLDFLAGS="$(HOST_LDFLAGS)"
define Build/U-Boot/Target

View File

@ -4,8 +4,8 @@ ifndef DUMP
endif
endif
PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX
CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBSTDCXX:libstdcpp
PKG_PREPARED_DEPENDS += CONFIG_USE_UCLIBCXX CONFIG_USE_LIBCXX
CXX_DEPENDS = +USE_UCLIBCXX:uclibcxx +USE_LIBCXX:libcxx +USE_LIBSTDCXX:libstdcpp
ifneq ($(CONFIG_USE_UCLIBCXX),)
ifneq ($(CONFIG_CCACHE),)
@ -14,3 +14,11 @@ ifneq ($(CONFIG_USE_UCLIBCXX),)
TARGET_CXX=g++-uc
endif
endif
ifneq ($(CONFIG_USE_LIBCXX),)
ifneq ($(CONFIG_CCACHE),)
TARGET_CXX_NOCACHE=g++-libcxx
else
TARGET_CXX=g++-libcxx
endif
endif

View File

@ -58,18 +58,13 @@ ifeq ($(strip $(UNPACK_CMD)),)
UNPACK_CMD=gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR_CMD)
endif
endif
ifneq ($(strip $(CRLF_WORKAROUND)),)
CRLF_CMD := && find $(PKG_BUILD_DIR) -type f -print0 | xargs -0 perl -pi -e 's!\r$$$$!!g'
else
CRLF_CMD :=
endif
endif
ifdef PKG_BUILD_DIR
PKG_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(PKG_BUILD_DIR)) $(call CRLF_CMD,$(PKG_BUILD_DIR))
PKG_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(PKG_BUILD_DIR))
endif
ifdef HOST_BUILD_DIR
HOST_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(HOST_BUILD_DIR)) $(call CRLF_CMD,$(HOST_BUILD_DIR))
HOST_UNPACK ?= $(SH_FUNC) $(call UNPACK_CMD,$(HOST_BUILD_DIR))
endif
endif # PKG_SOURCE

View File

@ -108,3 +108,4 @@ VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \
-e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \
-e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \
-e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g'

View File

@ -84,8 +84,12 @@ $(curdir)/index: FORCE
mkdir -p $$d; \
cd $$d || continue; \
$(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages.manifest; \
grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require)' Packages.manifest > Packages && \
gzip -9nc Packages > Packages.gz; \
grep -vE '^(Maintainer|LicenseFiles|Source|SourceName|Require)' Packages.manifest > Packages; \
case "$$(((64 + $$(stat -L -c%s Packages)) % 128))" in 110|111) \
$(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \
{ echo ""; echo ""; } >> Packages;; \
esac; \
gzip -9nc Packages > Packages.gz; \
); done
ifdef CONFIG_SIGNED_PACKAGES
@echo Signing package index...

View File

@ -0,0 +1,62 @@
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libcxx
PKG_VERSION:=9.0.1
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.llvm.org/git/libcxx
PKG_SOURCE_VERSION:=2076f539f410805ef88692b9c0ce0a0b882a7680
PKG_MIRROR_HASH:=6dff036660d478bfaa14e407fc5de26d22da1087118c897b1a3ad2e90cb7bf39
PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE.txt
PKG_BUILD_PARALLEL:=1
CMAKE_BINARY_SUBDIR:=build
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/libcxx
SECTION:=libs
CATEGORY:=Libraries
TITLE:=LLVM libstdc++
URL:=https://libcxx.llvm.org/
DEPENDS:=+libatomic +libpthread
endef
define Package/libcxx/description
LLVM C++ library targeting C++11 and above
endef
CMAKE_OPTIONS += \
-DLIBCXX_ENABLE_ASSERTIONS=OFF \
-DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF \
-DLIBCXX_INCLUDE_BENCHMARKS=OFF \
-DLIBCXX_INCLUDE_DOCS=OFF \
-DLIBCXX_INCLUDE_TESTS=OFF \
-DLIBCXX_HAS_MUSL_LIBC=ON \
-DLIBCXX_STANDALONE_BUILD=ON
TARGET_CXXFLAGS += -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -Wno-attributes -flto
TARGET_LDFLAGS += -Wl,--as-needed
define Build/InstallDev
$(call Build/InstallDev/cmake,$(1))
$(CP) files/g++-libcxx $(TOOLCHAIN_DIR)/bin/
$(SED) 's,CXX,$(TARGET_CXX),g' $(TOOLCHAIN_DIR)/bin/g++-libcxx
endef
define Package/libcxx/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libc++.so.* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libcxx))

View File

@ -0,0 +1,19 @@
#!/bin/sh
WRAPPER_INCLUDEDIR="-I$STAGING_DIR/usr/include/c++/v1"
WRAPPER_LIBDIR="-L$STAGING_DIR/usr/lib"
WRAPPER_LIBS="-lc -lgcc_s -lssp_nonshared"
WRAPPER_OPTIONS=""
WRAPPER_INCLIB="Y"
for arg
do
case "$arg" in
-c|-E|-S) WRAPPER_INCLIB="N" ;;
-static) [ "$WRAPPER_LIBS" != "-lc -lgcc_s -lssp_nonshared -lgcc_eh" ] && WRAPPER_LIBS="-lc -lgcc_s -lssp_nonshared -lgcc_eh" ;;
esac
done
[ "$WRAPPER_INCLIB" = "Y" ] && WRAPPER_OPTIONS="-nodefaultlibs $WRAPPER_LIBDIR -lc++ -lsupc++ $WRAPPER_LIBS"
exec CXX -fno-builtin -nostdinc++ -DGCC_HASCLASSVISIBILITY "$WRAPPER_INCLUDEDIR" "$@" $WRAPPER_OPTIONS

View File

@ -24,7 +24,7 @@ define Package/libuclient
SECTION:=libs
CATEGORY:=Libraries
TITLE:=HTTP/1.1 client library
ABI_VERSION:=$(PKG_VERSION)
ABI_VERSION:=20160123
DEPENDS:=+libubox
endef

View File

@ -25,7 +25,7 @@ define Package/libustream/default
CATEGORY:=Libraries
TITLE:=ustream SSL Library
DEPENDS:=+libubox
ABI_VERSION:=$(PKG_VERSION)
ABI_VERSION:=20150806
endef
define Package/libustream-openssl

View File

@ -36,7 +36,7 @@ define Package/libubus
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libubox
ABI_VERSION:=$(PKG_VERSION)
ABI_VERSION:=20191227
TITLE:=OpenWrt RPC client library
endef

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
#
# Empty/wrong machtype-workaround generator
#

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
IFS=$'\n'
[ -n "$1" -a -n "$2" ] || {
echo "Usage: $0 <file> <directory>"
exit 1
@ -14,7 +15,7 @@ cat "$1" | (
[ -f "$entry" ] && rm -f $entry
done
)
cat "$1" | (
sort -r "$1" | (
cd "$2"
while read entry; do
[ -n "$entry" ] || break

View File

@ -20,8 +20,6 @@ check_lxdialog = $(shell $(SHELL) $(CURDIR)/lxdialog/check-lxdialog.sh -$(1))
export CFLAGS += -DKBUILD_NO_NLS -I. $(call check_lxdialog,ccflags)
export CXXFLAGS += -DKBUILD_NO_NLS
DISTRO-PKG-CONFIG := $(shell which -a pkg-config | grep -E '\/usr' | head -n 1)
conf-objs := conf.o zconf.tab.o
mconf-objs := mconf.o zconf.tab.o
qconf-cxxobjs := qconf.o
@ -31,7 +29,7 @@ lxdialog-objs := \
lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o \
lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
clean-files := zconf.tab.c lex.zconf.c zconf.hash.c
clean-files := zconf.tab.c zconf.lex.c zconf.hash.c
# Remove qconf junk files
clean-files += $(qconf-cxxobjs) qconf.moc .tmp_qtcheck qconf
@ -42,7 +40,7 @@ mconf: $(mconf-objs) $(lxdialog-objs)
$(CC) -o $@ $^ $(call check_lxdialog,ldflags $(CC))
qconf: $(qconf-cxxobjs) $(qconf-objs)
ifneq ($(DISTRO-PKG-CONFIG),)
$(CXX) $(HOSTLOADLIBES_qconf) -o $@ $^
$(CXX) -o $@ $^ $(HOSTLOADLIBES_qconf)
else
echo "You don't have 'pkg-config' installed. Cannot continue"
echo "For now, you may use 'make menuconfig' instead of 'make xconfig'"
@ -55,9 +53,9 @@ zconf.tab.o: zconf.lex.c zconf.hash.c confdata.c
kconfig_load.o: lkc_defs.h
zconf.tab.c: zconf.y
zconf.lex.c: zconf.l
zconf.hash.c: zconf.gperf
zconf.tab.c: zconf.y $(wildcard zconf.tab.c_shipped)
zconf.lex.c: zconf.l $(wildcard zconf.lex.c_shipped)
zconf.hash.c: zconf.gperf $(wildcard zconf.hash.c_shipped)
%.tab.c: %.y
cp $@_shipped $@ || bison -l -b $* -p $(notdir $*) $<

View File

@ -893,7 +893,10 @@ static enum string_value_kind expr_parse_string(const char *str,
switch (type) {
case S_BOOLEAN:
case S_TRISTATE:
return k_string;
val->s = !strcmp(str, "n") ? 0 :
!strcmp(str, "m") ? 1 :
!strcmp(str, "y") ? 2 : -1;
return k_signed;
case S_INT:
val->s = strtoll(str, &tail, 10);
kind = k_signed;

View File

@ -1,4 +1,4 @@
/* ANSI-C code produced by gperf version 3.0.3 */
/* ANSI-C code produced by gperf version 3.0.4 */
/* Command-line: gperf */
/* Computed positions: -k'1,3' */
@ -165,7 +165,7 @@ static struct kconf_id_strings_t kconf_id_strings_contents =
#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
#ifdef __GNUC__
__inline
#ifdef __GNUC_STDC_INLINE__
#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
__attribute__ ((__gnu_inline__))
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (c) 2018 Yousong Zhou <yszhou4tech@gmail.com>
#
@ -20,7 +20,7 @@ import ssl
import subprocess
import sys
import time
import urllib2
import urllib.request
TMPDIR = os.environ.get('TMP_DIR') or '/tmp'
TMPDIR_DL = os.path.join(TMPDIR, 'dl')
@ -177,7 +177,7 @@ class GitHubCommitTsCache(object):
def set(self, k, v):
"""Update timestamp with ``k``."""
fileno = os.open(self.cachef, os.O_RDWR | os.O_CREAT)
with os.fdopen(fileno, 'wb+') as f:
with os.fdopen(fileno, 'w+') as f:
try:
fcntl.lockf(fileno, fcntl.LOCK_EX)
self._cache_init(f)
@ -194,7 +194,7 @@ class GitHubCommitTsCache(object):
self.cache[k] = (ts, updated)
def _cache_flush(self, fout):
cache = sorted(self.cache.iteritems(), cmp=lambda a, b: b[1][1] - a[1][1])
cache = sorted(self.cache.items(), key=lambda a: a[1][1])
cache = cache[:self.__cachen]
self.cache = {}
os.ftruncate(fout.fileno(), 0)
@ -345,6 +345,7 @@ class DownloadGitHubTarball(object):
version_is_sha1sum = len(self.version) == 40
if not version_is_sha1sum:
apis.insert(0, apis.pop())
reasons = ''
for api in apis:
url = api['url']
attr_path = api['attr_path']
@ -357,9 +358,9 @@ class DownloadGitHubTarball(object):
self.commit_ts = ct
self.commit_ts_cache.set(url, ct)
return
except Exception:
pass
raise self._error('Cannot fetch commit ts: {}'.format(url))
except Exception as e:
reasons += '\n' + (" {}: {}".format(url, e))
raise self._error('Cannot fetch commit ts:{}'.format(reasons))
def _init_commit_ts_remote_get(self, url, attrpath):
resp = self._make_request(url)
@ -397,9 +398,9 @@ class DownloadGitHubTarball(object):
'Accept': 'application/vnd.github.v3+json',
'User-Agent': 'OpenWrt',
}
req = urllib2.Request(url, headers=headers)
req = urllib.request.Request(url, headers=headers)
sslcontext = ssl._create_unverified_context()
fileobj = urllib2.urlopen(req, context=sslcontext)
fileobj = urllib.request.urlopen(req, context=sslcontext)
return fileobj
def _error(self, msg):

View File

@ -194,7 +194,6 @@ foreach my $mirror (@ARGV) {
push @mirrors, "https://downloads.sourceforge.net/$1";
}
} elsif ($mirror =~ /^\@APACHE\/(.+)$/) {
push @mirrors, "https://mirrors.ustc.edu.cn/apache/$1";
push @mirrors, "https://mirror.netcologne.de/apache.org/$1";
push @mirrors, "https://mirror.aarnet.edu.au/pub/apache/$1";
push @mirrors, "https://mirror.csclub.uwaterloo.ca/apache/$1";
@ -205,16 +204,11 @@ foreach my $mirror (@ARGV) {
push @mirrors, "ftp://apache.cs.utah.edu/apache.org/$1";
push @mirrors, "ftp://apache.mirrors.ovh.net/ftp.apache.org/dist/$1";
} elsif ($mirror =~ /^\@GITHUB\/(.+)$/) {
my $dir = $1;
my $i = 0;
# replace the 2nd '/' with '@' for jsDelivr mirror
push @mirrors, "https://cdn.jsdelivr.net/gh/". $dir =~ s{\/}{++$i == 2 ? '@' : $&}ger;
# give github a few more tries (different mirrors)
for (1 .. 5) {
push @mirrors, "https://raw.githubusercontent.com/$dir";
push @mirrors, "https://raw.githubusercontent.com/$1";
}
} elsif ($mirror =~ /^\@GNU\/(.+)$/) {
push @mirrors, "https://mirrors.ustc.edu.cn/gnu/$1";
push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnu/$1";
push @mirrors, "https://mirror.netcologne.de/gnu/$1";
push @mirrors, "http://ftp.kddilabs.jp/GNU/gnu/$1";
@ -240,7 +234,7 @@ foreach my $mirror (@ARGV) {
push @extra, "$extra[0]/longterm/v$1";
}
foreach my $dir (@extra) {
push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir";
push @mirrors, "http://mirrors.ustc.edu.cn/kernel.org/$dir";
push @mirrors, "https://cdn.kernel.org/pub/$dir";
push @mirrors, "https://mirror.rackspace.com/kernel.org/pub/$dir";
push @mirrors, "https://download.xs4all.nl/ftp.kernel.org/pub/$dir";
@ -251,7 +245,6 @@ foreach my $mirror (@ARGV) {
push @mirrors, "ftp://www.mirrorservice.org/sites/ftp.kernel.org/pub/$dir";
}
} elsif ($mirror =~ /^\@GNOME\/(.+)$/) {
push @mirrors, "https://mirrors.ustc.edu.cn/gnome/sources/$1";
push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnome/sources/$1";
push @mirrors, "http://ftp.acc.umu.se/pub/GNOME/sources/$1";
push @mirrors, "http://ftp.kaist.ac.kr/gnome/sources/$1";
@ -278,3 +271,4 @@ while (!-f "$target/$filename") {
}
$SIG{INT} = \&cleanup;

View File

@ -73,7 +73,7 @@ env_init() {
}
env_sync_data() {
[ \! -L "$BASEDIR/.config" -a -f "$BASEDIR/.config" ] && mv "$BASEDIR/.config" "$ENVDIR"
[ \! -L "$BASEDIR/.config" ] && [ -f "$BASEDIR/.config" ] && mv "$BASEDIR/.config" "$ENVDIR"
git add .
git add -u
}
@ -136,7 +136,7 @@ env_clear() {
env_init
[ -L "$BASEDIR/.config" ] && rm -f "$BASEDIR/.config"
[ -L "$BASEDIR/files" ] && rm -f "$BASEDIR/files"
[ -f "$ENVDIR/.config" ] || ( cd "$ENVDIR/files" && find | grep -vE '^\.$' > /dev/null )
[ -f "$ENVDIR/.config" ] || ( cd "$ENVDIR/files" && find . | grep -vE '^\.$' > /dev/null )
env_sync_data
if ask_bool 1 "Do you want to keep your current config and files"; then
mkdir -p "$BASEDIR/files"
@ -185,7 +185,7 @@ env_new() {
env_init 1
branch="$(git branch | grep '^\* ' | awk '{print $2}')"
if [ -n "$branch" -a "$branch" != "master" ]; then
if [ -n "$branch" ] && [ "$branch" != "master" ]; then
env_ask_sync
if ask_bool 0 "Do you want to clone the current environment?"; then
from="$branch"
@ -193,15 +193,15 @@ env_new() {
rm -f "$BASEDIR/.config" "$BASEDIR/files"
fi
git checkout -b "$1" "$from"
if [ -f "$BASEDIR/.config" -o -d "$BASEDIR/files" ]; then
if [ -f "$BASEDIR/.config" ] || [ -d "$BASEDIR/files" ]; then
if ask_bool 1 "Do you want to start your configuration repository with the current configuration?"; then
[ -d "$BASEDIR/files" -a \! -L "$BASEDIR/files" ] && {
if [ -d "$BASEDIR/files" ] && [ \! -L "$BASEDIR/files" ]; then
mkdir -p "$ENVDIR/files"
shopt -s dotglob
mv "$BASEDIR/files/"* "$ENVDIR/files/" 2>/dev/null
shopt -u dotglob
rmdir "$BASEDIR/files"
}
fi
env_sync
else
rm -rf "$BASEDIR/.config" "$BASEDIR/files"

View File

@ -41,34 +41,56 @@ my $feed_src = {};
my $feed_target = {};
my $feed_vpackage = {};
sub parse_config() {
my $line = 0;
my %name;
sub parse_file($$);
open FEEDS, "feeds.conf" or
open FEEDS, "feeds.conf.default" or
die "Unable to open feeds configuration";
while (<FEEDS>) {
sub parse_file($$) {
my ($fname, $existing) = @_;
my $line = 0;
my $fh;
open $fh, $fname or return undef;
while (<$fh>) {
chomp;
s/#.+$//;
next unless /\S/;
my @line = split /\s+/, $_, 3;
my @src;
$line++;
next unless /\S/;
my $valid = 1;
$line[0] =~ /^src-[\w-]+$/ or $valid = 0;
$line[1] =~ /^\w+$/ or $valid = 0;
@src = split /\s+/, ($line[2] or '');
@src = ('') if @src == 0;
$valid or die "Syntax error in feeds.conf, line: $line\n";
my ($type, $flags, $name, $urls) = m!^src-([\w\-]+)((?:\s+--\w+(?:=\S+)?)*)\s+(\w+)(?:\s+(\S.*))?$!;
unless ($type && $name) {
die "Syntax error in $fname, line $line\n";
}
$name{$line[1]} and die "Duplicate feed name '$line[1]', line: $line\n";
$name{$line[1]} = 1;
if ($existing->{$name}++) {
die "Duplicate feed name '$name' in '$fname' line: $line\n";
}
push @feeds, [$line[0], $line[1], \@src];
my @src = defined($urls) ? split /\s+/, $urls : ();
push @src, '' if @src == 0;
my %flags;
if (defined $flags) {
while ($flags =~ m!\s+--(\w+)(?:=(\S+))?!g) {
$flags{$1} = defined($2) ? $2 : 1;
}
}
if ($type eq "include") {
parse_file($urls, $existing) or
die "Unable to open included file '$urls'";
next;
}
push @feeds, ["src-$type", $name, \@src, \%flags];
}
close FEEDS;
close $fh;
return 1;
}
sub parse_config() {
my %name;
parse_file("feeds.conf", \%name) or
parse_file("feeds.conf.default", \%name) or
die "Unable to open feeds configuration";
}
sub update_location($$)
@ -506,6 +528,11 @@ sub install_src {
get_feed($feed->[1]);
my $src = $feed_src->{$name} or return 1;
# enable force flag if feed src line was declared with --force
if (exists($feed->[3]{force})) {
$force = 1;
}
# If it's a core package and we don't want to override, just return
my $override = 0;
if (is_core_src($name)) {

View File

@ -1,24 +1,32 @@
#!/usr/bin/python
#!/usr/bin/env python3
import argparse
from ftplib import FTP
from sys import argv
from os import stat
assert len(argv) == 3
ip = argv[1]
image = argv[2]
parser = argparse.ArgumentParser(description='Tool to boot AVM EVA ramdisk images.')
parser.add_argument('ip', type=str, help='IP-address to transfer the image to')
parser.add_argument('image', type=str, help='Location of the ramdisk image')
parser.add_argument('--offset', type=lambda x: int(x,0), help='Offset to load the image to in hex format with leading 0x. Only needed for non-lantiq devices.')
args = parser.parse_args()
size = stat(image).st_size
size = stat(args.image).st_size
# arbitrary size limit, to prevent the address calculations from overflows etc.
assert size < 0x2000000
# We need to align the address. A page boundary seems to be sufficient on 7362sl
# and 7412
addr = ((0x8000000 - size) & ~0xfff)
haddr = 0x80000000 + addr
img = open(image, "rb")
if args.offset:
addr = size
haddr = args.offset
else:
# We need to align the address.
# A page boundary seems to be sufficient on 7362sl and 7412
addr = ((0x8000000 - size) & ~0xfff)
haddr = 0x80000000 + addr
ftp = FTP(ip, 'adam2', 'adam2')
img = open(args.image, "rb")
ftp = FTP(args.ip, 'adam2', 'adam2')
def adam(cmd):
print("> %s"%(cmd))

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright 2008, 2009 (C) Jose Vasconcellos <jvasco@verizon.net>
#
@ -32,9 +32,9 @@ import telnetlib
import string
import binascii
import socket
import thread
import SocketServer
import SimpleHTTPServer
import _thread
import socketserver
import http.server
reboot = 0
HOST = "192.168.1.1"
@ -56,8 +56,8 @@ device="ixp0"
####################
def start_server(server):
httpd = SocketServer.TCPServer((server,PORT),SimpleHTTPServer.SimpleHTTPRequestHandler)
thread.start_new_thread(httpd.serve_forever,())
httpd = socketserver.TCPServer((server,PORT),http.server.SimpleHTTPRequestHandler)
_thread.start_new_thread(httpd.serve_forever,())
####################
@ -66,11 +66,11 @@ def get_flash_size():
tn.write("cat /proc/cpuinfo\n")
buf = tn.read_until("Returned 0", 3)
if not buf:
print "Unable to obtain CPU information; make sure to not use A0 stepping!"
print("Unable to obtain CPU information; make sure to not use A0 stepping!")
elif buf.find('rev 0') > 0:
print "Warning: IXP42x stepping A0 detected!"
print("Warning: IXP42x stepping A0 detected!")
if imagefile or url:
print "Error: No linux support for A0 stepping!"
print("Error: No linux support for A0 stepping!")
sys.exit(2)
# now get flash size
@ -86,9 +86,9 @@ def get_flash_size():
i = buf.rfind('Range ')
if i > 0:
return int(buf[i+17:].split()[0],16)
print "Can't determine flash size!"
print("Can't determine flash size!")
else:
print "Unable to obtain flash size!"
print("Unable to obtain flash size!")
sys.exit(2)
def image_dump(tn, dumpfile):
@ -110,13 +110,13 @@ def image_dump(tn, dumpfile):
if i > 0:
i += 4
else:
print "No MAC address found! (use -f option)"
print("No MAC address found! (use -f option)")
sys.exit(1)
dumpfile = "%s-%s.bin" % (platform, buf[i:i+17].replace(':',''))
else:
tn.write("\n")
print "Dumping flash contents (%dMB) to %s" % (flashsize/1048576, dumpfile)
print("Dumping flash contents (%dMB) to %s" % (flashsize/1048576, dumpfile))
f = open(dumpfile, "wb")
t=flashsize/dumplen
@ -137,7 +137,7 @@ def image_dump(tn, dumpfile):
if s and s[0][-1] == ':':
a=int(s[0][:-1],16)
if a != count:
print "Format error: %x != %x"%(a,count)
print("Format error: %x != %x"%(a,count))
sys.exit(2)
count += 16
f.write(binascii.a2b_hex(string.join(s[1:],'')))
@ -145,7 +145,7 @@ def image_dump(tn, dumpfile):
f.close()
if verbose:
print ""
print("")
def telnet_option(sock,cmd,option):
#print "Option: %d %d" % (ord(cmd), ord(option))
@ -156,11 +156,11 @@ def telnet_option(sock,cmd,option):
sock.sendall(telnetlib.IAC + c + option)
def telnet_timeout():
print "Fatal error: telnet timeout!"
print("Fatal error: telnet timeout!")
sys.exit(1)
def usage():
print __doc__ % os.path.basename(sys.argv[0])
print(__doc__ % os.path.basename(sys.argv[0]))
####################
@ -178,7 +178,7 @@ for o, a in opts:
usage()
sys.exit(1)
elif o in ("-V", "--version"):
print "%s: 0.11" % sys.argv[0]
print("%s: 0.11" % sys.argv[0])
sys.exit(1)
elif o in ("-d", "--no-dump"):
do_dump = 1
@ -213,8 +213,8 @@ else:
# create a telnet session to the router
try:
tn = telnetlib.Telnet(HOST)
except socket.error, msg:
print "Unable to establish telnet session to %s: %s" % (HOST, msg)
except socket.error as msg:
print("Unable to establish telnet session to %s: %s" % (HOST, msg))
sys.exit(1)
tn.set_option_negotiation_callback(telnet_option)
@ -250,7 +250,7 @@ if imagefile or url:
cmd = "load -u http://%s:%d/%s -r 0\n" % (server, PORT, splitpath[1])
if not os.access(imagefile, os.R_OK):
print "File access error: %s" % (imagefile)
print("File access error: %s" % (imagefile))
sys.exit(3)
# make sure we're in the directory where the image is located
@ -260,23 +260,23 @@ if imagefile or url:
start_server(server)
if verbose:
print "Unlocking flash..."
print("Unlocking flash...")
tn.write("unlock 0 0x%x\n" % flashsize)
buf = tn.read_until("Returned 0",5)
if verbose:
print "Writing new image..."
print cmd,
print("Writing new image...")
print(cmd, end=' ')
tn.write(cmd)
buf = tn.read_until("Returned 0",10)
# wait till the transfer completed
buf = tn.read_until("Download completed successfully",20)
if buf:
print "Flash update complete!"
print("Flash update complete!")
if reboot:
tn.write("reboot\n")
print "Rebooting..."
print("Rebooting...")
tn.write("exit\n")
tn.close()

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
#
# Copyright (C) 2012 OpenWrt.org
#
@ -24,8 +24,8 @@ find $TARGETS -type f -a -exec file {} \; | \
awk '$2 ~ /NEEDED/ && $NF !~ /interpreter/ && $NF ~ /^\[?lib.*\.so/ { gsub(/[\[\]]/, "", $NF); print $NF }' | \
sort -u
tmp=`mktemp $TMP_DIR/dep.XXXXXXXX`
for kmod in `find $TARGETS -type f -name \*.ko`; do
tmp=$(mktemp $TMP_DIR/dep.XXXXXXXX)
for kmod in $(find $TARGETS -type f -name \*.ko); do
$OBJCOPY -O binary -j .modinfo $kmod $tmp
sed -e 's,\x00,\n,g' $tmp | \
sed -ne '/^depends=.\+/ { s/^depends=//; s/,/.ko\n/g; s/$/.ko/p; q }'

View File

@ -17,10 +17,10 @@ rm -f "$OUTPUT"
head=16
sect=63
cyl=$(( ($KERNELSIZE + $ROOTFSSIZE) * 1024 * 1024 / ($head * $sect * 512)))
cyl=$(( (KERNELSIZE + ROOTFSSIZE) * 1024 * 1024 / (head * sect * 512)))
# create partition table
set `ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE}`
set $(ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m ${ALIGN:+-l $ALIGN} ${SIGNATURE:+-S 0x$SIGNATURE})
KERNELOFFSET="$(($1 / 512))"
KERNELSIZE="$2"
@ -30,6 +30,6 @@ ROOTFSSIZE="$(($4 / 512))"
[ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE"
dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc
make_ext4fs -J -l "$KERNELSIZE" "$OUTPUT.kernel" "$KERNELDIR"
make_ext4fs -J -L kernel -l "$KERNELSIZE" "$OUTPUT.kernel" "$KERNELDIR"
dd if="$OUTPUT.kernel" of="$OUTPUT" bs=512 seek="$KERNELOFFSET" conv=notrunc
rm -f "$OUTPUT.kernel"

View File

@ -17,7 +17,7 @@ for pkg in `find $pkg_dir -name '*.ipk' | sort`; do
[[ "$name" = "kernel" ]] && continue
[[ "$name" = "libc" ]] && continue
echo "Generating index for package $pkg" >&2
file_size=$(ls -l $pkg | awk '{print $5}')
file_size=$(stat -L -c%s $pkg)
sha256sum=$(mkhash sha256 $pkg)
# Take pains to make variable value sed-safe
sed_safe_pkg=`echo $pkg | sed -e 's/^\.\///g' -e 's/\\//\\\\\\//g'`

View File

@ -10,6 +10,11 @@ for pkg in "$@"; do
break
fi
done
case "$pkg" in
*/"${sourcename}_"*.ipk)
rm -vf "$pkg"
;;
esac
done
exit 0

View File

@ -131,6 +131,7 @@ sub parse_target_metadata($) {
/^Target-Optimization:\s*(.+)\s*$/ and $target->{cflags} = $1;
/^CPU-Type:\s*(.+)\s*$/ and $target->{cputype} = $1;
/^Linux-Version:\s*(.+)\s*$/ and $target->{version} = $1;
/^Linux-Testing-Version:\s*(.+)\s*$/ and $target->{testing_version} = $1;
/^Linux-Release:\s*(.+)\s*$/ and $target->{release} = $1;
/^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target->{karch} = $1;
/^Default-Subtarget:\s*(.+)\s*$/ and $target->{def_subtarget} = $1;
@ -139,6 +140,8 @@ sub parse_target_metadata($) {
$profile = {
id => $1,
name => $1,
has_image_metadata => 0,
supported_devices => [],
priority => 999,
packages => [],
default => "y if TARGET_ALL_PROFILES"
@ -147,6 +150,8 @@ sub parse_target_metadata($) {
push @{$target->{profiles}}, $profile;
};
/^Target-Profile-Name:\s*(.+)\s*$/ and $profile->{name} = $1;
/^Target-Profile-hasImageMetadata:\s*(\d+)\s*$/ and $profile->{has_image_metadata} = $1;
/^Target-Profile-SupportedDevices:\s*(.+)\s*$/ and $profile->{supported_devices} = [ split(/\s+/, $1) ];
/^Target-Profile-Priority:\s*(\d+)\s*$/ and do {
$profile->{priority} = $1;
$target->{sort} = 1;
@ -240,6 +245,7 @@ sub parse_package_metadata($) {
/^Build-Types:\s*(.+)\s*$/ and $src->{buildtypes} = [ split /\s+/, $1 ];
next unless $pkg;
/^Version: \s*(.+)\s*$/ and $pkg->{version} = $1;
/^ABIVersion: \s*(.+)\s*$/ and $pkg->{abiversion} = $1;
/^Title: \s*(.+)\s*$/ and $pkg->{title} = $1;
/^Menu: \s*(.+)\s*$/ and $pkg->{menu} = $1;
/^Submenu: \s*(.+)\s*$/ and $pkg->{submenu} = $1;

View File

@ -15,7 +15,7 @@
#
usage() {
echo "Usage: `basename $0` -A arch -C comp -a addr -e entry" \
echo "Usage: $(basename $0) -A arch -C comp -a addr -e entry" \
"-v version -k kernel [-D name -d dtb] -o its_file"
echo -e "\t-A ==> set architecture to 'arch'"
echo -e "\t-C ==> set compression type 'comp'"
@ -55,11 +55,11 @@ if [ -z "${ARCH}" ] || [ -z "${COMPRESS}" ] || [ -z "${LOAD_ADDR}" ] || \
usage
fi
ARCH_UPPER=`echo $ARCH | tr '[:lower:]' '[:upper:]'`
ARCH_UPPER=$(echo $ARCH | tr '[:lower:]' '[:upper:]')
# Conditionally create fdt information
if [ -n "${DTB}" ]; then
FDT="
FDT_NODE="
fdt@1 {
description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\";
data = /incbin/(\"${DTB}\");
@ -74,6 +74,7 @@ if [ -n "${DTB}" ]; then
};
};
"
FDT_PROP="fdt = \"fdt@1\";"
fi
# Create a default, fully populated DTS file
@ -100,9 +101,7 @@ DATA="/dts-v1/;
algo = \"sha1\";
};
};
${FDT}
${FDT_NODE}
};
configurations {
@ -110,7 +109,7 @@ ${FDT}
${CONFIG} {
description = \"OpenWrt\";
kernel = \"kernel@1\";
fdt = \"fdt@1\";
${FDT_PROP}
};
};
};"

View File

@ -191,9 +191,9 @@ sub mconf_depends {
$depend = shift @vdeps;
if (@vdeps > 1) {
$condition = ($condition ? "$condition && " : '') . '!('.join("||", map { "PACKAGE_".$_ } @vdeps).')';
$condition = ($condition ? "$condition && " : '') . join("&&", map { "PACKAGE_$_<PACKAGE_$pkgname" } @vdeps);
} elsif (@vdeps > 0) {
$condition = ($condition ? "$condition && " : '') . '!PACKAGE_'.$vdeps[0];
$condition = ($condition ? "$condition && " : '') . "PACKAGE_${vdeps[0]}<PACKAGE_$pkgname";
}
}
@ -358,14 +358,30 @@ sub gen_package_config() {
print_package_overrides();
}
sub and_condition($) {
my $condition = shift;
my @spl_and = split('\&\&', $condition);
if (@spl_and == 1) {
return "\$(CONFIG_$spl_and[0])";
}
return "\$(and " . join (',', map("\$(CONFIG_$_)", @spl_and)) . ")";
}
sub gen_condition ($) {
my $condition = shift;
# remove '!()', just as include/package-ipkg.mk does
$condition =~ s/[()!]//g;
return join("", map(and_condition($_), split('\|\|', $condition)));
}
sub get_conditional_dep($$) {
my $condition = shift;
my $depstr = shift;
if ($condition) {
if ($condition =~ /^!(.+)/) {
return "\$(if \$(CONFIG_$1),,$depstr)";
return "\$(if " . gen_condition($1) . ",,$depstr)";
} else {
return "\$(if \$(CONFIG_$condition),$depstr)";
return "\$(if " . gen_condition($condition) . ",$depstr)";
}
} else {
return $depstr;
@ -509,13 +525,40 @@ sub gen_package_source() {
}
}
sub gen_package_subdirs() {
sub gen_package_auxiliary() {
parse_package_metadata($ARGV[0]) or exit 1;
foreach my $name (sort {uc($a) cmp uc($b)} keys %package) {
my $pkg = $package{$name};
if ($pkg->{name} && $pkg->{repository}) {
print "Package/$name/subdir = $pkg->{repository}\n";
}
if ($pkg->{name} && defined($pkg->{abiversion}) && length($pkg->{abiversion})) {
my $abiv;
if ($pkg->{abiversion} =~ m!^(\d{4})-(\d{2})-(\d{2})-[0-9a-f]{7,40}$!) {
print STDERR "WARNING: Reducing ABI version '$pkg->{abiversion}' of package '$name' to '$1$2$3'\n";
$abiv = "$1$2$3";
}
else {
$abiv = $pkg->{abiversion};
}
foreach my $n (@{$pkg->{provides}}) {
print "Package/$n/abiversion = $abiv\n";
}
}
my %depends;
foreach my $dep (@{$pkg->{depends} || []}) {
if ($dep =~ m!^\+?(?:[^:]+:)?([^@]+)$!) {
$depends{$1}++;
}
}
my @depends = sort keys %depends;
if (@depends > 0) {
foreach my $n (@{$pkg->{provides}}) {
print "Package/$n/depends = @depends\n";
}
}
}
}
@ -565,7 +608,7 @@ sub parse_command() {
/^config$/ and return gen_package_config();
/^kconfig/ and return gen_kconfig_overrides();
/^source$/ and return gen_package_source();
/^subdirs$/ and return gen_package_subdirs();
/^pkgaux$/ and return gen_package_auxiliary();
/^license$/ and return gen_package_license(0);
/^licensefull$/ and return gen_package_license(1);
/^usergroup$/ and return gen_usergroup_list();
@ -577,7 +620,7 @@ Available Commands:
$0 config [file] Package metadata in Kconfig format
$0 kconfig [file] [config] [patchver] Kernel config overrides
$0 source [file] Package source file information
$0 subdirs [file] Package subdir information in makefile format
$0 pkgaux [file] Package auxiliary variables in makefile format
$0 license [file] Package license information
$0 licensefull [file] Package license information (full list)
$0 usergroup [file] Package usergroup allocation list

View File

@ -35,7 +35,7 @@ patch_specs() {
echo -n "Patching specs ... "
STAGING_DIR="$DIR" "$CPP" -dumpspecs | awk '
mode ~ "link" {
sub("%{L.}", "%{L*} -L %:getenv(STAGING_DIR /usr/lib) -rpath-link %:getenv(STAGING_DIR /usr/lib)")
sub(/(%@?\{L.\})/, "& -L %:getenv(STAGING_DIR /usr/lib) -rpath-link %:getenv(STAGING_DIR /usr/lib)")
}
mode ~ "cpp" {
$0 = $0 " -idirafter %:getenv(STAGING_DIR /usr/include)"

View File

@ -74,6 +74,7 @@ check_setup_() {
}
check_setup() {
[ -n "$o_network" ] || return 0
check_setup_ || {
__errmsg "please check the script content to see the environment requirement"
return 1
@ -88,6 +89,8 @@ Usage: $SELF [-h|--help]
[<subtarget> [<extra-qemu-options>]]
[--kernel <kernel>]
[--rootfs <rootfs>]
[--machine <machine>]
[-n|--network]
<subtarget> will default to "generic" and must be specified if
<extra-qemu-options> are present
@ -100,13 +103,14 @@ the actual <target> in use. They will default to files under bin/targets/
Examples
$SELF x86 64
$SELF x86 64 -enable-kvm -device virtio-balloon-pci
$SELF x86 64 --machine q35,accel=kvm -device virtio-balloon-pci
$SELF x86 64 -incoming tcp:0:4444
$SELF x86 64-glibc
$SELF malta be -m 64
$SELF malta le64
$SELF malta be-glibc
$SELF armvirt 32 \\
--machine virt,highmem=off \\
--kernel bin/targets/armvirt/32/openwrt-armvirt-32-zImage \\
--rootfs bin/targets/armvirt/32/openwrt-armvirt-32-root.ext4
EOF
@ -117,11 +121,19 @@ rand_mac() {
}
parse_args() {
o_network=
o_qemu_extra=()
while [ "$#" -gt 0 ]; do
# Cmdline options for the script itself SHOULD try to be
# prefixed with two dashes to distinguish them from those for
# qemu executables.
#
# Also note that qemu accepts both --opt and -opt
case "$1" in
--kernel) o_kernel="$2"; shift 2 ;;
--rootfs) o_rootfs="$2"; shift 2 ;;
--machine|-machine|-M) o_mach="$2"; shift 2 ;;
--network|-n) o_network=1; shift ;;
--help|-h)
usage
exit 0
@ -152,6 +164,7 @@ parse_args() {
start_qemu_armvirt() {
local kernel="$o_kernel"
local rootfs="$o_rootfs"
local mach="${o_mach:-virt}"
local cpu
local qemu_exe
@ -181,9 +194,16 @@ start_qemu_armvirt() {
)
}
"$qemu_exe" -machine virt -cpu "$cpu" -nographic \
-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device virtio-net-pci,id=devlan,netdev=lan,mac="$MAC_LAN" \
-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device virtio-net-pci,id=devwan,netdev=wan,mac="$MAC_WAN" \
[ -z "$o_network" ] || {
o_qemu_extra+=( \
"-netdev" "bridge,id=lan,br=$BR_LAN,helper=$HELPER" \
"-device" "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN" \
"-netdev" "bridge,id=wan,br=$BR_WAN,helper=$HELPER" "-device" \
"virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN" \
)
}
"$qemu_exe" -machine "$mach" -cpu "$cpu" -nographic \
-kernel "$kernel" \
"${o_qemu_extra[@]}"
}
@ -192,7 +212,9 @@ start_qemu_malta() {
local is64
local isel
local qemu_exe
local rootfs="$o_rootfs"
local kernel="$o_kernel"
local mach="${o_mach:-malta}"
# o_subtarget can be le, be, le64, be64, le-glibc, le64-glibc, etc..
is64="$(echo $o_subtarget | grep -o 64)"
@ -201,19 +223,36 @@ start_qemu_malta() {
[ -n "$kernel" ] || kernel="$o_bindir/openwrt-malta-${o_subtarget%-*}-vmlinux-initramfs.elf"
[ -z "$rootfs" ] || {
if [ ! -f "$rootfs" -a -s "$rootfs.gz" ]; then
gunzip "$rootfs.gz"
fi
o_qemu_extra+=( \
"-drive" "file=$rootfs,format=raw" \
"-append" "root=/dev/sda rootwait" \
)
}
# NOTE: order of wan, lan -device arguments matters as it will affect which
# one will be actually used as the wan, lan network interface inside the
# guest machine
"$qemu_exe" -machine malta -nographic \
-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device pcnet,netdev=wan,mac="$MAC_WAN" \
-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device pcnet,netdev=lan,mac="$MAC_LAN" \
[ -z "$o_network" ] || {
o_qemu_extra+=(
-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device pcnet,netdev=wan,mac="$MAC_WAN"
-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device pcnet,netdev=lan,mac="$MAC_LAN"
)
}
"$qemu_exe" -machine "$mach" -nographic \
-kernel "$kernel" \
"${o_qemu_extra[@]}"
}
start_qemu_x86() {
local rootfs="$o_rootfs"
local qemu_exe
local kernel="$o_kernel"
local rootfs="$o_rootfs"
local mach="${o_mach:-pc}"
[ -n "$rootfs" ] || {
rootfs="$o_bindir/openwrt-$o_target-${o_subtarget%-*}-combined-ext4.img"
@ -227,7 +266,7 @@ start_qemu_x86() {
# 64: 64-bit, kvm guest, virtio
#
case "${o_subtarget%-*}" in
legacy) qemu_exe="qemu-system-i386" ;;
legacy) qemu_exe="qemu-system-i386" ;;
generic|64) qemu_exe="qemu-system-x86_64" ;;
*)
__errmsg "target $o_target: unknown subtarget $o_subtarget"
@ -235,6 +274,30 @@ start_qemu_x86() {
;;
esac
[ -n "$kernel" ] && {
o_qemu_extra+=( \
"-kernel" "$kernel" \
"-append" "root=/dev/vda console=ttyS0 rootwait" \
)
}
[ -z "$o_network" ] || {
case "${o_subtarget%-*}" in
legacy)
o_qemu_extra+=(
-netdev "bridge,id=lan,br=$BR_LAN,helper=$HELPER" -device "e1000,id=devlan,netdev=lan,mac=$MAC_LAN"
-netdev "bridge,id=wan,br=$BR_WAN,helper=$HELPER" -device "e1000,id=devwan,netdev=wan,mac=$MAC_WAN"
)
;;
generic|64)
o_qemu_extra+=(
-netdev "bridge,id=lan,br=$BR_LAN,helper=$HELPER" -device "virtio-net-pci,id=devlan,netdev=lan,mac=$MAC_LAN"
-netdev "bridge,id=wan,br=$BR_WAN,helper=$HELPER" -device "virtio-net-pci,id=devwan,netdev=wan,mac=$MAC_WAN"
)
;;
esac
}
case "${o_subtarget%-*}" in
legacy)
# use IDE (PATA) disk instead of AHCI (SATA). Refer to link
@ -247,17 +310,13 @@ start_qemu_x86() {
# -drive "file=$rootfs,format=raw,id=drv0,if=none" \
#
# [1] https://dev.openwrt.org/ticket/17947
"$qemu_exe" -nographic \
-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device e1000,id=devlan,netdev=lan,mac="$MAC_LAN" \
-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device e1000,id=devwan,netdev=wan,mac="$MAC_WAN" \
"$qemu_exe" -machine "$mach" -nographic \
-device ide-drive,drive=drv0 \
-drive "file=$rootfs,format=raw,id=drv0,if=none" \
"${o_qemu_extra[@]}"
;;
generic|64)
"$qemu_exe" -nographic \
-netdev bridge,id=lan,br="$BR_LAN,helper=$HELPER" -device virtio-net-pci,id=devlan,netdev=lan,mac="$MAC_LAN" \
-netdev bridge,id=wan,br="$BR_WAN,helper=$HELPER" -device virtio-net-pci,id=devwan,netdev=wan,mac="$MAC_WAN" \
"$qemu_exe" -machine "$mach" -nographic \
-drive "file=$rootfs,format=raw,if=virtio" \
"${o_qemu_extra[@]}"
;;
@ -276,6 +335,6 @@ start_qemu() {
esac
}
check_setup \
&& parse_args "$@" \
parse_args "$@" \
&& check_setup \
&& start_qemu

View File

@ -14,9 +14,9 @@ if( opendir SD, "$Bin/../staging_dir" )
{
my ( $tid, $arch, $libc, @arches );
if( $ARGV[1] =~ m!\btarget-(.+?)_(([^/_]+libc|musl)[^/_]*)\b!i )
if( $ARGV[1] =~ m!\btarget-(.+?)_([^/_]+libc|musl)_?([^/]*).*\b!i )
{
print("Using target $1 ($2)\n");
print("Using target $1 ($2, $3)\n");
($arch, $libc) = ($1, $2);
}
else
@ -26,10 +26,10 @@ if( opendir SD, "$Bin/../staging_dir" )
while( defined( my $e = readdir SD ) )
{
if( -d "$Bin/../staging_dir/$e" && $e =~ /^target-(.+?)_(([^_]+libc|musl).*)/i )
if( -d "$Bin/../staging_dir/$e" && $e =~ /^target-(.+?)_([^\/_]+libc|musl)_?([^\/]*).*/i )
{
push @arches, [ $1, $2 ];
printf(" %2d) %s (%s)\n", @arches + 0, $1, $2);
printf(" %2d) %s (%s %s)\n", @arches + 0, $1, $2, $3);
}
}

27
scripts/sign_images.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
# directory where search for images
TOP_DIR="${TOP_DIR:-./bin/targets}"
# key to sign images
BUILD_KEY="${BUILD_KEY:-key-build}" # TODO unifiy naming?
# remove other signatures (added e.g. by buildbot)
REMOVE_OTER_SIGNATURES="${REMOVE_OTER_SIGNATURES:-1}"
# find all sysupgrade images in TOP_DIR
# factory images don't need signatures as non OpenWrt system doen't check them anyway
for image in $(find $TOP_DIR -type f -name "*-sysupgrade.bin"); do
# check if image actually support metadata
if fwtool -i /dev/null "$image"; then
# remove all previous signatures
if [ -n "$REMOVE_OTER_SIGNATURES" ]; then
while [ "$?" = 0 ]; do
fwtool -t -s /dev/null "$image"
done
fi
# run same operation as build root does for signing
cp "$BUILD_KEY.ucert" "$image.ucert"
usign -S -m "$image" -s "$BUILD_KEY" -x "$image.sig"
ucert -A -c "$image.ucert" -x "$image.sig"
fwtool -S "$image.ucert" "$image"
fi
done

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
[ -n "$CROSS" ] || {
echo "The variable CROSS must be set to point to the cross-compiler prefix"
exit 1
@ -19,7 +19,7 @@ else
fi
if [ -z "$KEEP_BUILD_ID" ]; then
ARGS="$ARGS -R .note.gnu.build-id"
ARGS="$ARGS -R .note.gnu.build-id"
fi
${CROSS}objcopy \
@ -50,6 +50,6 @@ $3 && $2 ~ /[brtd]/ && $3 !~ /\$LC/ && !def[$3] {
}
' > "$MODULE.tmp1"
${CROSS}objcopy `cat ${MODULE}.tmp1` ${MODULE}.tmp ${MODULE}.out
${CROSS}objcopy $(cat ${MODULE}.tmp1) ${MODULE}.tmp ${MODULE}.out
mv "${MODULE}.out" "${MODULE}"
rm -f "${MODULE}".t*

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# Create a new openwrt tree with symlinks pointing at the current tree
# Usage: ./scripts/symlink-tree.sh <destination>

View File

@ -1,5 +1,7 @@
#!/bin/sh
. $TOPDIR/scripts/functions.sh
board=""
kernel=""
rootfs=""
@ -53,7 +55,16 @@ fi
mkdir -p "${tmpdir}/sysupgrade-${board}"
echo "BOARD=${board}" > "${tmpdir}/sysupgrade-${board}/CONTROL"
[ -z "${rootfs}" ] || cp "${rootfs}" "${tmpdir}/sysupgrade-${board}/root"
if [ -n "${rootfs}" ]; then
case "$( get_fs_type ${rootfs} )" in
"squashfs")
dd if="${rootfs}" of="${tmpdir}/sysupgrade-${board}/root" bs=1024 conv=sync
;;
*)
cp "${rootfs}" "${tmpdir}/sysupgrade-${board}/root"
;;
esac
fi
[ -z "${kernel}" ] || cp "${kernel}" "${tmpdir}/sysupgrade-${board}/kernel"
mtime=""

View File

@ -42,6 +42,7 @@ sub target_config_features(@) {
/^virtio$/ and $ret .= "\tselect VIRTIO_SUPPORT\n";
/^rootfs-part$/ and $ret .= "\tselect USES_ROOTFS_PART\n";
/^boot-part$/ and $ret .= "\tselect USES_BOOT_PART\n";
/^testing-kernel$/ and $ret .= "\tselect HAS_TESTING_KERNEL\n";
}
return $ret;
}
@ -83,11 +84,14 @@ sub print_target($) {
}
my $v = kver($target->{version});
my $tv = kver($target->{testing_version});
$tv or $tv = $v;
if (@{$target->{subtargets}} == 0) {
$confstr = <<EOF;
config TARGET_$target->{conf}
bool "$target->{name}"
select LINUX_$v
select LINUX_$v if !TESTING_KERNEL
select LINUX_$tv if TESTING_KERNEL
EOF
}
else {
@ -387,15 +391,18 @@ EOF
my %kver;
foreach my $target (@target) {
my $v = kver($target->{version});
next if $kver{$v};
$kver{$v} = 1;
print <<EOF;
foreach my $tv ($target->{version}, $target->{testing_version}) {
next unless $tv;
my $v = kver($tv);
next if $kver{$v};
$kver{$v} = 1;
print <<EOF;
config LINUX_$v
bool
EOF
}
}
foreach my $def (sort keys %defaults) {
print <<EOF;
@ -422,6 +429,10 @@ sub gen_profile_mk() {
print "PROFILE_NAMES = ".join(" ", map { $_->{id} } @{$cur->{profiles}})."\n";
foreach my $profile (@{$cur->{profiles}}) {
print $profile->{id}.'_NAME:='.$profile->{name}."\n";
print $profile->{id}.'_HAS_IMAGE_METADATA:='.$profile->{has_image_metadata}."\n";
if (defined($profile->{supported_devices}) and @{$profile->{supported_devices}} > 0) {
print $profile->{id}.'_SUPPORTED_DEVICES:='.join(' ', @{$profile->{supported_devices}})."\n";
}
print $profile->{id}.'_PACKAGES:='.join(' ', @{$profile->{packages}})."\n";
}
}

View File

@ -54,7 +54,7 @@ else {
my ($sec2, $usec2) = gettime();
my (undef, undef, $cuser, $csystem) = times();
printf STDERR "%s#%.2f#%.2f#%.2f\n",
printf STDOUT "%s#%.2f#%.2f#%.2f\n",
$prefix, $cuser, $csystem,
($sec2 - $sec) + ($usec2 - $usec) / 1000000;