Merge Mainline
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
commit
a4375d79b1
@ -75,6 +75,7 @@ JFFS2OPTS += $(MKFS_DEVTABLE_OPT)
|
||||
SQUASHFS_BLOCKSIZE := $(CONFIG_TARGET_SQUASHFS_BLOCK_SIZE)k
|
||||
SQUASHFSOPT := -b $(SQUASHFS_BLOCKSIZE)
|
||||
SQUASHFSOPT += -p '/dev d 755 0 0' -p '/dev/console c 600 0 0 5 1'
|
||||
SQUASHFSOPT += $(if $(CONFIG_SELINUX),-xattr,-no-xattrs)
|
||||
SQUASHFSCOMP := gzip
|
||||
LZMA_XZ_OPTIONS := -Xpreset 9 -Xe -Xlc 0 -Xlp 2 -Xpb 2
|
||||
ifeq ($(CONFIG_SQUASHFS_XZ),y)
|
||||
|
||||
@ -373,4 +373,14 @@ board_name() {
|
||||
[ -e /tmp/sysinfo/board_name ] && cat /tmp/sysinfo/board_name || echo "generic"
|
||||
}
|
||||
|
||||
cmdline_get_var() {
|
||||
local var=$1
|
||||
local cmdlinevar tmp
|
||||
|
||||
for cmdlinevar in $(cat /proc/cmdline); do
|
||||
tmp=${cmdlinevar##${var}}
|
||||
[ "=" = "${tmp:0:1}" ] && echo ${tmp:1}
|
||||
done
|
||||
}
|
||||
|
||||
[ -z "$IPKG_INSTROOT" -a -f /lib/config/uci.sh ] && . /lib/config/uci.sh
|
||||
|
||||
71
package/base-files/files/lib/upgrade/common.sh
Executable file → Normal file
71
package/base-files/files/lib/upgrade/common.sh
Executable file → Normal file
@ -59,8 +59,13 @@ ask_bool() {
|
||||
[ "$answer" -gt 0 ]
|
||||
}
|
||||
|
||||
_v() {
|
||||
[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo "$*" >&2
|
||||
}
|
||||
|
||||
v() {
|
||||
[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo "$@"
|
||||
_v "$(date) upgrade: $@"
|
||||
logger -p info -t upgrade "$@"
|
||||
}
|
||||
|
||||
json_string() {
|
||||
@ -86,7 +91,7 @@ get_image() { # <source> [ <command> ]
|
||||
esac
|
||||
fi
|
||||
|
||||
cat "$from" 2>/dev/null | $cmd
|
||||
$cmd <"$from"
|
||||
}
|
||||
|
||||
get_image_dd() {
|
||||
@ -127,47 +132,18 @@ part_magic_fat() {
|
||||
}
|
||||
|
||||
export_bootdevice() {
|
||||
local cmdline uuid disk uevent line
|
||||
local cmdline uuid blockdev uevent line class
|
||||
local MAJOR MINOR DEVNAME DEVTYPE
|
||||
local rootpart="$(cmdline_get_var root)"
|
||||
|
||||
if read cmdline < /proc/cmdline; then
|
||||
case "$cmdline" in
|
||||
*block2mtd=*)
|
||||
disk="${cmdline##*block2mtd=}"
|
||||
disk="${disk%%,*}"
|
||||
;;
|
||||
*root=*)
|
||||
disk="${cmdline##*root=}"
|
||||
disk="${disk%% *}"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$disk" in
|
||||
PARTUUID=[A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9]-[A-F0-9][A-F0-9][A-F0-9][A-F0-9]-[A-F0-9][A-F0-9][A-F0-9][A-F0-9]-[A-F0-9][A-F0-9][A-F0-9][A-F0-9]-[A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9][A-F0-9]0002)
|
||||
uuid="${disk#PARTUUID=}"
|
||||
uuid="${uuid%0002}0002"
|
||||
for disk in $(find /dev -type b); do
|
||||
set -- $(dd if=$disk bs=1 skip=$((2*512+256+128+16)) count=16 2>/dev/null | hexdump -v -e '4/1 "%02x"' | awk '{ \
|
||||
for(i=1;i<9;i=i+2) first=substr($0,i,1) substr($0,i+1,1) first; \
|
||||
for(i=9;i<13;i=i+2) second=substr($0,i,1) substr($0,i+1,1) second; \
|
||||
for(i=13;i<16;i=i+2) third=substr($0,i,1) substr($0,i+1,1) third; \
|
||||
fourth = substr($0,17,4); \
|
||||
five = substr($0,21,12); \
|
||||
} END { print toupper(first"-"second"-"third"-"fourth"-"five) }')
|
||||
if [ "$1" = "$uuid" ]; then
|
||||
uevent="/sys/class/block/${disk##*/}/uevent"
|
||||
export SAVE_PARTITIONS=0
|
||||
break
|
||||
fi
|
||||
done
|
||||
;;
|
||||
PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02)
|
||||
uuid="${disk#PARTUUID=}"
|
||||
uuid="${uuid%-02}"
|
||||
for disk in $(find /dev -type b); do
|
||||
set -- $(dd if=$disk bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "')
|
||||
case "$rootpart" in
|
||||
PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9])
|
||||
uuid="${rootpart#PARTUUID=}"
|
||||
uuid="${uuid%-[a-f0-9][a-f0-9]}"
|
||||
for blockdev in $(find /dev -type b); do
|
||||
set -- $(dd if=$blockdev bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "')
|
||||
if [ "$4$3$2$1" = "$uuid" ]; then
|
||||
uevent="/sys/class/block/${disk##*/}/uevent"
|
||||
uevent="/sys/class/block/${blockdev##*/}/uevent"
|
||||
break
|
||||
fi
|
||||
done
|
||||
@ -184,7 +160,19 @@ export_bootdevice() {
|
||||
done
|
||||
;;
|
||||
/dev/*)
|
||||
uevent="/sys/class/block/${disk##*/}/uevent"
|
||||
uevent="/sys/class/block/${rootpart##*/}/../uevent"
|
||||
;;
|
||||
0x[a-f0-9][a-f0-9][a-f0-9] | 0x[a-f0-9][a-f0-9][a-f0-9][a-f0-9] | \
|
||||
[a-f0-9][a-f0-9][a-f0-9] | [a-f0-9][a-f0-9][a-f0-9][a-f0-9])
|
||||
rootpart=0x${rootpart#0x}
|
||||
for class in /sys/class/block/*; do
|
||||
while read line; do
|
||||
export -n "$line"
|
||||
done < "$class/uevent"
|
||||
if [ $((rootpart/256)) = $MAJOR -a $((rootpart%256)) = $MINOR ]; then
|
||||
uevent="$class/../uevent"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -195,7 +183,6 @@ export_bootdevice() {
|
||||
export BOOTDEV_MAJOR=$MAJOR
|
||||
export BOOTDEV_MINOR=$MINOR
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
return 1
|
||||
|
||||
@ -3,11 +3,11 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=nat46
|
||||
|
||||
PKG_MIRROR_HASH:=3b424241de42b96d47217decf6f9071153cd0c11651f1ee006700836c6660fe8
|
||||
PKG_MIRROR_HASH:=a74a9a84605bac6186adf37025b3880eb9cf5931791bb61d47e69b8898cac411
|
||||
PKG_SOURCE_URL:=https://github.com/ayourtch/nat46.git
|
||||
PKG_SOURCE_DATE:=2021-05-17
|
||||
PKG_SOURCE_DATE:=2021-06-24
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=0d5860d63a8037e001e293091ebf6219cc2f9255
|
||||
PKG_SOURCE_VERSION:=9b3a8197421d987d77e1b9df4159cfe0b9820ee9
|
||||
|
||||
PKG_MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
@ -7,12 +7,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=elfutils
|
||||
PKG_VERSION:=0.180
|
||||
PKG_RELEASE:=2
|
||||
PKG_VERSION:=0.182
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION)
|
||||
PKG_HASH:=b827b6e35c59d188ba97d7cf148fa8dc6f5c68eb6c5981888dfdbb758c0b569d
|
||||
PKG_HASH:=ecc406914edf335f0b7fc084ebe6c460c4d6d5175bfdd6688c1c78d9146b8858
|
||||
|
||||
PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
@ -63,7 +63,9 @@ endif
|
||||
CONFIGURE_ARGS += \
|
||||
--program-prefix=eu- \
|
||||
--disable-debuginfod \
|
||||
--without-lzma
|
||||
--disable-libdebuginfod \
|
||||
--without-lzma \
|
||||
--without-zstd
|
||||
|
||||
TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral
|
||||
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
From http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-devtools/elfutils/files/0001-ppc_initreg.c-Incliude-asm-ptrace.h-for-pt_regs-defi.patch
|
||||
|
||||
From 2e2232d0935bf8ef6e66ebffba3be68a73b5b3e5 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 8 Sep 2019 15:57:59 -0700
|
||||
Subject: [PATCH] ppc_initreg.c: Incliude asm/ptrace.h for pt_regs definition
|
||||
|
||||
Fixes
|
||||
| ../../elfutils-0.176/backends/ppc_initreg.c:79:22: error: field 'r' has incomplete type
|
||||
| struct pt_regs r;
|
||||
| ^
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
backends/ppc_initreg.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/backends/ppc_initreg.c
|
||||
+++ b/backends/ppc_initreg.c
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <stdlib.h>
|
||||
#if defined(__powerpc__) && defined(__linux__)
|
||||
# include <sys/ptrace.h>
|
||||
+# include <asm/ptrace.h>
|
||||
# include <sys/user.h>
|
||||
#endif
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
Requires.private: zlib
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -586,6 +586,9 @@ AC_CONFIG_FILES([config/libelf.pc config
|
||||
@@ -590,6 +590,9 @@ AC_CONFIG_FILES([config/libelf.pc config
|
||||
AC_SUBST(USE_NLS, yes)
|
||||
AM_PO_SUBDIRS
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
#define _(Str) dgettext ("elfutils", Str)
|
||||
--- a/libdwfl/libdwflP.h
|
||||
+++ b/libdwfl/libdwflP.h
|
||||
@@ -44,6 +44,9 @@
|
||||
@@ -47,6 +47,9 @@
|
||||
|
||||
typedef struct Dwfl_Process Dwfl_Process;
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
pkginclude_HEADERS = version.h
|
||||
|
||||
SUBDIRS = config m4 lib libelf libcpu backends libebl libdwelf libdwfl libdw \
|
||||
- libasm src po doc tests
|
||||
- libasm debuginfod src po doc tests
|
||||
+ libasm
|
||||
|
||||
if DEBUGINFOD
|
||||
SUBDIRS += debuginfod
|
||||
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
|
||||
COPYING COPYING-GPLV2 COPYING-LGPLV3
|
||||
|
||||
@ -22,8 +22,6 @@ Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
backends/arm_initreg.c | 2 +-
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/backends/aarch64_initreg.c b/backends/aarch64_initreg.c
|
||||
index daf6f37..6445276 100644
|
||||
--- a/backends/aarch64_initreg.c
|
||||
+++ b/backends/aarch64_initreg.c
|
||||
@@ -33,7 +33,7 @@
|
||||
@ -35,7 +33,7 @@ index daf6f37..6445276 100644
|
||||
# include <sys/user.h>
|
||||
# include <sys/ptrace.h>
|
||||
/* Deal with old glibc defining user_pt_regs instead of user_regs_struct. */
|
||||
@@ -82,7 +82,7 @@ aarch64_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
|
||||
@@ -82,7 +82,7 @@ aarch64_set_initial_registers_tid (pid_t
|
||||
|
||||
Dwarf_Word dwarf_fregs[32];
|
||||
for (int r = 0; r < 32; r++)
|
||||
@ -44,8 +42,6 @@ index daf6f37..6445276 100644
|
||||
|
||||
if (! setfunc (64, 32, dwarf_fregs, arg))
|
||||
return false;
|
||||
diff --git a/backends/arm_initreg.c b/backends/arm_initreg.c
|
||||
index efcabaf..062bb9e 100644
|
||||
--- a/backends/arm_initreg.c
|
||||
+++ b/backends/arm_initreg.c
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
@ -24,28 +24,3 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
||||
|
||||
#include <system.h>
|
||||
|
||||
--- a/libelf/elf.h
|
||||
+++ b/libelf/elf.h
|
||||
@@ -19,9 +19,9 @@
|
||||
#ifndef _ELF_H
|
||||
#define _ELF_H 1
|
||||
|
||||
-#include <features.h>
|
||||
-
|
||||
-__BEGIN_DECLS
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
|
||||
/* Standard ELF types. */
|
||||
|
||||
@@ -4103,6 +4103,8 @@ enum
|
||||
#define R_ARC_TLS_LE_S9 0x4a
|
||||
#define R_ARC_TLS_LE_32 0x4b
|
||||
|
||||
-__END_DECLS
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif
|
||||
|
||||
#endif /* elf.h */
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
--- a/libebl/libebl.h
|
||||
+++ b/libebl/libebl.h
|
||||
@@ -245,7 +245,7 @@ extern ssize_t ebl_register_info (Ebl *e
|
||||
Each of these is filled with the DWARF register number corresponding,
|
||||
or -1 if there is none. Returns zero when the information is available. */
|
||||
extern int ebl_syscall_abi (Ebl *ebl, int *sp, int *pc,
|
||||
- int *callno, int args[6]);
|
||||
+ int *callno, int args[]);
|
||||
|
||||
/* Supply the ABI-specified state of DWARF CFI before CIE initial programs.
|
||||
|
||||
--- a/libdw/libdw.h
|
||||
+++ b/libdw/libdw.h
|
||||
@@ -1065,7 +1065,7 @@ extern int dwarf_frame_cfa (Dwarf_Frame
|
||||
expressions in the CFI, *OPS is an internal pointer that can be used as
|
||||
long as the Dwarf_CFI used to create FRAME remains alive. */
|
||||
extern int dwarf_frame_register (Dwarf_Frame *frame, int regno,
|
||||
- Dwarf_Op ops_mem[3],
|
||||
+ Dwarf_Op ops_mem[],
|
||||
Dwarf_Op **ops, size_t *nops)
|
||||
__nonnull_attribute__ (3, 4, 5);
|
||||
|
||||
@ -1,12 +0,0 @@
|
||||
diff --git a/backends/ppc_initreg.c b/backends/ppc_initreg.c
|
||||
index 0e0d359..810e14a 100644
|
||||
--- a/backends/ppc_initreg.c
|
||||
+++ b/backends/ppc_initreg.c
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <stdlib.h>
|
||||
#if defined(__powerpc__) && defined(__linux__)
|
||||
# include <sys/ptrace.h>
|
||||
+# include <linux/ptrace.h>
|
||||
# include <sys/user.h>
|
||||
#endif
|
||||
|
||||
@ -24,8 +24,8 @@ PKG_CPE_ID:=cpe:/a:gnu:gettext
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_DEPENDS:=gettext-full/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_PARALLEL:=0
|
||||
HOST_BUILD_PARALLEL:=0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
@ -6,12 +6,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libcap
|
||||
PKG_VERSION:=2.48
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=2.51
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/libs/security/linux-privs/libcap2
|
||||
PKG_HASH:=4de9590ee09a87c282d558737ffb5b6175ccbfd26d580add10df44d0f047f6c2
|
||||
PKG_HASH:=6609f3ab7aebcc8f9277f53a577c657d9f3056d1352ea623da7fd7c0f00890f9
|
||||
|
||||
PKG_MAINTAINER:=Paul Wassi <p.wassi@gmx.at>
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
|
||||
@ -8,12 +8,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libnftnl
|
||||
PKG_VERSION:=1.1.8
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.2.0
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
|
||||
PKG_HASH:=04a3fa5b08b736268f7e65836b9f05d9d5f438181467bee3c76c3c4a4f3ab711
|
||||
PKG_HASH:=90b01fddfe9be8c3245c3ba5ff5a4424a8df708828f92b2b361976b658c074f5
|
||||
|
||||
PKG_MAINTAINER:=Steven Barth <steven@midlink.org>
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
|
||||
@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libpcap
|
||||
PKG_VERSION:=1.10.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.10.1
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://www.us.tcpdump.org/release/ \
|
||||
http://www.tcpdump.org/release/
|
||||
PKG_HASH:=8d12b42623eeefee872f123bd0dc85d535b00df4d42e865f993c40f7bfc92b1e
|
||||
PKG_HASH:=ed285f4accaf05344f90975757b3dbfe772ba41d1c401c2648b7fa45b711bdd4
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
@ -43,6 +43,19 @@ define Package/libpcap/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/rpcapd
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Capture daemon to be controlled by a remote libpcap application
|
||||
URL:=http://www.tcpdump.org/
|
||||
DEPENDS+= +libpcap
|
||||
endef
|
||||
|
||||
ifdef CONFIG_PACKAGE_rpcapd
|
||||
CMAKE_OPTIONS += \
|
||||
-DENABLE_REMOTE=ON
|
||||
endif
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DBUILD_WITH_LIBNL=OFF \
|
||||
@ -81,4 +94,10 @@ define Package/libpcap/install
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcap.so.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/rpcapd/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rpcapd $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libpcap))
|
||||
$(eval $(call BuildPackage,rpcapd))
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1006,7 +1006,6 @@ endif()
|
||||
@@ -1042,7 +1042,6 @@ endif()
|
||||
#
|
||||
# OpenSSL/libressl.
|
||||
#
|
||||
|
||||
@ -9,7 +9,7 @@ Subject: [PATCH] skip manpages
|
||||
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -2701,57 +2701,6 @@ if(NOT MSVC)
|
||||
@@ -2732,57 +2732,6 @@ if(NOT MSVC)
|
||||
if(MINGW)
|
||||
find_program(LINK_EXECUTABLE ln)
|
||||
endif(MINGW)
|
||||
|
||||
@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mbedtls
|
||||
PKG_VERSION:=2.16.10
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=2.16.11
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=96257bb03b30300b2f35f861ffe204ed957e9fd0329d80646fe57fc49f589b29
|
||||
PKG_HASH:=c18e7e9abf95e69e425260493720470021384a1728417042060a35d0b7b18b41
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
PKG_LICENSE_FILES:=gpl-2.0.txt
|
||||
|
||||
@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=nettle
|
||||
PKG_VERSION:=3.6
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=3.7.3
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@GNU/nettle
|
||||
PKG_HASH:=d24c0d0f2abffbc8f4f34dcf114b0f131ec3774895f3555922fe2f40f3d5e3f1
|
||||
PKG_HASH:=661f5eb03f048a3b924c3a8ad2515d4068e40f67e774e8a26827658007e3bcf0
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -4635,6 +4635,7 @@ $as_echo_n "checking build system compil
|
||||
@@ -4661,6 +4661,7 @@ $as_echo_n "checking build system compil
|
||||
# remove anything that might look like compiler output to our "||" expression
|
||||
rm -f conftest* a.out b.out a.exe a_out.exe
|
||||
cat >conftest.c <<EOF
|
||||
@ -8,7 +8,7 @@
|
||||
int
|
||||
main ()
|
||||
{
|
||||
@@ -4667,6 +4668,7 @@ $as_echo_n "checking build system compil
|
||||
@@ -4693,6 +4694,7 @@ $as_echo_n "checking build system compil
|
||||
# remove anything that might look like compiler output to our "||" expression
|
||||
rm -f conftest* a.out b.out a.exe a_out.exe
|
||||
cat >conftest.c <<EOF
|
||||
@ -16,7 +16,7 @@
|
||||
int
|
||||
main ()
|
||||
{
|
||||
@@ -4703,6 +4705,7 @@ $as_echo_n "checking build system compil
|
||||
@@ -4729,6 +4731,7 @@ $as_echo_n "checking build system compil
|
||||
# remove anything that might look like compiler output to our "||" expression
|
||||
rm -f conftest* a.out b.out a.exe a_out.exe
|
||||
cat >conftest.c <<EOF
|
||||
@ -24,7 +24,7 @@
|
||||
int
|
||||
main ()
|
||||
{
|
||||
@@ -4753,6 +4756,7 @@ else
|
||||
@@ -4779,6 +4782,7 @@ else
|
||||
gmp_cv_prog_exeext_for_build="$EXEEXT"
|
||||
else
|
||||
cat >conftest.c <<EOF
|
||||
|
||||
@ -8,12 +8,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=pcre
|
||||
PKG_VERSION:=8.44
|
||||
PKG_RELEASE:=4
|
||||
PKG_VERSION:=8.45
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=@SF/$(PKG_NAME)
|
||||
PKG_HASH:=19108658b23b3ec5058edc9f66ac545ea19f9537234be1ec62b714c84399366d
|
||||
PKG_HASH:=4dae6fdcd2bb0bb6c37b5f97c33c2be954da743985369cddac3546e3218bffb8
|
||||
|
||||
PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
|
||||
@ -19,6 +19,7 @@ BASEDHCPSTAMPFILE="/var/run/dnsmasq"
|
||||
DHCPBOGUSHOSTNAMEFILE="/usr/share/dnsmasq/dhcpbogushostname.conf"
|
||||
RFC6761FILE="/usr/share/dnsmasq/rfc6761.conf"
|
||||
DHCPSCRIPT="/usr/lib/dnsmasq/dhcp-script.sh"
|
||||
DHCPSCRIPT_DEPENDS="/usr/share/libubox/jshn.sh /usr/bin/jshn /bin/ubus"
|
||||
|
||||
DNSMASQ_DHCP_VER=4
|
||||
|
||||
@ -186,7 +187,22 @@ append_notinterface() {
|
||||
xappend "--except-interface=$ifname"
|
||||
}
|
||||
|
||||
ismounted() {
|
||||
local filename="$1"
|
||||
local dirname
|
||||
for dirname in $EXTRA_MOUNT ; do
|
||||
case "$filename" in
|
||||
"${dirname}/"* | "${dirname}" )
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
append_addnhosts() {
|
||||
ismounted "$1" || append EXTRA_MOUNT "$1"
|
||||
xappend "--addn-hosts=$1"
|
||||
}
|
||||
|
||||
@ -801,9 +817,10 @@ dnsmasq_start()
|
||||
config_get_bool disabled "$cfg" disabled 0
|
||||
[ "$disabled" -gt 0 ] && return 0
|
||||
|
||||
# reset list of DOMAINS and DNS servers (for each dnsmasq instance)
|
||||
# reset list of DOMAINS, DNS servers and EXTRA mounts (for each dnsmasq instance)
|
||||
DNS_SERVERS=""
|
||||
DOMAIN=""
|
||||
EXTRA_MOUNT=""
|
||||
CONFIGFILE="${BASECONFIGFILE}.${cfg}"
|
||||
CONFIGFILE_TMP="${CONFIGFILE}.$$"
|
||||
HOSTFILE="${BASEHOSTFILE}.${cfg}"
|
||||
@ -929,6 +946,14 @@ dnsmasq_start()
|
||||
config_list_foreach "$cfg" "interface" append_interface
|
||||
config_list_foreach "$cfg" "notinterface" append_notinterface
|
||||
}
|
||||
config_get_bool ignore_hosts_dir "$cfg" ignore_hosts_dir 0
|
||||
if [ "$ignore_hosts_dir" = "1" ]; then
|
||||
xappend "--addn-hosts=$HOSTFILE"
|
||||
append EXTRA_MOUNT "$HOSTFILE"
|
||||
else
|
||||
xappend "--addn-hosts=$(dirname $HOSTFILE)"
|
||||
append EXTRA_MOUNT "$(dirname $HOSTFILE)"
|
||||
fi
|
||||
config_list_foreach "$cfg" "addnhosts" append_addnhosts
|
||||
config_list_foreach "$cfg" "bogusnxdomain" append_bogusnxdomain
|
||||
append_parm "$cfg" "leasefile" "--dhcp-leasefile" "/tmp/dhcp.leases"
|
||||
@ -1024,12 +1049,6 @@ dnsmasq_start()
|
||||
|
||||
xappend "--dhcp-broadcast=tag:needs-broadcast"
|
||||
|
||||
config_get_bool ignore_hosts_dir "$cfg" ignore_hosts_dir 0
|
||||
if [ "$ignore_hosts_dir" = "1" ]; then
|
||||
xappend "--addn-hosts=$HOSTFILE"
|
||||
else
|
||||
xappend "--addn-hosts=$(dirname $HOSTFILE)"
|
||||
fi
|
||||
|
||||
config_get dnsmasqconfdir "$cfg" confdir "/tmp/dnsmasq.d"
|
||||
xappend "--conf-dir=$dnsmasqconfdir"
|
||||
@ -1122,7 +1141,10 @@ dnsmasq_start()
|
||||
procd_set_param respawn
|
||||
|
||||
procd_add_jail dnsmasq ubus log
|
||||
procd_add_jail_mount $CONFIGFILE $TRUSTANCHORSFILE $HOSTFILE $RFC6761FILE $DHCPBOGUSHOSTNAMEFILE /etc/passwd /etc/group /etc/TZ /dev/null /dev/urandom $dnsmasqconffile $dnsmasqconfdir $resolvdir $user_dhcpscript /etc/hosts /etc/ethers /sbin/hotplug-call $EXTRA_MOUNT $DHCPSCRIPT /tmp/hosts/
|
||||
procd_add_jail_mount $CONFIGFILE $DHCPBOGUSHOSTNAMEFILE $DHCPSCRIPT $DHCPSCRIPT_DEPENDS
|
||||
procd_add_jail_mount $EXTRA_MOUNT $RFC6761FILE $TRUSTANCHORSFILE
|
||||
procd_add_jail_mount $dnsmasqconffile $dnsmasqconfdir $resolvdir $user_dhcpscript
|
||||
procd_add_jail_mount /etc/passwd /etc/group /etc/TZ /etc/hosts /etc/ethers
|
||||
procd_add_jail_mount_rw /var/run/dnsmasq/ $leasefile
|
||||
|
||||
procd_close_instance
|
||||
|
||||
@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ethtool
|
||||
PKG_VERSION:=5.12
|
||||
PKG_VERSION:=5.13
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/software/network/ethtool
|
||||
PKG_HASH:=f5ddfa9c75053d8011b8c8c99ec4e2d3c83cd1972f638692d62e37fa3ef36f07
|
||||
PKG_HASH:=e63a7254c6cf2e443d9989c8c34a94e136d789ae1cf5da55397439b055e48cf3
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
@ -23,8 +23,6 @@ PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_ETHTOOL_PRETTY_DUMP
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ethtool
|
||||
@ -32,6 +30,16 @@ define Package/ethtool
|
||||
CATEGORY:=Network
|
||||
TITLE:=Display or change ethernet card settings
|
||||
URL:=http://www.kernel.org/pub/software/network/ethtool/
|
||||
VARIANT:=tiny
|
||||
endef
|
||||
|
||||
define Package/ethtool-full
|
||||
$(Package/ethtool)
|
||||
TITLE += (full)
|
||||
VARIANT:=full
|
||||
PROVIDES:=ethtool
|
||||
CONFLICTS:=ethtool
|
||||
DEPENDS:=+libmnl
|
||||
endef
|
||||
|
||||
define Package/ethtool/description
|
||||
@ -39,18 +47,12 @@ define Package/ethtool/description
|
||||
network interface
|
||||
endef
|
||||
|
||||
define Package/ethtool/config
|
||||
config ETHTOOL_PRETTY_DUMP
|
||||
depends on PACKAGE_ethtool
|
||||
bool "Enable pretty printing"
|
||||
endef
|
||||
Package/ethtool-full/description:=$(Package/ethtool/description)
|
||||
|
||||
CONFIGURE_ARGS += --disable-netlink
|
||||
|
||||
ifeq ($(CONFIG_ETHTOOL_PRETTY_DUMP),y)
|
||||
CONFIGURE_ARGS += --enable-pretty-dump
|
||||
ifeq ($(BUILD_VARIANT),full)
|
||||
CONFIGURE_ARGS += --enable-netlink --enable-pretty-dump
|
||||
else
|
||||
CONFIGURE_ARGS += --disable-pretty-dump
|
||||
CONFIGURE_ARGS += --disable-netlink --disable-pretty-dump
|
||||
endif
|
||||
|
||||
define Package/ethtool/install
|
||||
@ -58,4 +60,7 @@ define Package/ethtool/install
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ethtool $(1)/usr/sbin
|
||||
endef
|
||||
|
||||
Package/ethtool-full/install=$(Package/ethtool/install)
|
||||
|
||||
$(eval $(call BuildPackage,ethtool))
|
||||
$(eval $(call BuildPackage,ethtool-full))
|
||||
|
||||
@ -8,12 +8,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=iproute2
|
||||
PKG_VERSION:=5.11.0
|
||||
PKG_RELEASE:=4
|
||||
PKG_VERSION:=5.13.0
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
|
||||
PKG_HASH:=c5e2ea108212b3445051b35953ec267f9f3469e1d5c67ac034ab559849505c54
|
||||
PKG_HASH:=72a2e53774cac9e65f7b617deebb2059f87e8960d6e9713e4d788cea966f1b36
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_DEPENDS:=iptables
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
|
||||
YACCFLAGS = -d -t -v
|
||||
|
||||
-SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man
|
||||
-SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man vdpa
|
||||
+SUBDIRS=lib ip tc bridge misc genl devlink rdma
|
||||
|
||||
LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
|
||||
@ -25,19 +25,20 @@
|
||||
sed -n '/'$$s'[^ ]* =/{s:.* \([^ ]*'$$s'[^ ]*\) .*:extern char \1[] __attribute__((weak)); if (!strcmp(sym, "\1")) return \1;:;p}' $$files ; \
|
||||
--- a/ip/ip.c
|
||||
+++ b/ip/ip.c
|
||||
@@ -64,10 +64,16 @@ static void usage(void)
|
||||
@@ -64,11 +64,17 @@ static void usage(void)
|
||||
fprintf(stderr,
|
||||
"Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n"
|
||||
" ip [ -force ] -batch filename\n"
|
||||
+#ifndef IPROUTE2_TINY
|
||||
"where OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |\n"
|
||||
" tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |\n"
|
||||
" netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |\n"
|
||||
" vrf | sr | nexthop | mptcp }\n"
|
||||
"where OBJECT := { address | addrlabel | fou | help | ila | l2tp | link |\n"
|
||||
" macsec | maddress | monitor | mptcp | mroute | mrule |\n"
|
||||
" neighbor | neighbour | netconf | netns | nexthop | ntable |\n"
|
||||
" ntbl | route | rule | sr | tap | tcpmetrics |\n"
|
||||
" token | tunnel | tuntap | vrf | xfrm }\n"
|
||||
+#else
|
||||
+ "where OBJECT := { link | address | route | rule | neigh | tunnel | maddress |\n"
|
||||
+ " mroute | mrule | monitor | netns | macsec | token | ila |\n"
|
||||
+ " vrf | sr }\n"
|
||||
+ "where OBJECT := { address | ila | link | macsec | maddress | monitor |\n"
|
||||
+ " mroute | mrule | neighbor | neighbour | netns | route |\n"
|
||||
+ " rule | sr | token | tunnel | vrf }\n"
|
||||
+#endif
|
||||
" OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n"
|
||||
" -h[uman-readable] | -iec | -j[son] | -p[retty] |\n"
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
From c77310119f9a5f99221dd967c5eb0c7a26094b41 Mon Sep 17 00:00:00 2001
|
||||
From: Tony Ambardar <Tony.Ambardar@gmail.com>
|
||||
Date: Wed, 3 Mar 2021 10:29:24 -0800
|
||||
Subject: [PATCH] lib/bpf: add missing limits.h includes
|
||||
|
||||
Several functions in bpf_glue.c and bpf_libbpf.c rely on PATH_MAX, which is
|
||||
normally included from <limits.h> in other iproute2 source files.
|
||||
|
||||
It fixes errors seen using gcc 10.2.0, binutils 2.35.1 and musl 1.1.24:
|
||||
|
||||
bpf_glue.c: In function 'get_libbpf_version':
|
||||
bpf_glue.c:46:11: error: 'PATH_MAX' undeclared (first use in this function);
|
||||
did you mean 'AF_MAX'?
|
||||
46 | char buf[PATH_MAX], *s;
|
||||
| ^~~~~~~~
|
||||
| AF_MAX
|
||||
|
||||
Reported-by: Rui Salvaterra <rsalvaterra@gmail.com>
|
||||
Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
|
||||
---
|
||||
lib/bpf_glue.c | 2 ++
|
||||
lib/bpf_libbpf.c | 1 +
|
||||
2 files changed, 3 insertions(+)
|
||||
|
||||
--- a/lib/bpf_glue.c
|
||||
+++ b/lib/bpf_glue.c
|
||||
@@ -4,6 +4,8 @@
|
||||
* Authors: Hangbin Liu <haliu@redhat.com>
|
||||
*
|
||||
*/
|
||||
+#include <limits.h>
|
||||
+
|
||||
#include "bpf_util.h"
|
||||
#ifdef HAVE_LIBBPF
|
||||
#include <bpf/bpf.h>
|
||||
--- a/lib/bpf_libbpf.c
|
||||
+++ b/lib/bpf_libbpf.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
+#include <limits.h>
|
||||
|
||||
#include <libelf.h>
|
||||
#include <gelf.h>
|
||||
@ -3,13 +3,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=openwrt-keyring
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/keyring.git
|
||||
PKG_SOURCE_DATE:=2018-05-18
|
||||
PKG_SOURCE_VERSION:=103a32e9f52fd35a428dc08ddbca86fe41dfb918
|
||||
PKG_MIRROR_HASH:=58f42796396fee0e4f008d6f5a970a421d023d6c98e71bf53c2778734fa3480b
|
||||
PKG_SOURCE_URL=https://github.com/immortalwrt/keyring.git
|
||||
PKG_MIRROR_HASH:=c8600265b922462431c8f87a8cf3cd12f3e55b3c54078bb15bad9a8f41be2424
|
||||
PKG_SOURCE_DATE:=2021-08-06
|
||||
PKG_SOURCE_VERSION:=746fa1a0c45bd82d9bf25d5334933a2e454fdeeb
|
||||
|
||||
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
@ -20,7 +20,7 @@ define Package/openwrt-keyring
|
||||
SECTION:=base
|
||||
CATEGORY:=Base system
|
||||
PROVIDES:=lede-keyring
|
||||
TITLE:=OpenWrt Developer Keyring
|
||||
TITLE:=ImmortalWrt Developer Keyring
|
||||
URL:=https://openwrt.org/docs/guide-user/security/signatures
|
||||
endef
|
||||
|
||||
@ -31,8 +31,12 @@ endef
|
||||
Build/Compile=
|
||||
|
||||
define Package/openwrt-keyring/install
|
||||
$(INSTALL_DIR) $(1)/etc/opkg/keys/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/usign/* $(1)/etc/opkg/keys/
|
||||
# Public usign key for OPDE
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/usign/66ceb3e8f7432fed $(1)/etc/opkg/keys/
|
||||
# Public usign key for unattended snapshot builds
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/usign/b5043e70f9a75cde $(1)/etc/opkg/keys/
|
||||
# Public usign key for 18.06 release builds
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/usign/1035ac73cc4e59e3 $(1)/etc/opkg/keys/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,openwrt-keyring))
|
||||
|
||||
@ -340,7 +340,7 @@ static int show_matching_key_value(struct tffs_key_name_table *key_names)
|
||||
for (uint32_t i = 0; i < key_names->size; i++) {
|
||||
name = key_names->entries[i].val;
|
||||
|
||||
if (strncmp(name, name_filter, strlen(name)) == 0) {
|
||||
if (strcmp(name, name_filter) == 0) {
|
||||
if (find_entry(key_names->entries[i].id, &tmp)) {
|
||||
print_entry_value(&tmp);
|
||||
printf("\n");
|
||||
|
||||
@ -204,7 +204,7 @@ static int show_matching_key_value(uint8_t *buffer,
|
||||
for (i = 0; i < key_names->size; i++) {
|
||||
name = key_names->entries[i].val;
|
||||
|
||||
if (strncmp(name, name_filter, strlen(name)) == 0) {
|
||||
if (strcmp(name, name_filter) == 0) {
|
||||
id = to_entry_header_id(*key_names->entries[i].id);
|
||||
|
||||
if (find_entry(buffer, id, &tmp)) {
|
||||
|
||||
@ -10,7 +10,11 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=otrx
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_FLAGS:=nonshared
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git
|
||||
PKG_SOURCE_DATE:=2021-07-30
|
||||
PKG_SOURCE_VERSION:=a5c65fa1192e174e9e895637aaf93945959aa029
|
||||
PKG_MIRROR_HASH:=8ef94e74f50b21fd226dd5311962f8bdbd3aa55da11026b2cf2a4b35556350af
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@ -26,10 +30,12 @@ define Package/otrx/description
|
||||
This package contains an utility that allows validating TRX images.
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -Wall
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
CC="$(TARGET_CC)" \
|
||||
CFLAGS="$(TARGET_CFLAGS) -Wall"
|
||||
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
|
||||
-o $(PKG_BUILD_DIR)/otrx \
|
||||
$(PKG_BUILD_DIR)/src/otrx.c
|
||||
endef
|
||||
|
||||
define Package/otrx/install
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
all: otrx
|
||||
|
||||
otrx:
|
||||
$(CC) $(CFLAGS) -o $@ otrx.c -Wall
|
||||
|
||||
clean:
|
||||
rm -f otrx
|
||||
@ -1,592 +0,0 @@
|
||||
/*
|
||||
* otrx
|
||||
*
|
||||
* Copyright (C) 2015-2017 Rafał Miłecki <zajec5@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*/
|
||||
|
||||
#include <byteswap.h>
|
||||
#include <endian.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(__BYTE_ORDER)
|
||||
#error "Unknown byte order"
|
||||
#endif
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define cpu_to_le32(x) bswap_32(x)
|
||||
#define le32_to_cpu(x) bswap_32(x)
|
||||
#elif __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define cpu_to_le32(x) (x)
|
||||
#define le32_to_cpu(x) (x)
|
||||
#else
|
||||
#error "Unsupported endianness"
|
||||
#endif
|
||||
|
||||
#define TRX_MAGIC 0x30524448
|
||||
#define TRX_FLAGS_OFFSET 12
|
||||
#define TRX_MAX_PARTS 3
|
||||
|
||||
struct trx_header {
|
||||
uint32_t magic;
|
||||
uint32_t length;
|
||||
uint32_t crc32;
|
||||
uint16_t flags;
|
||||
uint16_t version;
|
||||
uint32_t offset[3];
|
||||
};
|
||||
|
||||
char *trx_path;
|
||||
size_t trx_offset = 0;
|
||||
char *partition[TRX_MAX_PARTS] = {};
|
||||
|
||||
static inline size_t otrx_min(size_t x, size_t y) {
|
||||
return x < y ? x : y;
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* CRC32
|
||||
**************************************************/
|
||||
|
||||
static const uint32_t crc32_tbl[] = {
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
|
||||
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
|
||||
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
||||
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
|
||||
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
|
||||
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
||||
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
|
||||
0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
|
||||
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
|
||||
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
||||
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
|
||||
0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
||||
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
|
||||
0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
|
||||
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
||||
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
|
||||
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
|
||||
0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
||||
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
|
||||
0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
||||
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
|
||||
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
|
||||
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
|
||||
0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
||||
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
|
||||
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
|
||||
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
|
||||
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
|
||||
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
|
||||
0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
|
||||
0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
|
||||
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
|
||||
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
|
||||
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
||||
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
||||
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
|
||||
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
|
||||
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
|
||||
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
||||
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
|
||||
0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
||||
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
|
||||
0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
|
||||
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
|
||||
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
|
||||
0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
||||
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
|
||||
0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
||||
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
|
||||
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
|
||||
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
|
||||
0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
||||
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
|
||||
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
|
||||
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
|
||||
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
|
||||
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
|
||||
0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
|
||||
0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
|
||||
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
||||
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
|
||||
};
|
||||
|
||||
uint32_t otrx_crc32(uint32_t crc, uint8_t *buf, size_t len) {
|
||||
while (len) {
|
||||
crc = crc32_tbl[(crc ^ *buf) & 0xff] ^ (crc >> 8);
|
||||
buf++;
|
||||
len--;
|
||||
}
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* Check
|
||||
**************************************************/
|
||||
|
||||
static void otrx_check_parse_options(int argc, char **argv) {
|
||||
int c;
|
||||
|
||||
while ((c = getopt(argc, argv, "o:")) != -1) {
|
||||
switch (c) {
|
||||
case 'o':
|
||||
trx_offset = atoi(optarg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int otrx_check(int argc, char **argv) {
|
||||
FILE *trx;
|
||||
struct trx_header hdr;
|
||||
size_t bytes, length;
|
||||
uint8_t buf[1024];
|
||||
uint32_t crc32;
|
||||
int err = 0;
|
||||
|
||||
if (argc < 3) {
|
||||
fprintf(stderr, "No TRX file passed\n");
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
trx_path = argv[2];
|
||||
|
||||
optind = 3;
|
||||
otrx_check_parse_options(argc, argv);
|
||||
|
||||
trx = fopen(trx_path, "r");
|
||||
if (!trx) {
|
||||
fprintf(stderr, "Couldn't open %s\n", trx_path);
|
||||
err = -EACCES;
|
||||
goto out;
|
||||
}
|
||||
|
||||
fseek(trx, trx_offset, SEEK_SET);
|
||||
bytes = fread(&hdr, 1, sizeof(hdr), trx);
|
||||
if (bytes != sizeof(hdr)) {
|
||||
fprintf(stderr, "Couldn't read %s header\n", trx_path);
|
||||
err = -EIO;
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
if (le32_to_cpu(hdr.magic) != TRX_MAGIC) {
|
||||
fprintf(stderr, "Invalid TRX magic: 0x%08x\n", le32_to_cpu(hdr.magic));
|
||||
err = -EINVAL;
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
length = le32_to_cpu(hdr.length);
|
||||
if (length < sizeof(hdr)) {
|
||||
fprintf(stderr, "Length read from TRX too low (%zu B)\n", length);
|
||||
err = -EINVAL;
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
crc32 = 0xffffffff;
|
||||
fseek(trx, trx_offset + TRX_FLAGS_OFFSET, SEEK_SET);
|
||||
length -= TRX_FLAGS_OFFSET;
|
||||
while ((bytes = fread(buf, 1, otrx_min(sizeof(buf), length), trx)) > 0) {
|
||||
crc32 = otrx_crc32(crc32, buf, bytes);
|
||||
length -= bytes;
|
||||
}
|
||||
|
||||
if (length) {
|
||||
fprintf(stderr, "Couldn't read last %zd B of data from %s\n", length, trx_path);
|
||||
err = -EIO;
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
if (crc32 != le32_to_cpu(hdr.crc32)) {
|
||||
fprintf(stderr, "Invalid data crc32: 0x%08x instead of 0x%08x\n", crc32, le32_to_cpu(hdr.crc32));
|
||||
err = -EINVAL;
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
printf("Found a valid TRX version %d\n", le32_to_cpu(hdr.version));
|
||||
|
||||
err_close:
|
||||
fclose(trx);
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* Create
|
||||
**************************************************/
|
||||
|
||||
static ssize_t otrx_create_append_file(FILE *trx, const char *in_path) {
|
||||
FILE *in;
|
||||
size_t bytes;
|
||||
ssize_t length = 0;
|
||||
uint8_t buf[1024];
|
||||
|
||||
in = fopen(in_path, "r");
|
||||
if (!in) {
|
||||
fprintf(stderr, "Couldn't open %s\n", in_path);
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
while ((bytes = fread(buf, 1, sizeof(buf), in)) > 0) {
|
||||
if (fwrite(buf, 1, bytes, trx) != bytes) {
|
||||
fprintf(stderr, "Couldn't write %zu B to %s\n", bytes, trx_path);
|
||||
length = -EIO;
|
||||
break;
|
||||
}
|
||||
length += bytes;
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
static ssize_t otrx_create_append_zeros(FILE *trx, size_t length) {
|
||||
uint8_t *buf;
|
||||
|
||||
buf = malloc(length);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
memset(buf, 0, length);
|
||||
|
||||
if (fwrite(buf, 1, length, trx) != length) {
|
||||
fprintf(stderr, "Couldn't write %zu B to %s\n", length, trx_path);
|
||||
free(buf);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
static ssize_t otrx_create_align(FILE *trx, size_t curr_offset, size_t alignment) {
|
||||
if (curr_offset & (alignment - 1)) {
|
||||
size_t length = alignment - (curr_offset % alignment);
|
||||
return otrx_create_append_zeros(trx, length);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int otrx_create_write_hdr(FILE *trx, struct trx_header *hdr) {
|
||||
size_t bytes, length;
|
||||
uint8_t buf[1024];
|
||||
uint32_t crc32;
|
||||
|
||||
hdr->magic = cpu_to_le32(TRX_MAGIC);
|
||||
hdr->version = 1;
|
||||
|
||||
fseek(trx, 0, SEEK_SET);
|
||||
bytes = fwrite(hdr, 1, sizeof(struct trx_header), trx);
|
||||
if (bytes != sizeof(struct trx_header)) {
|
||||
fprintf(stderr, "Couldn't write TRX header to %s\n", trx_path);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
length = le32_to_cpu(hdr->length);
|
||||
|
||||
crc32 = 0xffffffff;
|
||||
fseek(trx, TRX_FLAGS_OFFSET, SEEK_SET);
|
||||
length -= TRX_FLAGS_OFFSET;
|
||||
while ((bytes = fread(buf, 1, otrx_min(sizeof(buf), length), trx)) > 0) {
|
||||
crc32 = otrx_crc32(crc32, buf, bytes);
|
||||
length -= bytes;
|
||||
}
|
||||
hdr->crc32 = cpu_to_le32(crc32);
|
||||
|
||||
fseek(trx, 0, SEEK_SET);
|
||||
bytes = fwrite(hdr, 1, sizeof(struct trx_header), trx);
|
||||
if (bytes != sizeof(struct trx_header)) {
|
||||
fprintf(stderr, "Couldn't write TRX header to %s\n", trx_path);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int otrx_create(int argc, char **argv) {
|
||||
FILE *trx;
|
||||
struct trx_header hdr = {};
|
||||
ssize_t sbytes;
|
||||
size_t curr_idx = 0;
|
||||
size_t curr_offset = sizeof(hdr);
|
||||
int c;
|
||||
int err = 0;
|
||||
|
||||
if (argc < 3) {
|
||||
fprintf(stderr, "No TRX file passed\n");
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
trx_path = argv[2];
|
||||
|
||||
trx = fopen(trx_path, "w+");
|
||||
if (!trx) {
|
||||
fprintf(stderr, "Couldn't open %s\n", trx_path);
|
||||
err = -EACCES;
|
||||
goto out;
|
||||
}
|
||||
fseek(trx, curr_offset, SEEK_SET);
|
||||
|
||||
optind = 3;
|
||||
while ((c = getopt(argc, argv, "f:A:a:b:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
if (curr_idx >= TRX_MAX_PARTS) {
|
||||
err = -ENOSPC;
|
||||
fprintf(stderr, "Reached TRX partitions limit, no place for %s\n", optarg);
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
sbytes = otrx_create_append_file(trx, optarg);
|
||||
if (sbytes < 0) {
|
||||
fprintf(stderr, "Failed to append file %s\n", optarg);
|
||||
} else {
|
||||
hdr.offset[curr_idx++] = curr_offset;
|
||||
curr_offset += sbytes;
|
||||
}
|
||||
|
||||
sbytes = otrx_create_align(trx, curr_offset, 4);
|
||||
if (sbytes < 0)
|
||||
fprintf(stderr, "Failed to append zeros\n");
|
||||
else
|
||||
curr_offset += sbytes;
|
||||
|
||||
break;
|
||||
case 'A':
|
||||
sbytes = otrx_create_append_file(trx, optarg);
|
||||
if (sbytes < 0) {
|
||||
fprintf(stderr, "Failed to append file %s\n", optarg);
|
||||
} else {
|
||||
curr_offset += sbytes;
|
||||
}
|
||||
|
||||
sbytes = otrx_create_align(trx, curr_offset, 4);
|
||||
if (sbytes < 0)
|
||||
fprintf(stderr, "Failed to append zeros\n");
|
||||
else
|
||||
curr_offset += sbytes;
|
||||
break;
|
||||
case 'a':
|
||||
sbytes = otrx_create_align(trx, curr_offset, strtol(optarg, NULL, 0));
|
||||
if (sbytes < 0)
|
||||
fprintf(stderr, "Failed to append zeros\n");
|
||||
else
|
||||
curr_offset += sbytes;
|
||||
break;
|
||||
case 'b':
|
||||
sbytes = strtol(optarg, NULL, 0) - curr_offset;
|
||||
if (sbytes < 0) {
|
||||
fprintf(stderr, "Current TRX length is 0x%zx, can't pad it with zeros to 0x%lx\n", curr_offset, strtol(optarg, NULL, 0));
|
||||
} else {
|
||||
sbytes = otrx_create_append_zeros(trx, sbytes);
|
||||
if (sbytes < 0)
|
||||
fprintf(stderr, "Failed to append zeros\n");
|
||||
else
|
||||
curr_offset += sbytes;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (err)
|
||||
break;
|
||||
}
|
||||
|
||||
sbytes = otrx_create_align(trx, curr_offset, 0x1000);
|
||||
if (sbytes < 0)
|
||||
fprintf(stderr, "Failed to append zeros\n");
|
||||
else
|
||||
curr_offset += sbytes;
|
||||
|
||||
hdr.length = curr_offset;
|
||||
otrx_create_write_hdr(trx, &hdr);
|
||||
err_close:
|
||||
fclose(trx);
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* Extract
|
||||
**************************************************/
|
||||
|
||||
static void otrx_extract_parse_options(int argc, char **argv) {
|
||||
int c;
|
||||
|
||||
while ((c = getopt(argc, argv, "c:e:o:1:2:3:")) != -1) {
|
||||
switch (c) {
|
||||
case 'o':
|
||||
trx_offset = atoi(optarg);
|
||||
break;
|
||||
case '1':
|
||||
partition[0] = optarg;
|
||||
break;
|
||||
case '2':
|
||||
partition[1] = optarg;
|
||||
break;
|
||||
case '3':
|
||||
partition[2] = optarg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int otrx_extract_copy(FILE *trx, size_t offset, size_t length, char *out_path) {
|
||||
FILE *out;
|
||||
size_t bytes;
|
||||
uint8_t *buf;
|
||||
int err = 0;
|
||||
|
||||
out = fopen(out_path, "w");
|
||||
if (!out) {
|
||||
fprintf(stderr, "Couldn't open %s\n", out_path);
|
||||
err = -EACCES;
|
||||
goto out;
|
||||
}
|
||||
|
||||
buf = malloc(length);
|
||||
if (!buf) {
|
||||
fprintf(stderr, "Couldn't alloc %zu B buffer\n", length);
|
||||
err = -ENOMEM;
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
fseek(trx, offset, SEEK_SET);
|
||||
bytes = fread(buf, 1, length, trx);
|
||||
if (bytes != length) {
|
||||
fprintf(stderr, "Couldn't read %zu B of data from %s\n", length, trx_path);
|
||||
err = -ENOMEM;
|
||||
goto err_free_buf;
|
||||
};
|
||||
|
||||
bytes = fwrite(buf, 1, length, out);
|
||||
if (bytes != length) {
|
||||
fprintf(stderr, "Couldn't write %zu B to %s\n", length, out_path);
|
||||
err = -ENOMEM;
|
||||
goto err_free_buf;
|
||||
}
|
||||
|
||||
printf("Extracted 0x%zx bytes into %s\n", length, out_path);
|
||||
|
||||
err_free_buf:
|
||||
free(buf);
|
||||
err_close:
|
||||
fclose(out);
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int otrx_extract(int argc, char **argv) {
|
||||
FILE *trx;
|
||||
struct trx_header hdr;
|
||||
size_t bytes;
|
||||
int i;
|
||||
int err = 0;
|
||||
|
||||
if (argc < 3) {
|
||||
fprintf(stderr, "No TRX file passed\n");
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
trx_path = argv[2];
|
||||
|
||||
optind = 3;
|
||||
otrx_extract_parse_options(argc, argv);
|
||||
|
||||
trx = fopen(trx_path, "r");
|
||||
if (!trx) {
|
||||
fprintf(stderr, "Couldn't open %s\n", trx_path);
|
||||
err = -EACCES;
|
||||
goto out;
|
||||
}
|
||||
|
||||
fseek(trx, trx_offset, SEEK_SET);
|
||||
bytes = fread(&hdr, 1, sizeof(hdr), trx);
|
||||
if (bytes != sizeof(hdr)) {
|
||||
fprintf(stderr, "Couldn't read %s header\n", trx_path);
|
||||
err = -EIO;
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
if (le32_to_cpu(hdr.magic) != TRX_MAGIC) {
|
||||
fprintf(stderr, "Invalid TRX magic: 0x%08x\n", le32_to_cpu(hdr.magic));
|
||||
err = -EINVAL;
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
for (i = 0; i < TRX_MAX_PARTS; i++) {
|
||||
size_t length;
|
||||
|
||||
if (!partition[i])
|
||||
continue;
|
||||
if (!hdr.offset[i]) {
|
||||
printf("TRX doesn't contain partition %d, can't extract %s\n", i + 1, partition[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i + 1 >= TRX_MAX_PARTS || !hdr.offset[i + 1])
|
||||
length = le32_to_cpu(hdr.length) - le32_to_cpu(hdr.offset[i]);
|
||||
else
|
||||
length = le32_to_cpu(hdr.offset[i + 1]) - le32_to_cpu(hdr.offset[i]);
|
||||
|
||||
otrx_extract_copy(trx, trx_offset + le32_to_cpu(hdr.offset[i]), length, partition[i]);
|
||||
}
|
||||
|
||||
err_close:
|
||||
fclose(trx);
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* Start
|
||||
**************************************************/
|
||||
|
||||
static void usage() {
|
||||
printf("Usage:\n");
|
||||
printf("\n");
|
||||
printf("Checking TRX file:\n");
|
||||
printf("\totrx check <file> [options]\tcheck if file is a valid TRX\n");
|
||||
printf("\t-o offset\t\t\toffset of TRX data in file (default: 0)\n");
|
||||
printf("\n");
|
||||
printf("Creating new TRX file:\n");
|
||||
printf("\totrx create <file> [options] [partitions]\n");
|
||||
printf("\t-f file\t\t\t\t[partition] start new partition with content copied from file\n");
|
||||
printf("\t-A file\t\t\t\t[partition] append current partition with content copied from file\n");
|
||||
printf("\t-a alignment\t\t\t[partition] align current partition\n");
|
||||
printf("\t-b offset\t\t\t[partition] append zeros to partition till reaching absolute offset\n");
|
||||
printf("\n");
|
||||
printf("Extracting from TRX file:\n");
|
||||
printf("\totrx extract <file> [options]\textract partitions from TRX file\n");
|
||||
printf("\t-o offset\t\t\toffset of TRX data in file (default: 0)\n");
|
||||
printf("\t-1 file\t\t\t\tfile to extract 1st partition to (optional)\n");
|
||||
printf("\t-2 file\t\t\t\tfile to extract 2nd partition to (optional)\n");
|
||||
printf("\t-3 file\t\t\t\tfile to extract 3rd partition to (optional)\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc > 1) {
|
||||
if (!strcmp(argv[1], "check"))
|
||||
return otrx_check(argc, argv);
|
||||
else if (!strcmp(argv[1], "create"))
|
||||
return otrx_create(argc, argv);
|
||||
else if (!strcmp(argv[1], "extract"))
|
||||
return otrx_extract(argc, argv);
|
||||
}
|
||||
|
||||
usage();
|
||||
return 0;
|
||||
}
|
||||
@ -8,15 +8,15 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=util-linux
|
||||
PKG_VERSION:=2.36.1
|
||||
PKG_RELEASE:=2
|
||||
PKG_VERSION:=2.37
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.36
|
||||
PKG_HASH:=09fac242172cd8ec27f0739d8d192402c69417617091d8c6e974841568f37eed
|
||||
PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.37
|
||||
PKG_HASH:=bd07b7e98839e0359842110525a3032fdb8eaf3a90bedde3dd1652d32d15cce5
|
||||
PKG_CPE_ID:=cpe:/a:kernel:util-linux
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:= COPYING \
|
||||
libblkid/COPYING \
|
||||
libmount/COPYING \
|
||||
|
||||
@ -18,7 +18,7 @@ DEFAULT_PACKAGES += \
|
||||
kmod-leds-gpio kmod-gpio-button-hotplug swconfig \
|
||||
kmod-ath10k wpad-openssl uboot-envtools \
|
||||
kmod-usb3 kmod-usb-dwc3 ath10k-firmware-qca4019 \
|
||||
autocore-arm automount autosamba shadowsocksr-libev-server \
|
||||
autocore-arm automount autosamba \
|
||||
luci-app-zerotier openssh-sftp-server \
|
||||
e2fsprogs ethtool htop
|
||||
|
||||
|
||||
@ -19,9 +19,9 @@ KERNELNAME:=bzImage
|
||||
include $(INCLUDE_DIR)/target.mk
|
||||
|
||||
DEFAULT_PACKAGES += partx-utils mkf2fs fdisk e2fsprogs wpad kmod-usb-hid kmod-ath5k kmod-ath9k kmod-ath9k-htc kmod-ath10k \
|
||||
kmod-rt2800-usb kmod-e1000e kmod-igb kmod-igbvf kmod-ixgbe kmod-pcnet32 kmod-tulip kmod-vmxnet3 kmod-i40e kmod-iavf kmod-r8125 kmod-r8168 kmod-8139cp kmod-8139too kmod-fs-f2fs \
|
||||
htop lm-sensors autocore-x86 automount autosamba luci-app-ipsec-vpnd luci-proto-bonding luci-app-xlnetacc luci-app-unblockmusic luci-app-zerotier openssh-sftp-server \
|
||||
ath10k-firmware-qca988x ath10k-firmware-qca9888 ath10k-firmware-qca9984 brcmfmac-firmware-43602a1-pcie ca-certificates ddns-scripts_aliyun ddns-scripts_dnspod \
|
||||
kmod-rt2800-usb kmod-e1000e kmod-igb kmod-igbvf kmod-ixgbe kmod-pcnet32 kmod-tulip kmod-vmxnet3 kmod-i40e kmod-iavf kmod-r8125 kmod-r8168 kmod-8139cp kmod-8139too \
|
||||
kmod-fs-f2fs htop lm-sensors autocore-x86 automount autosamba luci-app-ipsec-vpnd luci-proto-bonding luci-app-unblockmusic luci-app-zerotier openssh-sftp-server \
|
||||
ath10k-firmware-qca988x ath10k-firmware-qca9888 ath10k-firmware-qca9984 brcmfmac-firmware-43602a1-pcie ddns-scripts_aliyun ddns-scripts_dnspod \
|
||||
kmod-sound-hda-core kmod-sound-hda-codec-realtek kmod-sound-hda-codec-via kmod-sound-via82xx kmod-sound-hda-intel kmod-sound-hda-codec-hdmi kmod-sound-i8x0 kmod-usb-audio \
|
||||
kmod-usb-net kmod-usb-net-asix kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8150 kmod-usb-net-rtl8152 kmod-mlx4-core kmod-mlx5-core
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ config GCC_VERSION
|
||||
default "7.5.0" if GCC_VERSION_7
|
||||
default "9.3.0" if GCC_VERSION_9
|
||||
default "10.3.0" if GCC_VERSION_10
|
||||
default "11.1.0" if GCC_VERSION_11
|
||||
default "11.2.0" if GCC_VERSION_11
|
||||
default "8.4.0"
|
||||
|
||||
config GCC_USE_IREMAP
|
||||
|
||||
@ -44,8 +44,8 @@ ifeq ($(PKG_VERSION),10.3.0)
|
||||
PKG_HASH:=64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344
|
||||
endif
|
||||
|
||||
ifeq ($(PKG_VERSION),11.1.0)
|
||||
PKG_HASH:=4c4a6fb8a8396059241c2e674b85b351c26a5d678274007f076957afa1cc9ddf
|
||||
ifeq ($(PKG_VERSION),11.2.0)
|
||||
PKG_HASH:=d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b
|
||||
endif
|
||||
|
||||
PATCH_DIR=../patches/$(GCC_VERSION)
|
||||
|
||||
@ -114,7 +114,7 @@ Date: Tue Jul 31 00:52:27 2007 +0000
|
||||
; On SVR4 targets, it also controls whether or not to emit a
|
||||
--- a/gcc/doc/invoke.texi
|
||||
+++ b/gcc/doc/invoke.texi
|
||||
@@ -9054,6 +9054,17 @@ This option is only supported for C and
|
||||
@@ -9055,6 +9055,17 @@ This option is only supported for C and
|
||||
@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
|
||||
@option{-Wno-pointer-sign}.
|
||||
|
||||
@ -7,7 +7,7 @@ Date: Sat Apr 21 03:02:39 2012 +0000
|
||||
|
||||
--- a/gcc/gcc.c
|
||||
+++ b/gcc/gcc.c
|
||||
@@ -10090,8 +10090,10 @@ getenv_spec_function (int argc, const ch
|
||||
@@ -10100,8 +10100,10 @@ getenv_spec_function (int argc, const ch
|
||||
}
|
||||
|
||||
if (!value)
|
||||
Loading…
Reference in New Issue
Block a user