优化 OpenWrt-19.07 21.02 支持(by teasiu)

This commit is contained in:
Hyy2001X 2021-04-06 21:56:16 +08:00
parent 8e07715da7
commit bd41d43ab0
5 changed files with 305 additions and 20 deletions

View File

@ -0,0 +1,136 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: slitaz-cn <teasiu@163.com>
Date: Tue, 6 Apr 2021 01:25:07 +0800
Subject: [PATCH] add upx ucl for 19.07.7
Signed-off-by: slitaz-cn <teasiu@163.com>
---
tools/Makefile | 3 ++-
tools/ucl/Makefile | 51 ++++++++++++++++++++++++++++++++++++++++++++++
tools/upx/Makefile | 35 +++++++++++++++++++++++++++++++
3 files changed, 88 insertions(+), 1 deletion(-)
create mode 100644 tools/ucl/Makefile
create mode 100644 tools/upx/Makefile
diff --git a/tools/Makefile b/tools/Makefile
index b8d986b80c..bcde9a720d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -33,7 +33,7 @@ tools-$(CONFIG_TARGET_mxs) += elftosb sdimage
tools-$(CONFIG_TARGET_ar71xx) += lzma-old
tools-$(CONFIG_TARGET_ar71xx)$(CONFIG_TARGET_ath79) += squashfs
tools-$(CONFIG_USES_MINOR) += kernel2minor
-tools-y += lzma squashfskit4 zip
+tools-y += lzma squashfskit4 zip ucl upx
tools-$(BUILD_B43_TOOLS) += b43-tools
tools-$(BUILD_ISL) += isl
tools-$(CONFIG_USE_SPARSE) += sparse
@@ -46,6 +46,7 @@ $(curdir)/flex/compile := $(curdir)/libtool/compile
$(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
$(curdir)/squashfs/compile := $(curdir)/lzma-old/compile
$(curdir)/squashfskit4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile
+$(curdir)/upx/compile := $(curdir)/ucl/compile
$(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compile
$(curdir)/autoconf/compile := $(curdir)/m4/compile
$(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/pkg-config/compile $(curdir)/xz/compile
diff --git a/tools/ucl/Makefile b/tools/ucl/Makefile
new file mode 100644
index 0000000000..9fb9aec117
--- /dev/null
+++ b/tools/ucl/Makefile
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2019 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ucl
+PKG_VERSION:=1.03
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.oberhumer.com/opensource/ucl/download/$(PKG_SOURCE)
+PKG_HASH:=b865299ffd45d73412293369c9754b07637680e5c826915f097577cd27350348
+
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/host-build.mk
+
+HOSTCC :=gcc
+HOST_CFLAGS +=-std=gnu89
+
+define Host/Prepare
+ $(Host/Prepare/Default)
+ mkdir -p $(STAGING_DIR_HOST)/include/ucl
+endef
+
+define Host/Configure
+ (cd $(HOST_BUILD_DIR); \
+ CC="$(HOSTCC)" \
+ CFLAGS="$(HOST_CFLAGS)" \
+ ./configure --prefix=$(STAGING_DIR_HOST) \
+ );
+ $(call Host/Configure/Default)
+endef
+
+define Host/Compile
+ $(MAKE) -C $(HOST_BUILD_DIR)
+endef
+
+define Host/Install
+ $(MAKE) -C $(HOST_BUILD_DIR) install
+endef
+
+define Host/Clean
+ $(MAKE) -C $(HOST_BUILD_DIR) uninstall
+ rm -rf $(HOST_BUILD_DIR)
+ rm -rf $(STAGING_DIR_HOST)/include/ucl
+endef
+
+$(eval $(call HostBuild))
diff --git a/tools/upx/Makefile b/tools/upx/Makefile
new file mode 100644
index 0000000000..fbf1dfbd2e
--- /dev/null
+++ b/tools/upx/Makefile
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2011-2020 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=upx
+PKG_VERSION:=3.95
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-src.tar.xz
+PKG_SOURCE_URL:=https://github.com/upx/upx/releases/download/v$(PKG_VERSION)
+PKG_HASH:=3b0f55468d285c760fcf5ea865a070b27696393002712054c69ff40d8f7f5592
+
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)-src
+
+include $(INCLUDE_DIR)/host-build.mk
+
+define Host/Compile
+ UPX_UCLDIR=$(STAGING_DIR_HOST) \
+ $(MAKE) -C $(HOST_BUILD_DIR)/src \
+ CXXFLAGS_WERROR="" LDFLAGS="$(HOST_LDFLAGS)" \
+ CXX="$(HOSTCXX)"
+endef
+
+define Host/Install
+ $(CP) $(HOST_BUILD_DIR)/src/upx.out $(STAGING_DIR_HOST)/bin/upx
+endef
+
+define Host/Clean
+ rm -f $(STAGING_DIR_HOST)/bin/upx
+endef
+
+$(eval $(call HostBuild))
--
2.20.1

View File

@ -0,0 +1,136 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chuck <fanck0605@qq.com>
Date: Mon, 13 Jul 2020 13:09:02 +0800
Subject: [PATCH] tools: add ucl and upx compresss
Signed-off-by: Chuck <fanck0605@qq.com>
---
tools/Makefile | 3 ++-
tools/ucl/Makefile | 51 ++++++++++++++++++++++++++++++++++++++++++++++
tools/upx/Makefile | 35 +++++++++++++++++++++++++++++++
3 files changed, 88 insertions(+), 1 deletion(-)
create mode 100644 tools/ucl/Makefile
create mode 100644 tools/upx/Makefile
diff --git a/tools/Makefile b/tools/Makefile
index a2665dbc9a..6dd93f3cfe 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -25,7 +25,7 @@ tools-y += autoconf autoconf-archive automake bc bison cmake dosfstools
tools-y += e2fsprogs fakeroot findutils firmware-utils flex gengetopt
tools-y += libressl libtool lzma m4 make-ext4fs missing-macros mkimage
tools-y += mklibs mm-macros mtd-utils mtools padjffs2 patch-image
-tools-y += patchelf pkgconf quilt squashfskit4 sstrip zip zlib zstd
+tools-y += patchelf pkgconf quilt squashfskit4 sstrip ucl upx zip zlib zstd
tools-$(BUILD_B43_TOOLS) += b43-tools
tools-$(BUILD_ISL) += isl
tools-$(BUILD_TOOLCHAIN) += expat gmp libelf mpc mpfr
@@ -71,6 +71,7 @@ $(curdir)/quilt/compile := $(curdir)/autoconf/compile $(curdir)/findutils/compil
$(curdir)/sdcc/compile := $(curdir)/bison/compile
$(curdir)/squashfs/compile := $(curdir)/lzma-old/compile
$(curdir)/squashfskit4/compile := $(curdir)/xz/compile $(curdir)/zlib/compile
+$(curdir)/upx/compile := $(curdir)/ucl/compile
$(curdir)/zlib/compile := $(curdir)/cmake/compile
$(curdir)/zstd/compile := $(curdir)/cmake/compile
diff --git a/tools/ucl/Makefile b/tools/ucl/Makefile
new file mode 100644
index 0000000000..9fb9aec117
--- /dev/null
+++ b/tools/ucl/Makefile
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2019 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ucl
+PKG_VERSION:=1.03
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.oberhumer.com/opensource/ucl/download/$(PKG_SOURCE)
+PKG_HASH:=b865299ffd45d73412293369c9754b07637680e5c826915f097577cd27350348
+
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/host-build.mk
+
+HOSTCC :=gcc
+HOST_CFLAGS +=-std=gnu89
+
+define Host/Prepare
+ $(Host/Prepare/Default)
+ mkdir -p $(STAGING_DIR_HOST)/include/ucl
+endef
+
+define Host/Configure
+ (cd $(HOST_BUILD_DIR); \
+ CC="$(HOSTCC)" \
+ CFLAGS="$(HOST_CFLAGS)" \
+ ./configure --prefix=$(STAGING_DIR_HOST) \
+ );
+ $(call Host/Configure/Default)
+endef
+
+define Host/Compile
+ $(MAKE) -C $(HOST_BUILD_DIR)
+endef
+
+define Host/Install
+ $(MAKE) -C $(HOST_BUILD_DIR) install
+endef
+
+define Host/Clean
+ $(MAKE) -C $(HOST_BUILD_DIR) uninstall
+ rm -rf $(HOST_BUILD_DIR)
+ rm -rf $(STAGING_DIR_HOST)/include/ucl
+endef
+
+$(eval $(call HostBuild))
diff --git a/tools/upx/Makefile b/tools/upx/Makefile
new file mode 100644
index 0000000000..fbf1dfbd2e
--- /dev/null
+++ b/tools/upx/Makefile
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2011-2020 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=upx
+PKG_VERSION:=3.95
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-src.tar.xz
+PKG_SOURCE_URL:=https://github.com/upx/upx/releases/download/v$(PKG_VERSION)
+PKG_HASH:=3b0f55468d285c760fcf5ea865a070b27696393002712054c69ff40d8f7f5592
+
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)-src
+
+include $(INCLUDE_DIR)/host-build.mk
+
+define Host/Compile
+ UPX_UCLDIR=$(STAGING_DIR_HOST) \
+ $(MAKE) -C $(HOST_BUILD_DIR)/src \
+ CXXFLAGS_WERROR="" LDFLAGS="$(HOST_LDFLAGS)" \
+ CXX="$(HOSTCXX)"
+endef
+
+define Host/Install
+ $(CP) $(HOST_BUILD_DIR)/src/upx.out $(STAGING_DIR_HOST)/bin/upx
+endef
+
+define Host/Clean
+ rm -f $(STAGING_DIR_HOST)/bin/upx
+endef
+
+$(eval $(call HostBuild))
--
2.25.1

View File

@ -10,7 +10,7 @@ Diy_Core() {
INCLUDE_AutoUpdate=true
INCLUDE_AutoBuild_Tools=true
INCLUDE_DRM_I915=true
INCLUDE_Translation_Converter=
INCLUDE_Obsolete_PKG_Compatible=true
}
Firmware-Diy() {
@ -21,7 +21,7 @@ Firmware-Diy() {
d-team_newifi-d2)
Replace_File CustomFiles/mac80211.sh package/kernel/mac80211/files/lib/wifi
Replace_File CustomFiles/system_newifi-d2 package/base-files/files/etc/config system
Replace_File CustomFiles/102-mt7621-fix-cpu-clk-add-clkdev.patch target/linux/ramips/patches-5.4
Replace_File CustomFiles/Patches/102-mt7621-fix-cpu-clk-add-clkdev.patch target/linux/ramips/patches-5.4
;;
*)
Replace_File CustomFiles/system_common package/base-files/files/etc/config system

View File

@ -16,14 +16,13 @@ GET_TARGET_INFO() {
Version_File="package/lean/default-settings/files/zzz-default-settings"
Old_Version="$(egrep -o "R[0-9]+\.[0-9]+\.[0-9]+" ${Version_File})"
Openwrt_Version="${Old_Version}-${Compile_Date}"
;;
immortalwrt)
Version_File="package/base-files/files/etc/openwrt_release"
Openwrt_Version="${Compile_Date}"
;;
*)
Openwrt_Version=Unknown
Openwrt_Version="${Compile_Date}"
;;
esac
x86_Test="$(egrep -o "CONFIG_TARGET.*DEVICE.*=y" .config | sed -r 's/CONFIG_TARGET_(.*)_DEVICE_(.*)=y/\1/')"
@ -107,12 +106,25 @@ Firmware-Diy_Base() {
;;
esac
if [[ "${INCLUDE_Translation_Converter}" == "true" ]];then
echo "Start to convert zh-cn translation files to zh_Hans ..."
if [[ "${INCLUDE_Obsolete_PKG_Compatible}" == "true" ]];then
echo "[$(date "+%H:%M:%S")] Start to run Obsolete_Package_Compatible Scripts ..."
Current_Branch="$(git branch | sed 's/* //g')"
case ${Current_Branch} in
openwrt-19.07 | openwrt-21.02)
Replace_File CustomFiles/Patches/0003-upx-ucl-${Current_Branch}.patch ./
cat 0003-upx-ucl-${Current_Branch}.patch | patch -p1 > /dev/null 2>&1
ExtraPackages svn ../feeds/packages/lang golang https://github.com/coolsnowwolf/packages/trunk/lang
echo "[$(date "+%H:%M:%S")] Start to convert zh-cn translation files to zh_Hans ..."
Replace_File Scripts/Convert_Translation.sh package
cd ./package
bash ./Convert_Translation.sh
cd ..
;;
*)
echo "[ERROR] Current branch: [${Current_Branch}] is not supported !"
;;
esac
fi
echo "${Openwrt_Version}" > ${AB_Firmware_Info}
@ -156,7 +168,7 @@ PS_Firmware() {
touch ${Home}/bin/Firmware/${AutoBuild_Firmware}.detail
echo -e "\nMD5:${_MD5}\nSHA256:${_SHA256}" > ${Home}/bin/Firmware/${AutoBuild_Firmware}-Legacy.detail
mv -f ${Legacy_Firmware} ${Home}/bin/Firmware/${AutoBuild_Firmware}-Legacy.${Firmware_Type}
echo "Legacy Firmware is detected !"
echo "[$(date "+%H:%M:%S")] Legacy Firmware is detected !"
fi
if [ -f "${EFI_Firmware}" ];then
_MD5=$(md5sum ${EFI_Firmware} | cut -d ' ' -f1)
@ -164,7 +176,7 @@ PS_Firmware() {
touch ${Home}/bin/Firmware/${AutoBuild_Firmware}-UEFI.detail
echo -e "\nMD5:${_MD5}\nSHA256:${_SHA256}" > ${Home}/bin/Firmware/${AutoBuild_Firmware}-UEFI.detail
cp ${EFI_Firmware} ${Home}/bin/Firmware/${AutoBuild_Firmware}-UEFI.${Firmware_Type}
echo "UEFI Firmware is detected !"
echo "[$(date "+%H:%M:%S")] UEFI Firmware is detected !"
fi
;;
*)
@ -180,7 +192,7 @@ PS_Firmware() {
;;
esac
cd ${Home}
echo "Actions Avaliable: $(df -h | grep "/dev/root" | awk '{printf $4}')"
echo "[$(date "+%H:%M:%S")] Actions Avaliable: $(df -h | grep "/dev/root" | awk '{printf $4}')"
}
Mkdir() {
@ -206,12 +218,13 @@ PKG_Finder() {
Auto_ExtraPackages() {
[[ ! -f "${GITHUB_WORKSPACE}/CustomPackages/${TARGET_PROFILE}" ]] && return
echo "CustomFile: ${TARGET_PROFILE} is detected !"
echo "[$(date "+%H:%M:%S")] Loading Custom Packages list: [${TARGET_PROFILE}] ..."
echo "" >> ${GITHUB_WORKSPACE}/CustomPackages/${TARGET_PROFILE}
cat ${GITHUB_WORKSPACE}/CustomPackages/${TARGET_PROFILE} | while read X
do
ExtraPackages ${X}
done
echo "Done !"
echo "[$(date "+%H:%M:%S")] [CustomPackages] All done !"
}
ExtraPackages() {
@ -280,29 +293,29 @@ Update_Makefile() {
PKG_DL_URL="${PKG_SOURCE_URL%\$(\PKG_VERSION*}"
Offical_Version="$(curl -s ${api_URL} 2>/dev/null | grep 'tag_name' | egrep -o '[0-9].+[0-9.]+' | awk 'NR==1')"
if [[ -z "${Offical_Version}" ]];then
echo "Failed to obtain the Offical version of [${PKG_NAME}],skip update ..."
echo "[ERROR] Failed to obtain the Offical version of [${PKG_NAME}],skip update ..."
return
fi
Source_Version="$(grep "PKG_VERSION:=" ${Makefile} | cut -c14-20)"
Source_HASH="$(grep "PKG_HASH:=" ${Makefile} | cut -c11-100)"
if [[ -z "${Source_Version}" ]] || [[ -z "${Source_HASH}" ]];then
echo "Failed to obtain the Source version or HASH,skip update ..."
echo "[ERROR] Failed to obtain the Source version or HASH,skip update ..."
return
fi
echo -e "Current ${PKG_NAME} version: ${Source_Version}\nOffical ${PKG_NAME} version: ${Offical_Version}"
if [[ ! "${Source_Version}" == "${Offical_Version}" ]];then
echo -e "Updating package ${PKG_NAME} [${Source_Version}] to [${Offical_Version}] ..."
echo -e "[$(date "+%H:%M:%S")] Updating package ${PKG_NAME} [${Source_Version}] to [${Offical_Version}] ..."
sed -i "s?PKG_VERSION:=${Source_Version}?PKG_VERSION:=${Offical_Version}?g" ${Makefile}
wget -q "${PKG_DL_URL}${Offical_Version}?" -O /tmp/tmp_file
if [[ "$?" -eq 0 ]];then
Offical_HASH="$(sha256sum /tmp/tmp_file | cut -d ' ' -f1)"
sed -i "s?PKG_HASH:=${Source_HASH}?PKG_HASH:=${Offical_HASH}?g" ${Makefile}
else
echo "Failed to update the package [${PKG_NAME}],skip update ..."
echo "[ERROR] Failed to update the package [${PKG_NAME}],skip update ..."
fi
fi
else
echo "Package ${PKG_NAME} is not detected,skip update ..."
echo "[$(date "+%H:%M:%S")] Package ${PKG_NAME} is not detected,skip update ..."
fi
unset _process1 _process2 Offical_Version Source_Version
}