mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 14:23:38 +00:00
Merge pull request #10310 from lovehackintosh/bump-tools
This commit is contained in:
commit
144c1fb2f3
@ -19,7 +19,6 @@
|
||||
#
|
||||
# Host packages are built in the same fashion, just use these vars instead:
|
||||
#
|
||||
# HOST_BUILD_DEPENDS:=meson/host
|
||||
# MESON_HOST_ARGS+=-Dfoo -Dbar=baz
|
||||
# MESON_HOST_VARS+=FOO=bar
|
||||
|
||||
@ -57,7 +56,7 @@ MESON_CPU:="$(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))"
|
||||
endif
|
||||
|
||||
define Meson
|
||||
$(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(MESON_DIR)/meson.py $(1)
|
||||
$(2) $(STAGING_DIR_HOST)/bin/$(PYTHON) $(STAGING_DIR_HOST)/bin/meson.py $(1)
|
||||
endef
|
||||
|
||||
define Meson/CreateNativeFile
|
||||
@ -101,7 +100,7 @@ define Host/Configure/Meson
|
||||
--native-file $(HOST_BUILD_DIR)/openwrt-native.txt \
|
||||
$(MESON_HOST_ARGS) \
|
||||
$(MESON_HOST_BUILD_DIR) \
|
||||
$(HOST_BUILD_DIR), \
|
||||
$(MESON_HOST_BUILD_DIR)/.., \
|
||||
$(MESON_HOST_VARS))
|
||||
endef
|
||||
|
||||
|
@ -22,50 +22,50 @@ ifneq ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_PACKAGE_b43legacy-firmwar
|
||||
endif
|
||||
|
||||
tools-y += autoconf autoconf-archive automake bc bison cmake cpio dosfstools
|
||||
tools-y += e2fsprogs fakeroot findutils firmware-utils flex gengetopt
|
||||
tools-y += e2fsprogs expat fakeroot findutils firmware-utils flex gengetopt
|
||||
tools-y += libressl libtool lzma m4 make-ext4fs meson missing-macros mkimage
|
||||
tools-y += mklibs mm-macros mtd-utils mtools ninja padjffs2 patch-image
|
||||
tools-y += mklibs mtd-utils mtools ninja padjffs2 patch-image
|
||||
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 mpc mpfr
|
||||
tools-$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini) += genext2fs
|
||||
tools-$(CONFIG_TARGET_ath79) += lzma-old squashfs
|
||||
tools-$(CONFIG_TARGET_mxs) += elftosb sdimage
|
||||
tools-$(CONFIG_TARGET_realtek) += 7z
|
||||
tools-$(CONFIG_TARGET_tegra) += cbootimage cbootimage-configs
|
||||
tools-$(CONFIG_USES_MINOR) += kernel2minor
|
||||
tools-$(CONFIG_USE_SPARSE) += sparse
|
||||
tools-$(CONFIG_USE_LLVM_BUILD) += llvm-bpf
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_B43_TOOLS),y) += b43-tools
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_ISL),y) += isl
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_TOOLCHAIN),y) += gmp mpc mpfr
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini),y) += genext2fs
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_ath79),y) += lzma-old squashfs
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_mxs),y) += elftosb sdimage
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_realtek),y) += 7z
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_tegra),y) += cbootimage cbootimage-configs
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USES_MINOR),y) += kernel2minor
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_SPARSE),y) += sparse
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_USE_LLVM_BUILD),y) += llvm-bpf
|
||||
|
||||
# builddir dependencies
|
||||
$(curdir)/autoconf/compile := $(curdir)/m4/compile
|
||||
$(curdir)/automake/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/pkgconf/compile $(curdir)/xz/compile
|
||||
$(curdir)/automake/compile := $(curdir)/autoconf/compile $(curdir)/pkgconf/compile $(curdir)/xz/compile
|
||||
$(curdir)/b43-tools/compile := $(curdir)/bison/compile
|
||||
$(curdir)/bc/compile := $(curdir)/bison/compile $(curdir)/libtool/compile
|
||||
$(curdir)/upx/compile := $(curdir)/ucl/compile
|
||||
$(curdir)/bison/compile := $(curdir)/flex/compile
|
||||
$(curdir)/cbootimage/compile += $(curdir)/automake/compile
|
||||
$(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile
|
||||
$(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile
|
||||
$(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile $(curdir)/expat/compile $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/zstd/compile
|
||||
$(curdir)/dosfstools/compile := $(curdir)/automake/compile
|
||||
$(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/fakeroot/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/findutils/compile := $(curdir)/bison/compile
|
||||
$(curdir)/firmware-utils/compile += $(curdir)/cmake/compile $(curdir)/zlib/compile
|
||||
$(curdir)/firmware-utils/compile += $(curdir)/cmake/compile
|
||||
$(curdir)/flex/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/genext2fs/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/gengetopt/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/gmp/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/isl/compile := $(curdir)/gmp/compile
|
||||
$(curdir)/libressl/compile := $(curdir)/pkgconf/compile
|
||||
$(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
|
||||
$(curdir)/libtool/compile := $(curdir)/automake/compile $(curdir)/missing-macros/compile
|
||||
$(curdir)/lzma-old/compile := $(curdir)/zlib/compile
|
||||
$(curdir)/llvm-bpf/compile := $(curdir)/cmake/compile
|
||||
$(curdir)/meson/compile := $(curdir)/ninja/compile
|
||||
$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
|
||||
$(curdir)/meson/compile := $(curdir)/ninja/compile
|
||||
$(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
|
||||
$(curdir)/mkimage/compile += $(curdir)/libressl/compile
|
||||
$(curdir)/mkimage/compile += $(curdir)/bison/compile $(curdir)/libressl/compile
|
||||
$(curdir)/mklibs/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/mm-macros/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/mpc/compile := $(curdir)/mpfr/compile $(curdir)/gmp/compile
|
||||
$(curdir)/mpfr/compile := $(curdir)/gmp/compile
|
||||
$(curdir)/mtd-utils/compile := $(curdir)/libtool/compile $(curdir)/e2fsprogs/compile $(curdir)/zlib/compile
|
||||
@ -76,8 +76,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)/zlib/compile := $(curdir)/cmake/compile
|
||||
$(curdir)/zstd/compile := $(curdir)/cmake/compile
|
||||
$(curdir)/zstd/compile := $(curdir)/meson/compile
|
||||
|
||||
ifneq ($(HOST_OS),Linux)
|
||||
$(curdir)/squashfskit4/compile += $(curdir)/coreutils/compile
|
||||
@ -88,14 +87,14 @@ ifeq ($(HOST_OS),Darwin)
|
||||
else
|
||||
$(curdir)/dwarves/compile += $(curdir)/elfutils/compile
|
||||
$(curdir)/elfutils/compile := $(curdir)/m4/compile $(curdir)/zlib/compile
|
||||
tools-$(CONFIG_DWARVES) += dwarves
|
||||
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_DWARVES),y) += dwarves
|
||||
tools-y += elfutils
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),)
|
||||
$(foreach tool, $(filter-out xz zstd pkgconf patch ninja meson libressl cmake,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile))
|
||||
$(foreach tool, $(filter-out zstd zlib xz pkgconf patch ninja meson libressl expat cmake,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile))
|
||||
tools-y += ccache
|
||||
$(curdir)/ccache/compile := $(curdir)/zstd/compile
|
||||
$(curdir)/ccache/compile := $(curdir)/cmake/compile
|
||||
endif
|
||||
|
||||
# in case there is no patch tool on the host we need to make patch tool a
|
||||
@ -136,6 +135,9 @@ define PrepareStaging
|
||||
); done
|
||||
endef
|
||||
|
||||
$(BIN_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
# preparatory work
|
||||
$(STAGING_DIR)/.prepared: $(TMP_DIR)/.build
|
||||
$(call PrepareStaging,$(STAGING_DIR))
|
||||
@ -156,16 +158,15 @@ endif
|
||||
|
||||
endif
|
||||
|
||||
$(curdir)//prepare = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared
|
||||
$(curdir)//compile = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared
|
||||
$(curdir)//prepare = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $(BIN_DIR)
|
||||
$(curdir)//compile = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $(BIN_DIR)
|
||||
|
||||
# prerequisites for the individual targets
|
||||
$(curdir)/ := .config prereq
|
||||
|
||||
$(curdir)/install: $(curdir)/compile
|
||||
|
||||
tools_config = CONFIG_SDK_LLVM_BPF
|
||||
tools_enabled = $(foreach tool,$(sort $(tools-y) $(tools-)),$(if $(filter $(tool),$(tools-y)),y,n))$(foreach c,$(tools_config),$(if $($(c)),y,n))
|
||||
tools_enabled = $(foreach tool,$(sort $(tools-y) $(tools-)),$(if $(filter $(tool),$(tools-y)),y,n))
|
||||
$(eval $(call stampfile,$(curdir),tools,compile,,_$(subst $(space),,$(tools_enabled)),$(STAGING_DIR_HOST)))
|
||||
$(eval $(call stampfile,$(curdir),tools,check,$(TMP_DIR)/.build,,$(STAGING_DIR_HOST)))
|
||||
$(eval $(call subdir,$(curdir)))
|
||||
|
@ -43,9 +43,8 @@ define Host/Install
|
||||
ln -sf aclocal $(STAGING_DIR_HOST)/bin/aclocal-1.15
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
|
||||
$(call Host/Clean/Default)
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -8,14 +8,18 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bash
|
||||
PKG_CPE_ID:=cpe:/a:gnu:bash
|
||||
PKG_VERSION:=5.1.16
|
||||
PKG_VERSION:=5.2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@GNU/bash
|
||||
PKG_HASH:=5bac17218d3911834520dad13cd1f85ab944e1c09ae1aba55906be1f8192f558
|
||||
PKG_HASH:=a139c166df7ff4471c5e0733051642ee5556c1cc8a4a78f145583c5c81ab32fb
|
||||
|
||||
HOST_BUILD_PARALLEL := 1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -7,15 +7,19 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bc
|
||||
PKG_VERSION:=1.07
|
||||
PKG_VERSION:=1.07.1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@GNU/bc
|
||||
PKG_HASH:=55cf1fc33a728d7c3d386cc7b0cb556eb5bacf8e0cb5a3fcca7f109fc61205ad
|
||||
PKG_HASH:=62adfca89b0a1c0164c2cdca59ca210c1d44c3ffc46daf9931cf4942664cb02a
|
||||
|
||||
PKG_FIXUP := autoreconf
|
||||
PKG_CPE_ID:=cpe:/a:gnu:bc
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -10,7 +10,7 @@
|
||||
-w
|
||||
-q
|
||||
-EOS-EOS
|
||||
+#! /bin/bash
|
||||
+#!/usr/bin/env bash
|
||||
+sed -e '1 s/^/{"/' \
|
||||
+ -e 's/$/",/' \
|
||||
+ -e '2,$ s/^/"/' \
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- a/bc/execute.c
|
||||
+++ b/bc/execute.c
|
||||
@@ -595,7 +595,7 @@ input_char (void)
|
||||
if (in_ch == '.' || in_ch == '+' || in_ch == '-')
|
||||
return (in_ch);
|
||||
if (in_ch <= ' ')
|
||||
- return (' ');
|
||||
+ return (':');
|
||||
|
||||
return (':');
|
||||
}
|
@ -19,14 +19,14 @@ include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
HOST_CONFIGURE_ARGS += --enable-threads=posix --disable-nls
|
||||
|
||||
define Host/Clean
|
||||
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
|
||||
$(call Host/Clean/Default)
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(call Host/Install/Default)
|
||||
$(INSTALL_BIN) ./scripts/yacc $(STAGING_DIR_HOST)/bin/yacc
|
||||
endef
|
||||
|
||||
define Host/Uninstall
|
||||
rm -f $(STAGING_DIR_HOST)/bin/yacc
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -32,8 +32,14 @@ HOST_CONFIGURE_VARS += \
|
||||
HOST_CONFIGURE_ARGS := \
|
||||
$(if $(MAKE_JOBSERVER),--parallel="$(MAKE_JOBSERVER)") \
|
||||
--prefix="$(STAGING_DIR_HOST)" \
|
||||
--system-expat \
|
||||
--system-liblzma \
|
||||
--system-zlib \
|
||||
--system-zstd \
|
||||
--generator=Ninja
|
||||
|
||||
HOST_LDFLAGS += -Wl,-rpath,$(STAGING_DIR_HOST)/lib
|
||||
|
||||
define Host/Compile/Default
|
||||
+$(NINJA) -C $(HOST_BUILD_DIR) $(1)
|
||||
endef
|
||||
|
17
tools/cmake/patches/110-liblzma.patch
Normal file
17
tools/cmake/patches/110-liblzma.patch
Normal file
@ -0,0 +1,17 @@
|
||||
--- a/Modules/FindLibLZMA.cmake
|
||||
+++ b/Modules/FindLibLZMA.cmake
|
||||
@@ -43,7 +43,13 @@ This module will set the following varia
|
||||
version number as a string (ex: "5.0.3")
|
||||
#]=======================================================================]
|
||||
|
||||
-find_path(LIBLZMA_INCLUDE_DIR lzma.h )
|
||||
+if(UNIX)
|
||||
+ find_package(PkgConfig QUIET)
|
||||
+ pkg_search_module(PC_liblzma liblzma)
|
||||
+endif()
|
||||
+
|
||||
+find_path(LIBLZMA_INCLUDE_DIR lzma.h HINTS ${PC_liblzma_INCLUDEDIR} ${PC_liblzma_INCLUDE_DIRS})
|
||||
+find_library(LIBLZMA_LIBRARY NAMES lzma HINTS ${PC_liblzma_LIBDIR} ${PC_liblzma_LIBRARY_DIRS})
|
||||
if(NOT LIBLZMA_LIBRARY)
|
||||
find_library(LIBLZMA_LIBRARY_RELEASE NAMES lzma liblzma NAMES_PER_DIR PATH_SUFFIXES lib)
|
||||
find_library(LIBLZMA_LIBRARY_DEBUG NAMES lzmad liblzmad NAMES_PER_DIR PATH_SUFFIXES lib)
|
@ -20,7 +20,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
||||
---
|
||||
--- a/Utilities/cmcurl/CMakeLists.txt
|
||||
+++ b/Utilities/cmcurl/CMakeLists.txt
|
||||
@@ -565,6 +565,14 @@ if(CMAKE_USE_OPENSSL)
|
||||
@@ -594,6 +594,14 @@ if(CURL_USE_OPENSSL)
|
||||
endif()
|
||||
set(SSL_ENABLED ON)
|
||||
set(USE_OPENSSL ON)
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/bootstrap
|
||||
+++ b/bootstrap
|
||||
@@ -1423,7 +1423,10 @@ int main(){ printf("1%c", (char)0x0a); r
|
||||
@@ -1441,7 +1441,10 @@ int main(){ printf("1%c", (char)0x0a); r
|
||||
' > "test.c"
|
||||
cmake_original_make_flags="${cmake_make_flags}"
|
||||
if test "x${cmake_parallel_make}" != "x"; then
|
||||
|
20
tools/cmake/patches/140-zlib.patch
Normal file
20
tools/cmake/patches/140-zlib.patch
Normal file
@ -0,0 +1,20 @@
|
||||
--- a/Modules/FindZLIB.cmake
|
||||
+++ b/Modules/FindZLIB.cmake
|
||||
@@ -85,10 +85,13 @@ else()
|
||||
set(ZLIB_NAMES_DEBUG zd zlibd zdlld zlibd1 zlib1d zlibstaticd zlibwapid zlibvcd zlibstatd)
|
||||
endif()
|
||||
|
||||
-# Try each search configuration.
|
||||
-foreach(search ${_ZLIB_SEARCHES})
|
||||
- find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
|
||||
-endforeach()
|
||||
+if(UNIX)
|
||||
+ find_package(PkgConfig QUIET)
|
||||
+ pkg_search_module(PC_zlib zlib)
|
||||
+endif()
|
||||
+
|
||||
+find_path(ZLIB_INCLUDE_DIR zlib.h HINTS ${PC_zlib_INCLUDEDIR} ${PC_zlib_INCLUDE_DIRS})
|
||||
+find_library(ZLIB_LIBRARY NAMES z HINTS ${PC_zlib_LIBDIR} ${PC_zlib_LIBRARY_DIRS})
|
||||
|
||||
# Allow ZLIB_LIBRARY to be set manually, as the location of the zlib library
|
||||
if(NOT ZLIB_LIBRARY)
|
18
tools/cmake/patches/150-zstd-libarchive.patch
Normal file
18
tools/cmake/patches/150-zstd-libarchive.patch
Normal file
@ -0,0 +1,18 @@
|
||||
--- a/Utilities/cmlibarchive/CMakeLists.txt
|
||||
+++ b/Utilities/cmlibarchive/CMakeLists.txt
|
||||
@@ -630,8 +630,13 @@ IF(ENABLE_ZSTD)
|
||||
SET(ZSTD_FIND_QUIETLY TRUE)
|
||||
ENDIF (ZSTD_INCLUDE_DIR)
|
||||
|
||||
- FIND_PATH(ZSTD_INCLUDE_DIR zstd.h)
|
||||
- FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd)
|
||||
+ IF(UNIX)
|
||||
+ FIND_PACKAGE(PkgConfig QUIET)
|
||||
+ PKG_SEARCH_MODULE(PC_ZSTD libzstd)
|
||||
+ ENDIF()
|
||||
+
|
||||
+ FIND_PATH(ZSTD_INCLUDE_DIR zstd.h HINTS ${PC_ZSTD_INCLUDEDIR} ${PC_ZSTD_INCLUDE_DIRS})
|
||||
+ FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd HINTS ${PC_ZSTD_LIBDIR} ${PC_ZSTD_LIBRARY_DIRS})
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
|
||||
ELSE(ENABLE_ZSTD)
|
@ -35,4 +35,9 @@ define Host/Install
|
||||
ln -sf ginstall $(1)/bin/install
|
||||
endef
|
||||
|
||||
define Host/Uninstall
|
||||
rm -f $(STAGING_DIR_HOST)/bin/install
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -11,4 +11,8 @@ PKG_HASH:=eab5bdc5ae1df285c59f2a4f140a98fc33678a0bf61bdba67d9436ae26b46f6d
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -4,8 +4,6 @@ https://git.savannah.gnu.org/cgit/cpio.git/commit/?id=641d3f489cf6238bb916368d4b
|
||||
|
||||
* src/global.c: Remove superfluous declaration of program_name
|
||||
|
||||
diff --git a/src/global.c b/src/global.c
|
||||
index fb3abe9..acf92bc 100644
|
||||
--- a/src/global.c
|
||||
+++ b/src/global.c
|
||||
@@ -184,9 +184,6 @@ unsigned int warn_option = 0;
|
||||
|
11
tools/cpio/patches/010-clang.patch
Normal file
11
tools/cpio/patches/010-clang.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- a/gnu/xalloc-oversized.h
|
||||
+++ b/gnu/xalloc-oversized.h
|
||||
@@ -52,7 +52,7 @@ typedef size_t __xalloc_count_type;
|
||||
#elif ((5 <= __GNUC__ \
|
||||
|| (__has_builtin (__builtin_mul_overflow) \
|
||||
&& __has_builtin (__builtin_constant_p))) \
|
||||
- && !__STRICT_ANSI__)
|
||||
+ && !__STRICT_ANSI__) && !defined(__clang__)
|
||||
# define xalloc_oversized(n, s) \
|
||||
(__builtin_constant_p (n) && __builtin_constant_p (s) \
|
||||
? __xalloc_oversized (n, s) \
|
@ -24,4 +24,8 @@ ifeq ($(HOST_OS),Darwin)
|
||||
HOST_CFLAGS += -UHAVE_ENDIAN_H
|
||||
endif
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -3,11 +3,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dwarves
|
||||
PKG_VERSION:=1.24
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://fedorapeople.org/~acme/dwarves/
|
||||
PKG_HASH:=576bc112b95937dfbcd347c423696ee9e1992a338fdca1acacca736fd95f69c2
|
||||
|
||||
PKG_SOURCE_VERSION:=v1.23
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/devel/pahole/pahole.git
|
||||
PKG_MIRROR_HASH:=6ab1bb1dbdf6c73ffcf485d909229dc1da1a3d24efd213e92c56489b58d6a4bd
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
|
@ -30,4 +30,8 @@ HOST_CONFIGURE_ARGS += \
|
||||
HOST_MAKE_FLAGS += \
|
||||
SUBDIRS="lib libelf libcpu backends libebl libdwelf libdwfl libdw"
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -11,19 +11,23 @@ PKG_NAME:=expat
|
||||
PKG_CPE_ID:=cpe:/a:libexpat:expat
|
||||
PKG_VERSION:=2.4.9
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_HASH:=7f44d1469b110773a94b0d5abeeeffaef79f8bd6406b07e52394bcf48126437a
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_HASH:=6e8c0728fe5c7cd3f93a6acce43046c5e4736c7b4b68e032e9350daa0efc0354
|
||||
PKG_SOURCE_URL:=https://github.com/libexpat/libexpat/releases/download/R_$(subst .,_,$(PKG_VERSION))
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--without-docbook
|
||||
HOSTCC := $(HOSTCC_NOCACHE)
|
||||
|
||||
define Host/Install
|
||||
$(MAKE) -C $(HOST_BUILD_DIR) install
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--disable-shared \
|
||||
--without-docbook \
|
||||
--with-pic
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
@ -25,4 +25,8 @@ HOST_CONFIGURE_VARS += \
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--with-ipc=tcp
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -28,4 +28,8 @@ HOST_CONFIGURE_ARGS += \
|
||||
--disable-nls \
|
||||
--without-selinux
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -26,8 +26,12 @@ define Host/Install
|
||||
$(LN) flex $(STAGING_DIR_HOST)/bin/lex
|
||||
endef
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
|
||||
rm -f $(STAGING_DIR_HOST)/bin/lex
|
||||
$(call Host/Clean/Default)
|
||||
endef
|
||||
|
||||
|
@ -24,4 +24,8 @@ define Host/Install
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/flock $(STAGING_DIR_HOST)/bin/
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/flock
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -8,11 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=genext2fs
|
||||
PKG_VERSION:=1.4.1
|
||||
PKG_VERSION:=1.5.0
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@SF/genext2fs
|
||||
PKG_HASH:=404dbbfa7a86a6c3de8225c8da254d026b17fd288e05cec4df2cc7e1f4feecfc
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/bestouff/$(PKG_NAME)/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=d3861e4fe89131bd21fbd25cf0b683b727b5c030c4c336fadcd738ada830aab0
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
@ -33,6 +33,13 @@ HOST_CONFIGURE_ARGS = \
|
||||
--mandir=/usr/man \
|
||||
--infodir=/usr/info \
|
||||
|
||||
define Host/Configure
|
||||
(cd $(HOST_BUILD_DIR); \
|
||||
./autogen.sh \
|
||||
);
|
||||
$(call Host/Configure/Default)
|
||||
endef
|
||||
|
||||
define Host/Compile
|
||||
$(MAKE) -C $(HOST_BUILD_DIR) \
|
||||
CFLAGS="$(HOST_CFLAGS)" \
|
||||
|
@ -1,21 +0,0 @@
|
||||
commit 3b8ca0ce9a0b58287a780747c90c449bdebfe464
|
||||
Author: Xavier Bestel <bestouff@users.sourceforge.net>
|
||||
Date: Mon Jan 14 08:52:44 2008 +0000
|
||||
|
||||
removed use of %as is scanf (GNU conflicts with C99) by Giacomo Catenazzi <cate@debian.org>
|
||||
|
||||
diff --git a/genext2fs.c b/genext2fs.c
|
||||
index 070b270..f0d797d 100644
|
||||
--- a/genext2fs.c
|
||||
+++ b/genext2fs.c
|
||||
@@ -286,7 +286,9 @@ typedef unsigned int uint32;
|
||||
// older solaris. Note that this is still not very portable, in that
|
||||
// the return value cannot be trusted.
|
||||
|
||||
-#if SCANF_CAN_MALLOC
|
||||
+#if 0 // SCANF_CAN_MALLOC
|
||||
+// C99 define "a" for floating point, so you can have runtime surprise
|
||||
+// according the library versions
|
||||
# define SCANF_PREFIX "a"
|
||||
# define SCANF_STRING(s) (&s)
|
||||
#else
|
@ -1,13 +0,0 @@
|
||||
Index: genext2fs/m4/ac_func_scanf_can_malloc.m4
|
||||
===================================================================
|
||||
--- genext2fs.orig/m4/ac_func_scanf_can_malloc.m4 2011-09-03 21:28:49.000000000 +0200
|
||||
+++ genext2fs/m4/ac_func_scanf_can_malloc.m4 2011-09-03 21:29:41.000000000 +0200
|
||||
@@ -9,7 +9,7 @@
|
||||
# --------------------------------------
|
||||
AC_DEFUN([AC_FUNC_SCANF_CAN_MALLOC],
|
||||
[ AC_CHECK_HEADERS([stdlib.h])
|
||||
- AC_CACHE_CHECK([whether scanf can malloc], [ac_scanf_can_malloc],
|
||||
+ AC_CACHE_CHECK([whether scanf can malloc], [ac_cv_func_scanf_can_malloc],
|
||||
[ AC_RUN_IFELSE(
|
||||
[ AC_LANG_PROGRAM(
|
||||
[
|
@ -1,558 +0,0 @@
|
||||
Index: genext2fs/genext2fs.c
|
||||
===================================================================
|
||||
--- genext2fs.orig/genext2fs.c 2011-09-03 14:21:17.000000000 +0200
|
||||
+++ genext2fs/genext2fs.c 2011-09-03 14:21:17.000000000 +0200
|
||||
@@ -151,13 +151,24 @@
|
||||
|
||||
// block size
|
||||
|
||||
-#define BLOCKSIZE 1024
|
||||
+static int blocksize = 1024;
|
||||
+
|
||||
+#define BLOCKSIZE blocksize
|
||||
#define BLOCKS_PER_GROUP 8192
|
||||
#define INODES_PER_GROUP 8192
|
||||
/* Percentage of blocks that are reserved.*/
|
||||
#define RESERVED_BLOCKS 5/100
|
||||
#define MAX_RESERVED_BLOCKS 25/100
|
||||
|
||||
+/* The default value for s_creator_os. */
|
||||
+#if defined(__GNU__)
|
||||
+# define CREATOR_OS 1 /* Hurd */
|
||||
+#elif defined(__FreeBSD__)
|
||||
+# define CREATOR_OS 3 /* FreeBSD */
|
||||
+#else
|
||||
+# define CREATOR_OS 0 /* Linux */
|
||||
+#endif
|
||||
+
|
||||
|
||||
// inode block size (why is it != BLOCKSIZE ?!?)
|
||||
/* The field i_blocks in the ext2 inode stores the number of data blocks
|
||||
@@ -239,10 +250,10 @@
|
||||
(fs)->sb.s_blocks_per_group - 1) / (fs)->sb.s_blocks_per_group)
|
||||
|
||||
// Get group block bitmap (bbm) given the group number
|
||||
-#define GRP_GET_GROUP_BBM(fs,grp) ( get_blk((fs),(fs)->gd[(grp)].bg_block_bitmap) )
|
||||
+#define GRP_GET_GROUP_BBM(fs,grp) ( get_blk((fs), get_gd((fs),(grp))->bg_block_bitmap) )
|
||||
|
||||
// Get group inode bitmap (ibm) given the group number
|
||||
-#define GRP_GET_GROUP_IBM(fs,grp) ( get_blk((fs),(fs)->gd[(grp)].bg_inode_bitmap) )
|
||||
+#define GRP_GET_GROUP_IBM(fs,grp) ( get_blk((fs), get_gd((fs),(grp))->bg_inode_bitmap) )
|
||||
|
||||
// Given an inode number find the group it belongs to
|
||||
#define GRP_GROUP_OF_INODE(fs,nod) ( ((nod)-1) / (fs)->sb.s_inodes_per_group)
|
||||
@@ -532,7 +543,7 @@
|
||||
char d_name[0];
|
||||
} directory;
|
||||
|
||||
-typedef uint8 block[BLOCKSIZE];
|
||||
+typedef uint8 *block;
|
||||
|
||||
/* blockwalker fields:
|
||||
The blockwalker is used to access all the blocks of a file (including
|
||||
@@ -571,16 +582,12 @@
|
||||
|
||||
|
||||
/* Filesystem structure that support groups */
|
||||
-#if BLOCKSIZE == 1024
|
||||
typedef struct
|
||||
{
|
||||
- block zero; // The famous block 0
|
||||
- superblock sb; // The superblock
|
||||
- groupdescriptor gd[0]; // The group descriptors
|
||||
+ uint8 zero[1024]; // Room for bootloader stuff
|
||||
+ superblock sb; // The superblock, always at 1024
|
||||
+ // group descriptors come next, see get_gd() below
|
||||
} filesystem;
|
||||
-#else
|
||||
-#error UNHANDLED BLOCKSIZE
|
||||
-#endif
|
||||
|
||||
// now the endianness swap
|
||||
|
||||
@@ -820,6 +827,14 @@
|
||||
return (uint8*)fs + blk*BLOCKSIZE;
|
||||
}
|
||||
|
||||
+// the group descriptors are aligned on the block size
|
||||
+static inline groupdescriptor *
|
||||
+get_gd(filesystem *fs, int no)
|
||||
+{
|
||||
+ int gdblk = (sizeof (filesystem) + BLOCKSIZE - 1) / BLOCKSIZE;
|
||||
+ return ((groupdescriptor *) get_blk(fs, gdblk)) + no;
|
||||
+}
|
||||
+
|
||||
// return a given inode from a filesystem
|
||||
static inline inode *
|
||||
get_nod(filesystem *fs, uint32 nod)
|
||||
@@ -829,7 +844,7 @@
|
||||
|
||||
offset = GRP_IBM_OFFSET(fs,nod);
|
||||
grp = GRP_GROUP_OF_INODE(fs,nod);
|
||||
- itab = (inode *)get_blk(fs, fs->gd[grp].bg_inode_table);
|
||||
+ itab = (inode *)get_blk(fs, get_gd(fs,grp)->bg_inode_table);
|
||||
return itab+offset-1;
|
||||
}
|
||||
|
||||
@@ -875,18 +890,18 @@
|
||||
|
||||
grp = GRP_GROUP_OF_INODE(fs,nod);
|
||||
nbgroups = GRP_NBGROUPS(fs);
|
||||
- if(!(bk = allocate(get_blk(fs,fs->gd[grp].bg_block_bitmap), 0))) {
|
||||
+ if(!(bk = allocate(GRP_GET_GROUP_BBM(fs, grp), 0))) {
|
||||
for(grp=0;grp<nbgroups && !bk;grp++)
|
||||
- bk=allocate(get_blk(fs,fs->gd[grp].bg_block_bitmap),0);
|
||||
+ bk = allocate(GRP_GET_GROUP_BBM(fs, grp), 0);
|
||||
grp--;
|
||||
}
|
||||
if (!bk)
|
||||
error_msg_and_die("couldn't allocate a block (no free space)");
|
||||
- if(!(fs->gd[grp].bg_free_blocks_count--))
|
||||
+ if(!(get_gd(fs, grp)->bg_free_blocks_count--))
|
||||
error_msg_and_die("group descr %d. free blocks count == 0 (corrupted fs?)",grp);
|
||||
if(!(fs->sb.s_free_blocks_count--))
|
||||
error_msg_and_die("superblock free blocks count == 0 (corrupted fs?)");
|
||||
- return fs->sb.s_blocks_per_group*grp + bk;
|
||||
+ return fs->sb.s_first_data_block + fs->sb.s_blocks_per_group*grp + (bk-1);
|
||||
}
|
||||
|
||||
// free a block
|
||||
@@ -897,8 +912,8 @@
|
||||
|
||||
grp = bk / fs->sb.s_blocks_per_group;
|
||||
bk %= fs->sb.s_blocks_per_group;
|
||||
- deallocate(get_blk(fs,fs->gd[grp].bg_block_bitmap), bk);
|
||||
- fs->gd[grp].bg_free_blocks_count++;
|
||||
+ deallocate(GRP_GET_GROUP_BBM(fs, grp), bk);
|
||||
+ get_gd(fs, grp)->bg_free_blocks_count++;
|
||||
fs->sb.s_free_blocks_count++;
|
||||
}
|
||||
|
||||
@@ -918,16 +933,16 @@
|
||||
/* We do it for all inodes. */
|
||||
avefreei = fs->sb.s_free_inodes_count / nbgroups;
|
||||
for(grp=0; grp<nbgroups; grp++) {
|
||||
- if (fs->gd[grp].bg_free_inodes_count < avefreei ||
|
||||
- fs->gd[grp].bg_free_inodes_count == 0)
|
||||
+ if (get_gd(fs, grp)->bg_free_inodes_count < avefreei ||
|
||||
+ get_gd(fs, grp)->bg_free_inodes_count == 0)
|
||||
continue;
|
||||
if (!best_group ||
|
||||
- fs->gd[grp].bg_free_blocks_count > fs->gd[best_group].bg_free_blocks_count)
|
||||
+ get_gd(fs, grp)->bg_free_blocks_count > get_gd(fs, best_group)->bg_free_blocks_count)
|
||||
best_group = grp;
|
||||
}
|
||||
- if (!(nod = allocate(get_blk(fs,fs->gd[best_group].bg_inode_bitmap),0)))
|
||||
+ if (!(nod = allocate(GRP_GET_GROUP_IBM(fs, best_group), 0)))
|
||||
error_msg_and_die("couldn't allocate an inode (no free inode)");
|
||||
- if(!(fs->gd[best_group].bg_free_inodes_count--))
|
||||
+ if(!(get_gd(fs, best_group)->bg_free_inodes_count--))
|
||||
error_msg_and_die("group descr. free blocks count == 0 (corrupted fs?)");
|
||||
if(!(fs->sb.s_free_inodes_count--))
|
||||
error_msg_and_die("superblock free blocks count == 0 (corrupted fs?)");
|
||||
@@ -1390,7 +1405,7 @@
|
||||
case FM_IFDIR:
|
||||
add2dir(fs, nod, nod, ".");
|
||||
add2dir(fs, nod, parent_nod, "..");
|
||||
- fs->gd[GRP_GROUP_OF_INODE(fs,nod)].bg_used_dirs_count++;
|
||||
+ get_gd(fs, GRP_GROUP_OF_INODE(fs,nod))->bg_used_dirs_count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1860,7 +1875,7 @@
|
||||
swap_nod(nod);
|
||||
}
|
||||
for(i=0;i<GRP_NBGROUPS(fs);i++)
|
||||
- swap_gd(&(fs->gd[i]));
|
||||
+ swap_gd(get_gd(fs, i));
|
||||
swap_sb(&fs->sb);
|
||||
}
|
||||
|
||||
@@ -1870,7 +1885,7 @@
|
||||
uint32 i;
|
||||
swap_sb(&fs->sb);
|
||||
for(i=0;i<GRP_NBGROUPS(fs);i++)
|
||||
- swap_gd(&(fs->gd[i]));
|
||||
+ swap_gd(get_gd(fs, i));
|
||||
for(i = 1; i < fs->sb.s_inodes_count; i++)
|
||||
{
|
||||
inode *nod = get_nod(fs, i);
|
||||
@@ -1895,7 +1910,8 @@
|
||||
|
||||
// initialize an empty filesystem
|
||||
static filesystem *
|
||||
-init_fs(int nbblocks, int nbinodes, int nbresrvd, int holes, uint32 fs_timestamp)
|
||||
+init_fs(int nbblocks, int nbinodes, int nbresrvd, int holes,
|
||||
+ uint32 fs_timestamp, uint32 creator_os)
|
||||
{
|
||||
uint32 i;
|
||||
filesystem *fs;
|
||||
@@ -1921,10 +1937,14 @@
|
||||
*/
|
||||
min_nbgroups = (nbinodes + INODES_PER_GROUP - 1) / INODES_PER_GROUP;
|
||||
|
||||
+ /* On filesystems with 1k block size, the bootloader area uses a full
|
||||
+ * block. For 2048 and up, the superblock can be fitted into block 0.
|
||||
+ */
|
||||
+ first_block = (BLOCKSIZE == 1024);
|
||||
+
|
||||
/* nbblocks is the total number of blocks in the filesystem.
|
||||
* a block group can have no more than 8192 blocks.
|
||||
*/
|
||||
- first_block = (BLOCKSIZE == 1024);
|
||||
nbgroups = (nbblocks - first_block + BLOCKS_PER_GROUP - 1) / BLOCKS_PER_GROUP;
|
||||
if(nbgroups < min_nbgroups) nbgroups = min_nbgroups;
|
||||
nbblocks_per_group = rndup((nbblocks - first_block + nbgroups - 1)/nbgroups, 8);
|
||||
@@ -1936,10 +1956,10 @@
|
||||
gdsz = rndup(nbgroups*sizeof(groupdescriptor),BLOCKSIZE)/BLOCKSIZE;
|
||||
itblsz = nbinodes_per_group * sizeof(inode)/BLOCKSIZE;
|
||||
overhead_per_group = 3 /*sb,bbm,ibm*/ + gdsz + itblsz;
|
||||
- if((uint32)nbblocks - 1 < overhead_per_group * nbgroups)
|
||||
- error_msg_and_die("too much overhead, try fewer inodes or more blocks. Note: options have changed, see --help or the man page.");
|
||||
- free_blocks = nbblocks - overhead_per_group*nbgroups - 1 /*boot block*/;
|
||||
+ free_blocks = nbblocks - overhead_per_group*nbgroups - first_block;
|
||||
free_blocks_per_group = nbblocks_per_group - overhead_per_group;
|
||||
+ if(free_blocks < 0)
|
||||
+ error_msg_and_die("too much overhead, try fewer inodes or more blocks. Note: options have changed, see --help or the man page.");
|
||||
|
||||
if(!(fs = (filesystem*)calloc(nbblocks, BLOCKSIZE)))
|
||||
error_msg_and_die("not enough memory for filesystem");
|
||||
@@ -1959,28 +1979,31 @@
|
||||
fs->sb.s_wtime = fs_timestamp;
|
||||
fs->sb.s_magic = EXT2_MAGIC_NUMBER;
|
||||
fs->sb.s_lastcheck = fs_timestamp;
|
||||
+ fs->sb.s_creator_os = creator_os;
|
||||
|
||||
// set up groupdescriptors
|
||||
- for(i=0, bbmpos=gdsz+2, ibmpos=bbmpos+1, itblpos=ibmpos+1;
|
||||
+ for(i=0, bbmpos=first_block+1+gdsz, ibmpos=bbmpos+1, itblpos=ibmpos+1;
|
||||
i<nbgroups;
|
||||
i++, bbmpos+=nbblocks_per_group, ibmpos+=nbblocks_per_group, itblpos+=nbblocks_per_group)
|
||||
{
|
||||
+ groupdescriptor *gd = get_gd(fs, i);
|
||||
+
|
||||
if(free_blocks > free_blocks_per_group) {
|
||||
- fs->gd[i].bg_free_blocks_count = free_blocks_per_group;
|
||||
+ gd->bg_free_blocks_count = free_blocks_per_group;
|
||||
free_blocks -= free_blocks_per_group;
|
||||
} else {
|
||||
- fs->gd[i].bg_free_blocks_count = free_blocks;
|
||||
+ gd->bg_free_blocks_count = free_blocks;
|
||||
free_blocks = 0; // this is the last block group
|
||||
}
|
||||
if(i)
|
||||
- fs->gd[i].bg_free_inodes_count = nbinodes_per_group;
|
||||
+ gd->bg_free_inodes_count = nbinodes_per_group;
|
||||
else
|
||||
- fs->gd[i].bg_free_inodes_count = nbinodes_per_group -
|
||||
+ gd->bg_free_inodes_count = nbinodes_per_group -
|
||||
EXT2_FIRST_INO + 2;
|
||||
- fs->gd[i].bg_used_dirs_count = 0;
|
||||
- fs->gd[i].bg_block_bitmap = bbmpos;
|
||||
- fs->gd[i].bg_inode_bitmap = ibmpos;
|
||||
- fs->gd[i].bg_inode_table = itblpos;
|
||||
+ gd->bg_used_dirs_count = 0;
|
||||
+ gd->bg_block_bitmap = bbmpos;
|
||||
+ gd->bg_inode_bitmap = ibmpos;
|
||||
+ gd->bg_inode_table = itblpos;
|
||||
}
|
||||
|
||||
/* Mark non-filesystem blocks and inodes as allocated */
|
||||
@@ -1988,9 +2011,9 @@
|
||||
for(i = 0; i<nbgroups;i++) {
|
||||
|
||||
/* Block bitmap */
|
||||
- bbm = get_blk(fs,fs->gd[i].bg_block_bitmap);
|
||||
+ bbm = GRP_GET_GROUP_BBM(fs, i);
|
||||
//non-filesystem blocks
|
||||
- for(j = fs->gd[i].bg_free_blocks_count
|
||||
+ for(j = get_gd(fs, i)->bg_free_blocks_count
|
||||
+ overhead_per_group + 1; j <= BLOCKSIZE * 8; j++)
|
||||
allocate(bbm, j);
|
||||
//system blocks
|
||||
@@ -1998,7 +2021,7 @@
|
||||
allocate(bbm, j);
|
||||
|
||||
/* Inode bitmap */
|
||||
- ibm = get_blk(fs,fs->gd[i].bg_inode_bitmap);
|
||||
+ ibm = GRP_GET_GROUP_IBM(fs, i);
|
||||
//non-filesystem inodes
|
||||
for(j = fs->sb.s_inodes_per_group+1; j <= BLOCKSIZE * 8; j++)
|
||||
allocate(ibm, j);
|
||||
@@ -2012,9 +2035,9 @@
|
||||
// make root inode and directory
|
||||
/* We have groups now. Add the root filesystem in group 0 */
|
||||
/* Also increment the directory count for group 0 */
|
||||
- fs->gd[0].bg_free_inodes_count--;
|
||||
- fs->gd[0].bg_used_dirs_count = 1;
|
||||
- itab0 = (inode *)get_blk(fs,fs->gd[0].bg_inode_table);
|
||||
+ get_gd(fs, 0)->bg_free_inodes_count--;
|
||||
+ get_gd(fs, 0)->bg_used_dirs_count = 1;
|
||||
+ itab0 = (inode *)get_blk(fs, get_gd(fs,0)->bg_inode_table);
|
||||
itab0[EXT2_ROOT_INO-1].i_mode = FM_IFDIR | FM_IRWXU | FM_IRGRP | FM_IROTH | FM_IXGRP | FM_IXOTH;
|
||||
itab0[EXT2_ROOT_INO-1].i_ctime = fs_timestamp;
|
||||
itab0[EXT2_ROOT_INO-1].i_mtime = fs_timestamp;
|
||||
@@ -2338,8 +2361,9 @@
|
||||
for (i = 0; i < GRP_NBGROUPS(fs); i++) {
|
||||
printf("Group No: %d\n", i+1);
|
||||
printf("block bitmap: block %d,inode bitmap: block %d, inode table: block %d\n",
|
||||
- fs->gd[i].bg_block_bitmap, fs->gd[i].bg_inode_bitmap,
|
||||
- fs->gd[i].bg_inode_table);
|
||||
+ get_gd(fs, i)->bg_block_bitmap,
|
||||
+ get_gd(fs, i)->bg_inode_bitmap,
|
||||
+ get_gd(fs, i)->bg_inode_table);
|
||||
printf("block bitmap allocation:\n");
|
||||
print_bm(GRP_GET_GROUP_BBM(fs, i),fs->sb.s_blocks_per_group);
|
||||
printf("inode bitmap allocation:\n");
|
||||
@@ -2421,10 +2445,12 @@
|
||||
" -x, --starting-image <image>\n"
|
||||
" -d, --root <directory>\n"
|
||||
" -D, --devtable <file>\n"
|
||||
+ " -B, --block-size <bytes>\n"
|
||||
" -b, --size-in-blocks <blocks>\n"
|
||||
" -i, --bytes-per-inode <bytes per inode>\n"
|
||||
" -N, --number-of-inodes <number of inodes>\n"
|
||||
" -m, --reserved-percentage <percentage of blocks to reserve>\n"
|
||||
+ " -o, --creator-os <os> 'linux', 'hurd', 'freebsd' or a numerical value.\n"
|
||||
" -g, --block-map <path> Generate a block map file for this path.\n"
|
||||
" -e, --fill-value <value> Fill unallocated blocks with value.\n"
|
||||
" -z, --allow-holes Allow files with holes.\n"
|
||||
@@ -2446,6 +2472,29 @@
|
||||
extern char* optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
|
||||
+// parse the value for -o <os>
|
||||
+int
|
||||
+lookup_creator_os(const char *name)
|
||||
+{
|
||||
+ static const char *const creators[] =
|
||||
+ {"linux", "hurd", "2", "freebsd", NULL};
|
||||
+ char *endptr;
|
||||
+ int i;
|
||||
+
|
||||
+ // numerical value ?
|
||||
+ i = strtol(name, &endptr, 0);
|
||||
+ if(name[0] && *endptr == '\0')
|
||||
+ return i;
|
||||
+
|
||||
+ // symbolic name ?
|
||||
+ for(i=0; creators[i]; i++)
|
||||
+ if(strcasecmp(creators[i], name) == 0)
|
||||
+ return i;
|
||||
+
|
||||
+ // whatever ?
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -2455,6 +2504,7 @@
|
||||
float bytes_per_inode = -1;
|
||||
float reserved_frac = -1;
|
||||
int fs_timestamp = -1;
|
||||
+ int creator_os = CREATOR_OS;
|
||||
char * fsout = "-";
|
||||
char * fsin = 0;
|
||||
char * dopt[MAX_DOPT];
|
||||
@@ -2478,10 +2528,12 @@
|
||||
{ "starting-image", required_argument, NULL, 'x' },
|
||||
{ "root", required_argument, NULL, 'd' },
|
||||
{ "devtable", required_argument, NULL, 'D' },
|
||||
+ { "block-size", required_argument, NULL, 'B' },
|
||||
{ "size-in-blocks", required_argument, NULL, 'b' },
|
||||
{ "bytes-per-inode", required_argument, NULL, 'i' },
|
||||
{ "number-of-inodes", required_argument, NULL, 'N' },
|
||||
{ "reserved-percentage", required_argument, NULL, 'm' },
|
||||
+ { "creator-os", required_argument, NULL, 'o' },
|
||||
{ "block-map", required_argument, NULL, 'g' },
|
||||
{ "fill-value", required_argument, NULL, 'e' },
|
||||
{ "allow-holes", no_argument, NULL, 'z' },
|
||||
@@ -2497,11 +2549,11 @@
|
||||
|
||||
app_name = argv[0];
|
||||
|
||||
- while((c = getopt_long(argc, argv, "x:d:D:b:i:N:m:g:e:zfqUPhVv", longopts, NULL)) != EOF) {
|
||||
+ while((c = getopt_long(argc, argv, "x:d:D:B:b:i:N:m:o:g:e:zfqUPhVv", longopts, NULL)) != EOF) {
|
||||
#else
|
||||
app_name = argv[0];
|
||||
|
||||
- while((c = getopt(argc, argv, "x:d:D:b:i:N:m:g:e:zfqUPhVv")) != EOF) {
|
||||
+ while((c = getopt(argc, argv, "x:d:D:B:b:i:N:m:o:g:e:zfqUPhVv")) != EOF) {
|
||||
#endif /* HAVE_GETOPT_LONG */
|
||||
switch(c)
|
||||
{
|
||||
@@ -2512,6 +2564,9 @@
|
||||
case 'D':
|
||||
dopt[didx++] = optarg;
|
||||
break;
|
||||
+ case 'B':
|
||||
+ blocksize = SI_atof(optarg);
|
||||
+ break;
|
||||
case 'b':
|
||||
nbblocks = SI_atof(optarg);
|
||||
break;
|
||||
@@ -2524,6 +2579,9 @@
|
||||
case 'm':
|
||||
reserved_frac = SI_atof(optarg) / 100;
|
||||
break;
|
||||
+ case 'o':
|
||||
+ creator_os = lookup_creator_os(optarg);
|
||||
+ break;
|
||||
case 'g':
|
||||
gopt[gidx++] = optarg;
|
||||
break;
|
||||
@@ -2567,6 +2625,11 @@
|
||||
error_msg_and_die("Not enough arguments. Try --help or else see the man page.");
|
||||
fsout = argv[optind];
|
||||
|
||||
+ if(blocksize != 1024 && blocksize != 2048 && blocksize != 4096)
|
||||
+ error_msg_and_die("Valid block sizes: 1024, 2048 or 4096.");
|
||||
+ if(creator_os < 0)
|
||||
+ error_msg_and_die("Creator OS unknown.");
|
||||
+
|
||||
hdlinks.hdl = (struct hdlink_s *)malloc(hdlink_cnt * sizeof(struct hdlink_s));
|
||||
if (!hdlinks.hdl)
|
||||
error_msg_and_die("Not enough memory");
|
||||
@@ -2611,7 +2674,8 @@
|
||||
}
|
||||
if(fs_timestamp == -1)
|
||||
fs_timestamp = time(NULL);
|
||||
- fs = init_fs(nbblocks, nbinodes, nbresrvd, holes, fs_timestamp);
|
||||
+ fs = init_fs(nbblocks, nbinodes, nbresrvd, holes,
|
||||
+ fs_timestamp, creator_os);
|
||||
}
|
||||
|
||||
populate_fs(fs, dopt, didx, squash_uids, squash_perms, fs_timestamp, NULL);
|
||||
Index: genext2fs/test-gen.lib
|
||||
===================================================================
|
||||
--- genext2fs.orig/test-gen.lib 2011-09-03 13:40:35.000000000 +0200
|
||||
+++ genext2fs/test-gen.lib 2011-09-03 14:21:17.000000000 +0200
|
||||
@@ -8,7 +8,7 @@
|
||||
# Creates an image with a file of given size
|
||||
# Usage: dgen file-size number-of-blocks
|
||||
dgen () {
|
||||
- size=$1; blocks=$2
|
||||
+ size=$1; blocks=$2; blocksz=$3;
|
||||
rm -rf test
|
||||
mkdir -p test
|
||||
cd test
|
||||
@@ -20,7 +20,7 @@
|
||||
chmod 777 file.$1
|
||||
TZ=UTC-11 touch -t 200502070321.43 file.$1 .
|
||||
cd ..
|
||||
- ./genext2fs -N 17 -b $blocks -d test -f -q ext2.img
|
||||
+ ./genext2fs -B $blocksz -N 17 -b $blocks -d test -f -o Linux -q ext2.img
|
||||
}
|
||||
|
||||
# fgen - Exercises the -f spec-file option of genext2fs
|
||||
@@ -31,7 +31,7 @@
|
||||
mkdir -p test
|
||||
cp $fname test
|
||||
TZ=UTC-11 touch -t 200502070321.43 test/$fname
|
||||
- ./genext2fs -N 92 -b $blocks -D test/$fname -f ext2.img
|
||||
+ ./genext2fs -N 92 -b $blocks -D test/$fname -f -o Linux ext2.img
|
||||
}
|
||||
|
||||
# gen_cleanup - Remove the files generated by the above functions
|
||||
Index: genext2fs/test-mount.sh
|
||||
===================================================================
|
||||
--- genext2fs.orig/test-mount.sh 2011-09-03 13:40:35.000000000 +0200
|
||||
+++ genext2fs/test-mount.sh 2011-09-03 14:21:17.000000000 +0200
|
||||
@@ -33,9 +33,9 @@
|
||||
# and returns the command line with which to invoke dtest()
|
||||
# Usage: dtest-mount file-size number-of-blocks
|
||||
dtest_mount () {
|
||||
- size=$1; blocks=$2
|
||||
- echo Testing with file of size $size
|
||||
- dgen $size $blocks
|
||||
+ size=$1; blocks=$2; blocksz=$3;
|
||||
+ echo Testing $blocks blocks of $blocksz bytes with file of size $size
|
||||
+ dgen $size $blocks $blocksz
|
||||
/sbin/e2fsck -fn ext2.img || fail
|
||||
mkdir -p mnt
|
||||
mount -t ext2 -o ro,loop ext2.img mnt || fail
|
||||
@@ -44,7 +44,7 @@
|
||||
awk '{print $5}'`" ] ; then
|
||||
fail
|
||||
fi
|
||||
- pass dtest $size $blocks
|
||||
+ pass dtest $size $blocks $blocksz
|
||||
}
|
||||
|
||||
# ftest-mount - Exercise the -f spec-file option of genext2fs
|
||||
@@ -75,13 +75,21 @@
|
||||
pass ftest $fname $blocks
|
||||
}
|
||||
|
||||
-dtest_mount 0 4096
|
||||
-dtest_mount 0 8193
|
||||
-dtest_mount 0 8194
|
||||
-dtest_mount 1 4096
|
||||
-dtest_mount 12288 4096
|
||||
-dtest_mount 274432 4096
|
||||
-dtest_mount 8388608 9000
|
||||
-dtest_mount 16777216 20000
|
||||
+dtest_mount 0 4096 1024
|
||||
+dtest_mount 0 2048 2048
|
||||
+dtest_mount 0 1024 4096
|
||||
+dtest_mount 0 8193 1024
|
||||
+dtest_mount 0 8194 1024
|
||||
+dtest_mount 0 8193 4096
|
||||
+dtest_mount 0 8194 2048
|
||||
+dtest_mount 1 4096 1024
|
||||
+dtest_mount 1 1024 4096
|
||||
+dtest_mount 12288 4096 1024
|
||||
+dtest_mount 274432 4096 1024
|
||||
+dtest_mount 8388608 9000 1024
|
||||
+dtest_mount 8388608 4500 2048
|
||||
+dtest_mount 8388608 2250 4096
|
||||
+dtest_mount 16777216 20000 1024
|
||||
+dtest_mount 16777216 10000 2048
|
||||
|
||||
ftest_mount device_table.txt 4096
|
||||
Index: genext2fs/test.sh
|
||||
===================================================================
|
||||
--- genext2fs.orig/test.sh 2011-09-03 13:40:35.000000000 +0200
|
||||
+++ genext2fs/test.sh 2011-09-03 14:21:17.000000000 +0200
|
||||
@@ -30,9 +30,9 @@
|
||||
# Creates an image with a file of given size and verifies it
|
||||
# Usage: dtest file-size number-of-blocks correct-checksum
|
||||
dtest () {
|
||||
- size=$1; blocks=$2; checksum=$3
|
||||
+ size=$1; blocks=$2; blocksz=$3; checksum=$4
|
||||
echo Testing with file of size $size
|
||||
- dgen $size $blocks
|
||||
+ dgen $size $blocks $blocksz
|
||||
md5cmp $checksum
|
||||
gen_cleanup
|
||||
}
|
||||
@@ -53,12 +53,20 @@
|
||||
# replace the following lines with the output of
|
||||
# sudo sh test-mount.sh|grep test
|
||||
|
||||
-dtest 0 4096 3bc6424b8fcd51a0de34ee59d91d5f16
|
||||
-dtest 0 8193 f174804f6b433b552706cbbfc60c416d
|
||||
-dtest 0 8194 4855a55d0cbdc44584634df49ebd5711
|
||||
-dtest 1 4096 09c569b6bfb45222c729c42d04d5451f
|
||||
-dtest 12288 4096 61febcbfbf32024ef99103fcdc282c39
|
||||
-dtest 274432 4096 0c517803552c55c1806e4220b0a0164f
|
||||
-dtest 8388608 9000 e0e5ea15bced10ab486d8135584b5d8e
|
||||
-dtest 16777216 20000 fdf636eb905ab4dc1bf76dce5ac5d209
|
||||
+dtest 0 4096 1024 3bc6424b8fcd51a0de34ee59d91d5f16
|
||||
+dtest 0 2048 2048 230afa16496df019878cc2370c661cdc
|
||||
+dtest 0 1024 4096 ebff5eeb38b70f3f1cd081e60eb44561
|
||||
+dtest 0 8193 1024 f174804f6b433b552706cbbfc60c416d
|
||||
+dtest 0 8194 1024 4855a55d0cbdc44584634df49ebd5711
|
||||
+dtest 0 8193 4096 c493679698418ec7e6552005e2d2a6d8
|
||||
+dtest 0 8194 2048 ec13f328fa7543563f35f494bddc059c
|
||||
+dtest 1 4096 1024 09c569b6bfb45222c729c42d04d5451f
|
||||
+dtest 1 1024 4096 d318a326fdc907810ae9e6b0a20e9b06
|
||||
+dtest 12288 4096 1024 61febcbfbf32024ef99103fcdc282c39
|
||||
+dtest 274432 4096 1024 0c517803552c55c1806e4220b0a0164f
|
||||
+dtest 8388608 9000 1024 e0e5ea15bced10ab486d8135584b5d8e
|
||||
+dtest 8388608 4500 2048 39f4d537a72f5053fd6891721c59680d
|
||||
+dtest 8388608 2250 4096 1d697fa4bc2cfffe02ac91edfadc40bf
|
||||
+dtest 16777216 20000 1024 fdf636eb905ab4dc1bf76dce5ac5d209
|
||||
+dtest 16777216 10000 2048 f9824a81ea5e74fdf469c097927c292b
|
||||
ftest device_table.txt 4096 a0af06d944b11d2902dfd705484c64cc
|
@ -1,44 +0,0 @@
|
||||
Index: genext2fs/genext2fs.c
|
||||
===================================================================
|
||||
--- genext2fs.orig/genext2fs.c 2011-11-29 17:36:06.000000000 +0100
|
||||
+++ genext2fs/genext2fs.c 2011-11-29 17:37:37.000000000 +0100
|
||||
@@ -1779,7 +1779,8 @@
|
||||
assert(nod->i_block[EXT2_DIND_BLOCK] != 0);
|
||||
for(i = 0; i < BLOCKSIZE/4; i++)
|
||||
if(nblk > EXT2_IND_BLOCK + BLOCKSIZE/4 + (BLOCKSIZE/4)*i )
|
||||
- swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i]));
|
||||
+ if (((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i])
|
||||
+ swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i]));
|
||||
swap_block(get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]));
|
||||
if(nblk <= EXT2_IND_BLOCK + BLOCKSIZE/4 + BLOCKSIZE/4 * BLOCKSIZE/4)
|
||||
return;
|
||||
@@ -1792,7 +1793,8 @@
|
||||
(BLOCKSIZE/4)*(BLOCKSIZE/4) +
|
||||
i*(BLOCKSIZE/4)*(BLOCKSIZE/4) +
|
||||
j*(BLOCKSIZE/4)) )
|
||||
- swap_block(get_blk(fs,b2[j]));
|
||||
+ if (b2[j])
|
||||
+ swap_block(get_blk(fs,b2[j]));
|
||||
else {
|
||||
done = 1;
|
||||
break;
|
||||
@@ -1825,7 +1827,8 @@
|
||||
swap_block(get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]));
|
||||
for(i = 0; i < BLOCKSIZE/4; i++)
|
||||
if(nblk > EXT2_IND_BLOCK + BLOCKSIZE/4 + (BLOCKSIZE/4)*i )
|
||||
- swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i]));
|
||||
+ if (((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i])
|
||||
+ swap_block(get_blk(fs, ((uint32*)get_blk(fs, nod->i_block[EXT2_DIND_BLOCK]))[i]));
|
||||
if(nblk <= EXT2_IND_BLOCK + BLOCKSIZE/4 + BLOCKSIZE/4 * BLOCKSIZE/4)
|
||||
return;
|
||||
/* Adding support for triple indirection */
|
||||
@@ -1839,7 +1842,8 @@
|
||||
(BLOCKSIZE/4)*(BLOCKSIZE/4) +
|
||||
i*(BLOCKSIZE/4)*(BLOCKSIZE/4) +
|
||||
j*(BLOCKSIZE/4)) )
|
||||
- swap_block(get_blk(fs,b2[j]));
|
||||
+ if (b2[j])
|
||||
+ swap_block(get_blk(fs,b2[j]));
|
||||
else {
|
||||
done = 1;
|
||||
break;
|
@ -31,4 +31,8 @@ ifeq ($(GNU_HOST_NAME),x86_64-linux-gnux32)
|
||||
HOST_CONFIGURE_ARGS += ABI=x32
|
||||
endif
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -24,4 +24,8 @@ HOST_CONFIGURE_ARGS += \
|
||||
--disable-shared \
|
||||
--with-gmp-prefix=$(STAGING_DIR_HOST)
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -34,4 +34,8 @@ HOST_CONFIGURE_ARGS += \
|
||||
--with-pic \
|
||||
--disable-tests
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -34,8 +34,11 @@ define Host/Install
|
||||
$(SED) 's,-lstdc++,-luClibc++,g' $(STAGING_DIR_HOST)/bin/libtool-ucxx
|
||||
endef
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
|
||||
$(call Host/Clean/Default)
|
||||
endef
|
||||
|
||||
|
@ -31,6 +31,7 @@ define Host/Install
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/lzma
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -21,9 +21,8 @@ include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
HOST_CONFIGURE_VARS += gl_cv_func_strstr_linear=no
|
||||
|
||||
define Host/Clean
|
||||
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
|
||||
$(call Host/Clean/Default)
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -25,7 +25,6 @@ define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOST)/lib/meson
|
||||
$(INSTALL_CONF) files/openwrt-cross.txt.in $(STAGING_DIR_HOST)/lib/meson/
|
||||
$(INSTALL_CONF) files/openwrt-native.txt.in $(STAGING_DIR_HOST)/lib/meson/
|
||||
$(HOST_BUILD_DIR)/packaging/create_zipapp.py $(HOST_BUILD_DIR) --outfile $(STAGING_DIR_HOST)/lib/meson/meson.py
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
|
21
tools/meson/patches/010-wsl2.patch
Normal file
21
tools/meson/patches/010-wsl2.patch
Normal file
@ -0,0 +1,21 @@
|
||||
From 7d1ef4343ed5b2b7ab51469177a42c32c47f0528 Mon Sep 17 00:00:00 2001
|
||||
From: Rosen Penev <rosenp@gmail.com>
|
||||
Date: Tue, 6 Sep 2022 01:36:17 -0700
|
||||
Subject: [PATCH] minstall: handle extra error for selinuxenabled
|
||||
|
||||
Microsoft's WSL2 uses a Plan 9 filesystem, which returns IOError when file is missing.
|
||||
---
|
||||
mesonbuild/minstall.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/mesonbuild/minstall.py
|
||||
+++ b/mesonbuild/minstall.py
|
||||
@@ -229,7 +229,7 @@ def restore_selinux_contexts() -> None:
|
||||
'''
|
||||
try:
|
||||
subprocess.check_call(['selinuxenabled'])
|
||||
- except (FileNotFoundError, NotADirectoryError, PermissionError, subprocess.CalledProcessError):
|
||||
+ except (FileNotFoundError, NotADirectoryError, OSError, PermissionError, subprocess.CalledProcessError):
|
||||
# If we don't have selinux or selinuxenabled returned 1, failure
|
||||
# is ignored quietly.
|
||||
return
|
@ -7,37 +7,36 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mkimage
|
||||
PKG_VERSION:=2021.10
|
||||
PKG_VERSION:=2022.10
|
||||
|
||||
PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:= \
|
||||
https://mirror.cyberbits.eu/u-boot \
|
||||
https://ftp.denx.de/pub/u-boot \
|
||||
ftp://ftp.denx.de/pub/u-boot
|
||||
PKG_HASH:=cde723e19262e646f2670d25e5ec4b1b368490de950d4e26275a988c36df0bd4
|
||||
PKG_HASH:=50b4482a505bc281ba8470c399a3c26e145e29b23500bc35c50debd7fa46bdf8
|
||||
|
||||
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Host/Prepare
|
||||
$(Host/Prepare/Default)
|
||||
mkdir -p $(HOST_BUILD_DIR)/include/config
|
||||
touch $(HOST_BUILD_DIR)/include/config/auto.conf
|
||||
mkdir -p $(HOST_BUILD_DIR)/include/generated/
|
||||
touch $(HOST_BUILD_DIR)/include/generated/autoconf.h
|
||||
define Host/Configure
|
||||
$(MAKE) -C $(HOST_BUILD_DIR) \
|
||||
HOSTCFLAGS="$(HOST_CFLAGS)" \
|
||||
HOSTLDFLAGS="$(HOST_LDFLAGS)" \
|
||||
PKG_CONFIG_EXTRAARGS="--static" \
|
||||
V=$(if $(findstring c,$(OPENWRT_VERBOSE)),1) \
|
||||
tools-only_config
|
||||
|
||||
sed -i 's/CONFIG_TOOLS_MKEFICAPSULE=y/# CONFIG_TOOLS_MKEFICAPSULE is not set/' $(HOST_BUILD_DIR)/.config
|
||||
endef
|
||||
|
||||
define Host/Compile
|
||||
$(MAKE) -C $(HOST_BUILD_DIR) \
|
||||
HOSTCFLAGS="$(HOST_CFLAGS)" \
|
||||
HOSTLDFLAGS="$(HOST_LDFLAGS)" \
|
||||
no-dot-config-targets=tools-only \
|
||||
CONFIG_MKIMAGE_DTC_PATH=dtc \
|
||||
CONFIG_FIT=y \
|
||||
CONFIG_FIT_SIGNATURE=y \
|
||||
CONFIG_FIT_SIGNATURE_MAX_SIZE=0x10000000 \
|
||||
CONFIG_TOOLS_LIBCRYPTO=y \
|
||||
PKG_CONFIG_EXTRAARGS="--static" \
|
||||
V=$(if $(findstring c,$(OPENWRT_VERBOSE)),1) \
|
||||
tools-only
|
||||
endef
|
||||
|
||||
|
@ -1,89 +0,0 @@
|
||||
From b6bb61fd3818f4a3025fedbe4d15dbeeaef6ee82 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 2 Aug 2022 17:21:34 +0800
|
||||
Subject: [PATCH 28/31] tools: mtk_image: split gfh header verification into a
|
||||
new function
|
||||
|
||||
The verification code of gfh header for NAND and non-NAND are identical.
|
||||
It's better to define a individual function to reduce redundancy.
|
||||
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
tools/mtk_image.c | 51 +++++++++++++++++++----------------------------
|
||||
1 file changed, 21 insertions(+), 30 deletions(-)
|
||||
|
||||
--- a/tools/mtk_image.c
|
||||
+++ b/tools/mtk_image.c
|
||||
@@ -432,6 +432,25 @@ static int mtk_image_vrec_header(struct
|
||||
return SHA256_SUM_LEN;
|
||||
}
|
||||
|
||||
+static int mtk_image_verify_gfh(struct gfh_header *gfh, uint32_t type, int print)
|
||||
+{
|
||||
+ if (strcmp(gfh->file_info.name, GFH_FILE_INFO_NAME))
|
||||
+ return -1;
|
||||
+
|
||||
+ if (le32_to_cpu(gfh->file_info.flash_type) != type)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (print)
|
||||
+ printf("Load Address: %08x\n",
|
||||
+ le32_to_cpu(gfh->file_info.load_addr) +
|
||||
+ le32_to_cpu(gfh->file_info.jump_offset));
|
||||
+
|
||||
+ if (print)
|
||||
+ printf("Architecture: %s\n", is_arm64_image ? "ARM64" : "ARM");
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int mtk_image_verify_gen_header(const uint8_t *ptr, int print)
|
||||
{
|
||||
union gen_boot_header *gbh = (union gen_boot_header *)ptr;
|
||||
@@ -494,21 +513,7 @@ static int mtk_image_verify_gen_header(c
|
||||
|
||||
gfh = (struct gfh_header *)(ptr + gfh_offset);
|
||||
|
||||
- if (strcmp(gfh->file_info.name, GFH_FILE_INFO_NAME))
|
||||
- return -1;
|
||||
-
|
||||
- if (le32_to_cpu(gfh->file_info.flash_type) != GFH_FLASH_TYPE_GEN)
|
||||
- return -1;
|
||||
-
|
||||
- if (print)
|
||||
- printf("Load Address: %08x\n",
|
||||
- le32_to_cpu(gfh->file_info.load_addr) +
|
||||
- le32_to_cpu(gfh->file_info.jump_offset));
|
||||
-
|
||||
- if (print)
|
||||
- printf("Architecture: %s\n", is_arm64_image ? "ARM64" : "ARM");
|
||||
-
|
||||
- return 0;
|
||||
+ return mtk_image_verify_gfh(gfh, GFH_FLASH_TYPE_GEN, print);
|
||||
}
|
||||
|
||||
static int mtk_image_verify_nand_header(const uint8_t *ptr, int print)
|
||||
@@ -562,21 +567,7 @@ static int mtk_image_verify_nand_header(
|
||||
|
||||
gfh = (struct gfh_header *)(ptr + 2 * le16_to_cpu(nh->pagesize));
|
||||
|
||||
- if (strcmp(gfh->file_info.name, GFH_FILE_INFO_NAME))
|
||||
- return -1;
|
||||
-
|
||||
- if (le32_to_cpu(gfh->file_info.flash_type) != GFH_FLASH_TYPE_NAND)
|
||||
- return -1;
|
||||
-
|
||||
- if (print)
|
||||
- printf("Load Address: %08x\n",
|
||||
- le32_to_cpu(gfh->file_info.load_addr) +
|
||||
- le32_to_cpu(gfh->file_info.jump_offset));
|
||||
-
|
||||
- if (print)
|
||||
- printf("Architecture: %s\n", is_arm64_image ? "ARM64" : "ARM");
|
||||
-
|
||||
- return 0;
|
||||
+ return mtk_image_verify_gfh(gfh, GFH_FLASH_TYPE_NAND, print);
|
||||
}
|
||||
|
||||
static int mtk_image_verify_header(unsigned char *ptr, int image_size,
|
@ -1,821 +0,0 @@
|
||||
From 20ebf03eab571b25e9f62b2764ab84932111dcd6 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 2 Aug 2022 17:23:57 +0800
|
||||
Subject: [PATCH 29/31] tools: mtk_image: split the code of generating NAND
|
||||
header into a new file
|
||||
|
||||
The predefined NAND headers take too much spaces in the mtk_image.c.
|
||||
Moving them into a new file can significantly improve the readability of
|
||||
both mtk_image.c and the new mtk_nand_headers.c.
|
||||
|
||||
This is a preparation for adding more NAND headers.
|
||||
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
tools/Makefile | 1 +
|
||||
tools/mtk_image.c | 305 ++++++---------------------------------
|
||||
tools/mtk_image.h | 25 ----
|
||||
tools/mtk_nand_headers.c | 286 ++++++++++++++++++++++++++++++++++++
|
||||
tools/mtk_nand_headers.h | 61 ++++++++
|
||||
5 files changed, 389 insertions(+), 289 deletions(-)
|
||||
create mode 100644 tools/mtk_nand_headers.c
|
||||
create mode 100644 tools/mtk_nand_headers.h
|
||||
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -147,6 +147,7 @@ dumpimage-mkimage-objs := aisimage.o \
|
||||
gpimage.o \
|
||||
gpimage-common.o \
|
||||
mtk_image.o \
|
||||
+ mtk_nand_headers.o \
|
||||
$(ECDSA_OBJS-y) \
|
||||
$(RSA_OBJS-y) \
|
||||
$(AES_OBJS-y)
|
||||
--- a/tools/mtk_image.c
|
||||
+++ b/tools/mtk_image.c
|
||||
@@ -10,216 +10,7 @@
|
||||
#include <u-boot/sha256.h>
|
||||
#include "imagetool.h"
|
||||
#include "mtk_image.h"
|
||||
-
|
||||
-/* NAND header for SPI-NAND with 2KB page + 64B spare */
|
||||
-static const union nand_boot_header snand_hdr_2k_64_data = {
|
||||
- .data = {
|
||||
- 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
- 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
- 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x08, 0x03, 0x00, 0x40, 0x00,
|
||||
- 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x16, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x7B, 0xC4, 0x17, 0x9D,
|
||||
- 0xCA, 0x42, 0x90, 0xD0, 0x98, 0xD0, 0xE0, 0xF7,
|
||||
- 0xDB, 0xCD, 0x16, 0xF6, 0x03, 0x73, 0xD2, 0xB8,
|
||||
- 0x93, 0xB2, 0x56, 0x5A, 0x84, 0x6E, 0x00, 0x00
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-/* NAND header for SPI-NAND with 2KB page + 120B/128B spare */
|
||||
-static const union nand_boot_header snand_hdr_2k_128_data = {
|
||||
- .data = {
|
||||
- 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
- 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
- 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x70, 0x00,
|
||||
- 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x16, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x90, 0x28, 0xED, 0x13,
|
||||
- 0x7F, 0x12, 0x22, 0xCD, 0x3D, 0x06, 0xF1, 0xB3,
|
||||
- 0x6F, 0x2E, 0xD9, 0xA0, 0x9D, 0x7A, 0xBD, 0xD7,
|
||||
- 0xB3, 0x28, 0x3C, 0x13, 0xDB, 0x4E, 0x00, 0x00
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-/* NAND header for SPI-NAND with 4KB page + 256B spare */
|
||||
-static const union nand_boot_header snand_hdr_4k_256_data = {
|
||||
- .data = {
|
||||
- 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
- 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
- 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x10, 0x05, 0x00, 0xE0, 0x00,
|
||||
- 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x16, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x47, 0xED, 0x0E, 0xC3,
|
||||
- 0x83, 0xBF, 0x41, 0xD2, 0x85, 0x21, 0x97, 0x57,
|
||||
- 0xC4, 0x2E, 0x6B, 0x7A, 0x40, 0xE0, 0xCF, 0x8F,
|
||||
- 0x37, 0xBD, 0x17, 0xB6, 0xC7, 0xFE, 0x00, 0x00
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-/* NAND header for Parallel NAND 1Gb with 2KB page + 64B spare */
|
||||
-static const union nand_boot_header nand_hdr_1gb_2k_64_data = {
|
||||
- .data = {
|
||||
- 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
- 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
- 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x40, 0x00,
|
||||
- 0x40, 0x00, 0x00, 0x04, 0x0B, 0x00, 0x11, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x12, 0x28, 0x1C, 0x12,
|
||||
- 0x8F, 0xFD, 0xF8, 0x32, 0x6F, 0x6D, 0xCF, 0x6C,
|
||||
- 0xDA, 0x21, 0x70, 0x8C, 0xDA, 0x0A, 0x22, 0x82,
|
||||
- 0xAA, 0x59, 0xFA, 0x7C, 0x42, 0x2D, 0x00, 0x00
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-/* NAND header for Parallel NAND 2Gb with 2KB page + 64B spare */
|
||||
-static const union nand_boot_header nand_hdr_2gb_2k_64_data = {
|
||||
- .data = {
|
||||
- 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
- 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
- 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x40, 0x00,
|
||||
- 0x40, 0x00, 0x00, 0x08, 0x0B, 0x00, 0x11, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x9C, 0x3D, 0x2D,
|
||||
- 0x7B, 0x68, 0x63, 0x52, 0x2E, 0x04, 0x63, 0xF1,
|
||||
- 0x35, 0x4E, 0x44, 0x3E, 0xF8, 0xAC, 0x9B, 0x95,
|
||||
- 0xAB, 0xFE, 0xE4, 0xE1, 0xD5, 0xF9, 0x00, 0x00
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-/* NAND header for Parallel NAND 4Gb with 2KB page + 64B spare */
|
||||
-static const union nand_boot_header nand_hdr_4gb_2k_64_data = {
|
||||
- .data = {
|
||||
- 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
- 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
- 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x40, 0x00,
|
||||
- 0x40, 0x00, 0x00, 0x10, 0x0B, 0x00, 0x11, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0xE3, 0x0F, 0x86, 0x32,
|
||||
- 0x68, 0x05, 0xD9, 0xC8, 0x13, 0xDF, 0xC5, 0x0B,
|
||||
- 0x35, 0x3A, 0x68, 0xA5, 0x3C, 0x0C, 0x73, 0x87,
|
||||
- 0x63, 0xB0, 0xBE, 0xCC, 0x84, 0x47, 0x00, 0x00
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-/* NAND header for Parallel NAND 2Gb with 2KB page + 128B spare */
|
||||
-static const union nand_boot_header nand_hdr_2gb_2k_128_data = {
|
||||
- .data = {
|
||||
- 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
- 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
- 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x70, 0x00,
|
||||
- 0x40, 0x00, 0x00, 0x08, 0x0B, 0x00, 0x11, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x01, 0xA5, 0xE9, 0x5A,
|
||||
- 0xDF, 0x58, 0x62, 0x41, 0xD6, 0x26, 0x77, 0xBC,
|
||||
- 0x76, 0x1F, 0x27, 0x4E, 0x4F, 0x6C, 0xC3, 0xF0,
|
||||
- 0x36, 0xDE, 0xD9, 0xB3, 0xFF, 0x93, 0x00, 0x00
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-/* NAND header for Parallel NAND 4Gb with 2KB page + 128B spare */
|
||||
-static const union nand_boot_header nand_hdr_4gb_2k_128_data = {
|
||||
- .data = {
|
||||
- 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
- 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
- 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x70, 0x00,
|
||||
- 0x40, 0x00, 0x00, 0x10, 0x0B, 0x00, 0x11, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
- 0x00, 0x00, 0x00, 0x00, 0xC2, 0x36, 0x52, 0x45,
|
||||
- 0xCC, 0x35, 0xD8, 0xDB, 0xEB, 0xFD, 0xD1, 0x46,
|
||||
- 0x76, 0x6B, 0x0B, 0xD5, 0x8B, 0xCC, 0x2B, 0xE2,
|
||||
- 0xFE, 0x90, 0x83, 0x9E, 0xAE, 0x2D, 0x00, 0x00
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-static const struct nand_header_type {
|
||||
- const char *name;
|
||||
- const union nand_boot_header *data;
|
||||
-} nand_headers[] = {
|
||||
- {
|
||||
- .name = "2k+64",
|
||||
- .data = &snand_hdr_2k_64_data
|
||||
- }, {
|
||||
- .name = "2k+120",
|
||||
- .data = &snand_hdr_2k_128_data
|
||||
- }, {
|
||||
- .name = "2k+128",
|
||||
- .data = &snand_hdr_2k_128_data
|
||||
- }, {
|
||||
- .name = "4k+256",
|
||||
- .data = &snand_hdr_4k_256_data
|
||||
- }, {
|
||||
- .name = "1g:2k+64",
|
||||
- .data = &nand_hdr_1gb_2k_64_data
|
||||
- }, {
|
||||
- .name = "2g:2k+64",
|
||||
- .data = &nand_hdr_2gb_2k_64_data
|
||||
- }, {
|
||||
- .name = "4g:2k+64",
|
||||
- .data = &nand_hdr_4gb_2k_64_data
|
||||
- }, {
|
||||
- .name = "2g:2k+128",
|
||||
- .data = &nand_hdr_2gb_2k_128_data
|
||||
- }, {
|
||||
- .name = "4g:2k+128",
|
||||
- .data = &nand_hdr_4gb_2k_128_data
|
||||
- }
|
||||
-};
|
||||
+#include "mtk_nand_headers.h"
|
||||
|
||||
static const struct brom_img_type {
|
||||
const char *name;
|
||||
@@ -258,6 +49,7 @@ static char lk_name[32] = "U-Boot";
|
||||
|
||||
/* NAND header selected by user */
|
||||
static const union nand_boot_header *hdr_nand;
|
||||
+static uint32_t hdr_nand_size;
|
||||
|
||||
/* GFH header + 2 * 4KB pages of NAND */
|
||||
static char hdr_tmp[sizeof(struct gfh_header) + 0x2000];
|
||||
@@ -361,12 +153,7 @@ static int mtk_brom_parse_imagename(cons
|
||||
}
|
||||
|
||||
/* parse nand header type */
|
||||
- for (i = 0; i < ARRAY_SIZE(nand_headers); i++) {
|
||||
- if (!strcmp(nand_headers[i].name, nandinfo)) {
|
||||
- hdr_nand = nand_headers[i].data;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
+ hdr_nand = mtk_nand_header_find(nandinfo);
|
||||
|
||||
/* parse device header offset */
|
||||
if (hdr_offs && hdr_offs[0])
|
||||
@@ -391,6 +178,9 @@ static int mtk_brom_parse_imagename(cons
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+ if (hdr_media == BRLYT_TYPE_NAND || hdr_media == BRLYT_TYPE_SNAND)
|
||||
+ hdr_nand_size = mtk_nand_header_size(hdr_nand);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -420,7 +210,7 @@ static int mtk_image_vrec_header(struct
|
||||
}
|
||||
|
||||
if (hdr_media == BRLYT_TYPE_NAND || hdr_media == BRLYT_TYPE_SNAND)
|
||||
- tparams->header_size = 2 * le16_to_cpu(hdr_nand->pagesize);
|
||||
+ tparams->header_size = hdr_nand_size;
|
||||
else
|
||||
tparams->header_size = sizeof(struct gen_device_header);
|
||||
|
||||
@@ -518,16 +308,17 @@ static int mtk_image_verify_gen_header(c
|
||||
|
||||
static int mtk_image_verify_nand_header(const uint8_t *ptr, int print)
|
||||
{
|
||||
- union nand_boot_header *nh = (union nand_boot_header *)ptr;
|
||||
struct brom_layout_header *bh;
|
||||
+ struct nand_header_info info;
|
||||
struct gfh_header *gfh;
|
||||
const char *bootmedia;
|
||||
+ int ret;
|
||||
|
||||
- if (strncmp(nh->version, NAND_BOOT_VERSION, sizeof(nh->version)) ||
|
||||
- strcmp(nh->id, NAND_BOOT_ID))
|
||||
- return -1;
|
||||
+ ret = mtk_nand_header_info(ptr, &info);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
|
||||
- bh = (struct brom_layout_header *)(ptr + le16_to_cpu(nh->pagesize));
|
||||
+ bh = (struct brom_layout_header *)(ptr + info.page_size);
|
||||
|
||||
if (strcmp(bh->name, BRLYT_NAME))
|
||||
return -1;
|
||||
@@ -538,34 +329,23 @@ static int mtk_image_verify_nand_header(
|
||||
if (le32_to_cpu(bh->type) == BRLYT_TYPE_NAND)
|
||||
bootmedia = "Parallel NAND";
|
||||
else if (le32_to_cpu(bh->type) == BRLYT_TYPE_SNAND)
|
||||
- bootmedia = "Serial NAND";
|
||||
+ bootmedia = "Serial NAND (SNFI/AP)";
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (print) {
|
||||
- printf("Boot Media: %s\n", bootmedia);
|
||||
-
|
||||
- if (le32_to_cpu(bh->type) == BRLYT_TYPE_NAND) {
|
||||
- uint64_t capacity =
|
||||
- (uint64_t)le16_to_cpu(nh->numblocks) *
|
||||
- (uint64_t)le16_to_cpu(nh->pages_of_block) *
|
||||
- (uint64_t)le16_to_cpu(nh->pagesize) * 8;
|
||||
- printf("Capacity: %dGb\n",
|
||||
- (uint32_t)(capacity >> 30));
|
||||
- }
|
||||
+ printf("Boot Media: %s\n", bootmedia);
|
||||
|
||||
- if (le16_to_cpu(nh->pagesize) >= 1024)
|
||||
- printf("Page Size: %dKB\n",
|
||||
- le16_to_cpu(nh->pagesize) >> 10);
|
||||
+ if (info.page_size >= 1024)
|
||||
+ printf("Page Size: %dKB\n", info.page_size >> 10);
|
||||
else
|
||||
- printf("Page Size: %dB\n",
|
||||
- le16_to_cpu(nh->pagesize));
|
||||
+ printf("Page Size: %dB\n", info.page_size);
|
||||
|
||||
- printf("Spare Size: %dB\n", le16_to_cpu(nh->oobsize));
|
||||
+ printf("Spare Size: %dB\n", info.spare_size);
|
||||
}
|
||||
|
||||
- gfh = (struct gfh_header *)(ptr + 2 * le16_to_cpu(nh->pagesize));
|
||||
+ gfh = (struct gfh_header *)(ptr + info.gfh_offset);
|
||||
|
||||
return mtk_image_verify_gfh(gfh, GFH_FLASH_TYPE_NAND, print);
|
||||
}
|
||||
@@ -581,7 +361,7 @@ static int mtk_image_verify_header(unsig
|
||||
|
||||
img_size = image_size;
|
||||
|
||||
- if (!strcmp((char *)ptr, NAND_BOOT_NAME))
|
||||
+ if (is_mtk_nand_header(ptr))
|
||||
return mtk_image_verify_nand_header(ptr, 0);
|
||||
else
|
||||
return mtk_image_verify_gen_header(ptr, 0);
|
||||
@@ -601,7 +381,7 @@ static void mtk_image_print_header(const
|
||||
|
||||
printf("Image Type: MediaTek BootROM Loadable Image\n");
|
||||
|
||||
- if (!strcmp((char *)ptr, NAND_BOOT_NAME))
|
||||
+ if (is_mtk_nand_header(ptr))
|
||||
mtk_image_verify_nand_header(ptr, 1);
|
||||
else
|
||||
mtk_image_verify_gen_header(ptr, 1);
|
||||
@@ -732,36 +512,33 @@ static void mtk_image_set_gen_header(voi
|
||||
static void mtk_image_set_nand_header(void *ptr, off_t filesize,
|
||||
uint32_t loadaddr)
|
||||
{
|
||||
- union nand_boot_header *nh = (union nand_boot_header *)ptr;
|
||||
struct brom_layout_header *brlyt;
|
||||
struct gfh_header *gfh;
|
||||
- uint32_t payload_pages;
|
||||
- int i;
|
||||
+ uint32_t payload_pages, nand_page_size;
|
||||
|
||||
- /* NAND device header, repeat 4 times */
|
||||
- for (i = 0; i < 4; i++)
|
||||
- memcpy(nh + i, hdr_nand, sizeof(union nand_boot_header));
|
||||
+ /* NAND header */
|
||||
+ nand_page_size = mtk_nand_header_put(hdr_nand, ptr);
|
||||
|
||||
- /* BRLYT header */
|
||||
- payload_pages = (filesize + le16_to_cpu(hdr_nand->pagesize) - 1) /
|
||||
- le16_to_cpu(hdr_nand->pagesize);
|
||||
- brlyt = (struct brom_layout_header *)
|
||||
- (ptr + le16_to_cpu(hdr_nand->pagesize));
|
||||
- put_brom_layout_header(brlyt, hdr_media);
|
||||
- brlyt->header_size = cpu_to_le32(2);
|
||||
- brlyt->total_size = cpu_to_le32(payload_pages);
|
||||
- brlyt->header_size_2 = brlyt->header_size;
|
||||
- brlyt->total_size_2 = brlyt->total_size;
|
||||
- brlyt->unused = cpu_to_le32(1);
|
||||
+ if (nand_page_size) {
|
||||
+ /* BRLYT header */
|
||||
+ payload_pages = (filesize + nand_page_size - 1) /
|
||||
+ nand_page_size;
|
||||
+ brlyt = (struct brom_layout_header *)(ptr + nand_page_size);
|
||||
+ put_brom_layout_header(brlyt, hdr_media);
|
||||
+ brlyt->header_size = cpu_to_le32(2);
|
||||
+ brlyt->total_size = cpu_to_le32(payload_pages);
|
||||
+ brlyt->header_size_2 = brlyt->header_size;
|
||||
+ brlyt->total_size_2 = brlyt->total_size;
|
||||
+ brlyt->unused = cpu_to_le32(1);
|
||||
+ }
|
||||
|
||||
/* GFH header */
|
||||
- gfh = (struct gfh_header *)(ptr + 2 * le16_to_cpu(hdr_nand->pagesize));
|
||||
- put_ghf_header(gfh, filesize, 2 * le16_to_cpu(hdr_nand->pagesize),
|
||||
- loadaddr, GFH_FLASH_TYPE_NAND);
|
||||
+ gfh = (struct gfh_header *)(ptr + hdr_nand_size);
|
||||
+ put_ghf_header(gfh, filesize, hdr_nand_size, loadaddr,
|
||||
+ GFH_FLASH_TYPE_NAND);
|
||||
|
||||
/* Generate SHA256 hash */
|
||||
- put_hash((uint8_t *)gfh,
|
||||
- filesize - 2 * le16_to_cpu(hdr_nand->pagesize) - SHA256_SUM_LEN);
|
||||
+ put_hash((uint8_t *)gfh, filesize - hdr_nand_size - SHA256_SUM_LEN);
|
||||
}
|
||||
|
||||
static void mtk_image_set_header(void *ptr, struct stat *sbuf, int ifd,
|
||||
--- a/tools/mtk_image.h
|
||||
+++ b/tools/mtk_image.h
|
||||
@@ -26,31 +26,6 @@ union gen_boot_header {
|
||||
#define SF_BOOT_NAME "SF_BOOT"
|
||||
#define SDMMC_BOOT_NAME "SDMMC_BOOT"
|
||||
|
||||
-/* Header for NAND */
|
||||
-union nand_boot_header {
|
||||
- struct {
|
||||
- char name[12];
|
||||
- char version[4];
|
||||
- char id[8];
|
||||
- uint16_t ioif;
|
||||
- uint16_t pagesize;
|
||||
- uint16_t addrcycles;
|
||||
- uint16_t oobsize;
|
||||
- uint16_t pages_of_block;
|
||||
- uint16_t numblocks;
|
||||
- uint16_t writesize_shift;
|
||||
- uint16_t erasesize_shift;
|
||||
- uint8_t dummy[60];
|
||||
- uint8_t ecc_parity[28];
|
||||
- };
|
||||
-
|
||||
- uint8_t data[0x80];
|
||||
-};
|
||||
-
|
||||
-#define NAND_BOOT_NAME "BOOTLOADER!"
|
||||
-#define NAND_BOOT_VERSION "V006"
|
||||
-#define NAND_BOOT_ID "NFIINFO"
|
||||
-
|
||||
/* BootROM layout header */
|
||||
struct brom_layout_header {
|
||||
char name[8];
|
||||
--- /dev/null
|
||||
+++ b/tools/mtk_nand_headers.c
|
||||
@@ -0,0 +1,286 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * MediaTek BootROM NAND header definitions
|
||||
+ *
|
||||
+ * Copyright (C) 2022 MediaTek Inc.
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+#include <string.h>
|
||||
+#include "imagetool.h"
|
||||
+#include "mtk_image.h"
|
||||
+#include "mtk_nand_headers.h"
|
||||
+
|
||||
+/* NAND header for SPI-NAND with 2KB page + 64B spare */
|
||||
+static const union nand_boot_header snand_hdr_2k_64_data = {
|
||||
+ .data = {
|
||||
+ 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
+ 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
+ 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x08, 0x03, 0x00, 0x40, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x16, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x7B, 0xC4, 0x17, 0x9D,
|
||||
+ 0xCA, 0x42, 0x90, 0xD0, 0x98, 0xD0, 0xE0, 0xF7,
|
||||
+ 0xDB, 0xCD, 0x16, 0xF6, 0x03, 0x73, 0xD2, 0xB8,
|
||||
+ 0x93, 0xB2, 0x56, 0x5A, 0x84, 0x6E, 0x00, 0x00
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* NAND header for SPI-NAND with 2KB page + 120B/128B spare */
|
||||
+static const union nand_boot_header snand_hdr_2k_128_data = {
|
||||
+ .data = {
|
||||
+ 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
+ 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
+ 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x70, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x16, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x90, 0x28, 0xED, 0x13,
|
||||
+ 0x7F, 0x12, 0x22, 0xCD, 0x3D, 0x06, 0xF1, 0xB3,
|
||||
+ 0x6F, 0x2E, 0xD9, 0xA0, 0x9D, 0x7A, 0xBD, 0xD7,
|
||||
+ 0xB3, 0x28, 0x3C, 0x13, 0xDB, 0x4E, 0x00, 0x00
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* NAND header for SPI-NAND with 4KB page + 256B spare */
|
||||
+static const union nand_boot_header snand_hdr_4k_256_data = {
|
||||
+ .data = {
|
||||
+ 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
+ 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
+ 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x10, 0x05, 0x00, 0xE0, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x16, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x47, 0xED, 0x0E, 0xC3,
|
||||
+ 0x83, 0xBF, 0x41, 0xD2, 0x85, 0x21, 0x97, 0x57,
|
||||
+ 0xC4, 0x2E, 0x6B, 0x7A, 0x40, 0xE0, 0xCF, 0x8F,
|
||||
+ 0x37, 0xBD, 0x17, 0xB6, 0xC7, 0xFE, 0x00, 0x00
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* NAND header for Parallel NAND 1Gb with 2KB page + 64B spare */
|
||||
+static const union nand_boot_header nand_hdr_1gb_2k_64_data = {
|
||||
+ .data = {
|
||||
+ 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
+ 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
+ 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x40, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x04, 0x0B, 0x00, 0x11, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x12, 0x28, 0x1C, 0x12,
|
||||
+ 0x8F, 0xFD, 0xF8, 0x32, 0x6F, 0x6D, 0xCF, 0x6C,
|
||||
+ 0xDA, 0x21, 0x70, 0x8C, 0xDA, 0x0A, 0x22, 0x82,
|
||||
+ 0xAA, 0x59, 0xFA, 0x7C, 0x42, 0x2D, 0x00, 0x00
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* NAND header for Parallel NAND 2Gb with 2KB page + 64B spare */
|
||||
+static const union nand_boot_header nand_hdr_2gb_2k_64_data = {
|
||||
+ .data = {
|
||||
+ 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
+ 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
+ 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x40, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x08, 0x0B, 0x00, 0x11, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x9C, 0x3D, 0x2D,
|
||||
+ 0x7B, 0x68, 0x63, 0x52, 0x2E, 0x04, 0x63, 0xF1,
|
||||
+ 0x35, 0x4E, 0x44, 0x3E, 0xF8, 0xAC, 0x9B, 0x95,
|
||||
+ 0xAB, 0xFE, 0xE4, 0xE1, 0xD5, 0xF9, 0x00, 0x00
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* NAND header for Parallel NAND 4Gb with 2KB page + 64B spare */
|
||||
+static const union nand_boot_header nand_hdr_4gb_2k_64_data = {
|
||||
+ .data = {
|
||||
+ 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
+ 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
+ 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x40, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x10, 0x0B, 0x00, 0x11, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0xE3, 0x0F, 0x86, 0x32,
|
||||
+ 0x68, 0x05, 0xD9, 0xC8, 0x13, 0xDF, 0xC5, 0x0B,
|
||||
+ 0x35, 0x3A, 0x68, 0xA5, 0x3C, 0x0C, 0x73, 0x87,
|
||||
+ 0x63, 0xB0, 0xBE, 0xCC, 0x84, 0x47, 0x00, 0x00
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* NAND header for Parallel NAND 2Gb with 2KB page + 128B spare */
|
||||
+static const union nand_boot_header nand_hdr_2gb_2k_128_data = {
|
||||
+ .data = {
|
||||
+ 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
+ 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
+ 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x70, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x08, 0x0B, 0x00, 0x11, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0xA5, 0xE9, 0x5A,
|
||||
+ 0xDF, 0x58, 0x62, 0x41, 0xD6, 0x26, 0x77, 0xBC,
|
||||
+ 0x76, 0x1F, 0x27, 0x4E, 0x4F, 0x6C, 0xC3, 0xF0,
|
||||
+ 0x36, 0xDE, 0xD9, 0xB3, 0xFF, 0x93, 0x00, 0x00
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* NAND header for Parallel NAND 4Gb with 2KB page + 128B spare */
|
||||
+static const union nand_boot_header nand_hdr_4gb_2k_128_data = {
|
||||
+ .data = {
|
||||
+ 0x42, 0x4F, 0x4F, 0x54, 0x4C, 0x4F, 0x41, 0x44,
|
||||
+ 0x45, 0x52, 0x21, 0x00, 0x56, 0x30, 0x30, 0x36,
|
||||
+ 0x4E, 0x46, 0x49, 0x49, 0x4E, 0x46, 0x4F, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x08, 0x05, 0x00, 0x70, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x10, 0x0B, 0x00, 0x11, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0xC2, 0x36, 0x52, 0x45,
|
||||
+ 0xCC, 0x35, 0xD8, 0xDB, 0xEB, 0xFD, 0xD1, 0x46,
|
||||
+ 0x76, 0x6B, 0x0B, 0xD5, 0x8B, 0xCC, 0x2B, 0xE2,
|
||||
+ 0xFE, 0x90, 0x83, 0x9E, 0xAE, 0x2D, 0x00, 0x00
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+static const struct nand_header_type {
|
||||
+ const char *name;
|
||||
+ const union nand_boot_header *data;
|
||||
+} nand_headers[] = {
|
||||
+ {
|
||||
+ .name = "2k+64",
|
||||
+ .data = &snand_hdr_2k_64_data
|
||||
+ }, {
|
||||
+ .name = "2k+120",
|
||||
+ .data = &snand_hdr_2k_128_data
|
||||
+ }, {
|
||||
+ .name = "2k+128",
|
||||
+ .data = &snand_hdr_2k_128_data
|
||||
+ }, {
|
||||
+ .name = "4k+256",
|
||||
+ .data = &snand_hdr_4k_256_data
|
||||
+ }, {
|
||||
+ .name = "1g:2k+64",
|
||||
+ .data = &nand_hdr_1gb_2k_64_data
|
||||
+ }, {
|
||||
+ .name = "2g:2k+64",
|
||||
+ .data = &nand_hdr_2gb_2k_64_data
|
||||
+ }, {
|
||||
+ .name = "4g:2k+64",
|
||||
+ .data = &nand_hdr_4gb_2k_64_data
|
||||
+ }, {
|
||||
+ .name = "2g:2k+128",
|
||||
+ .data = &nand_hdr_2gb_2k_128_data
|
||||
+ }, {
|
||||
+ .name = "4g:2k+128",
|
||||
+ .data = &nand_hdr_4gb_2k_128_data
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+const union nand_boot_header *mtk_nand_header_find(const char *name)
|
||||
+{
|
||||
+ uint32_t i;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(nand_headers); i++) {
|
||||
+ if (!strcmp(nand_headers[i].name, name))
|
||||
+ return nand_headers[i].data;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+uint32_t mtk_nand_header_size(const union nand_boot_header *hdr_nand)
|
||||
+{
|
||||
+ return 2 * le16_to_cpu(hdr_nand->pagesize);
|
||||
+}
|
||||
+
|
||||
+static int mtk_nand_header_ap_info(const void *ptr,
|
||||
+ struct nand_header_info *info)
|
||||
+{
|
||||
+ union nand_boot_header *nh = (union nand_boot_header *)ptr;
|
||||
+
|
||||
+ if (strncmp(nh->version, NAND_BOOT_VERSION, sizeof(nh->version)) ||
|
||||
+ strcmp(nh->id, NAND_BOOT_ID))
|
||||
+ return -1;
|
||||
+
|
||||
+ info->page_size = le16_to_cpu(nh->pagesize);
|
||||
+ info->spare_size = le16_to_cpu(nh->oobsize);
|
||||
+ info->gfh_offset = 2 * info->page_size;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int mtk_nand_header_info(const void *ptr, struct nand_header_info *info)
|
||||
+{
|
||||
+ if (!strcmp((char *)ptr, NAND_BOOT_NAME))
|
||||
+ return mtk_nand_header_ap_info(ptr, info);
|
||||
+
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+bool is_mtk_nand_header(const void *ptr)
|
||||
+{
|
||||
+ struct nand_header_info info;
|
||||
+
|
||||
+ if (mtk_nand_header_info(ptr, &info) >= 0)
|
||||
+ return true;
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+uint32_t mtk_nand_header_put(const union nand_boot_header *hdr_nand, void *ptr)
|
||||
+{
|
||||
+ union nand_boot_header *nh = (union nand_boot_header *)ptr;
|
||||
+ int i;
|
||||
+
|
||||
+ /* NAND device header, repeat 4 times */
|
||||
+ for (i = 0; i < 4; i++)
|
||||
+ memcpy(nh + i, hdr_nand, sizeof(union nand_boot_header));
|
||||
+
|
||||
+ return le16_to_cpu(hdr_nand->pagesize);
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/tools/mtk_nand_headers.h
|
||||
@@ -0,0 +1,61 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
+/*
|
||||
+ * MediaTek BootROM NAND header definitions
|
||||
+ *
|
||||
+ * Copyright (C) 2022 MediaTek Inc.
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#ifndef _MTK_NAND_HEADERS_H
|
||||
+#define _MTK_NAND_HEADERS_H
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+#include <stdbool.h>
|
||||
+
|
||||
+struct nand_header_info {
|
||||
+ uint32_t page_size;
|
||||
+ uint32_t spare_size;
|
||||
+ uint32_t gfh_offset;
|
||||
+};
|
||||
+
|
||||
+/* AP BROM Header for NAND */
|
||||
+union nand_boot_header {
|
||||
+ struct {
|
||||
+ char name[12];
|
||||
+ char version[4];
|
||||
+ char id[8];
|
||||
+ uint16_t ioif; /* I/O interface */
|
||||
+ uint16_t pagesize; /* NAND page size */
|
||||
+ uint16_t addrcycles; /* Address cycles */
|
||||
+ uint16_t oobsize; /* NAND page spare size */
|
||||
+ uint16_t pages_of_block; /* Pages of one block */
|
||||
+ uint16_t numblocks; /* Total blocks of NAND chip */
|
||||
+ uint16_t writesize_shift;
|
||||
+ uint16_t erasesize_shift;
|
||||
+ uint8_t dummy[60];
|
||||
+ uint8_t ecc_parity[28]; /* ECC parity of this header */
|
||||
+ };
|
||||
+
|
||||
+ uint8_t data[0x80];
|
||||
+};
|
||||
+
|
||||
+#define NAND_BOOT_NAME "BOOTLOADER!"
|
||||
+#define NAND_BOOT_VERSION "V006"
|
||||
+#define NAND_BOOT_ID "NFIINFO"
|
||||
+
|
||||
+/* Find nand header data by name */
|
||||
+const union nand_boot_header *mtk_nand_header_find(const char *name);
|
||||
+
|
||||
+/* Device header size using this nand header */
|
||||
+uint32_t mtk_nand_header_size(const union nand_boot_header *hdr_nand);
|
||||
+
|
||||
+/* Get nand info from nand header (page size, spare size, ...) */
|
||||
+int mtk_nand_header_info(const void *ptr, struct nand_header_info *info);
|
||||
+
|
||||
+/* Whether given header data is valid */
|
||||
+bool is_mtk_nand_header(const void *ptr);
|
||||
+
|
||||
+/* Generate Device header using give nand header */
|
||||
+uint32_t mtk_nand_header_put(const union nand_boot_header *hdr_nand, void *ptr);
|
||||
+
|
||||
+#endif /* _MTK_NAND_HEADERS_H */
|
@ -1,702 +0,0 @@
|
||||
From fbf296f9ed5daab70020686e9ba072efe663bbab Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Aug 2022 11:14:36 +0800
|
||||
Subject: [PATCH 30/31] tools: mtk_image: add support for nand headers used by
|
||||
newer chips
|
||||
|
||||
This patch adds more nand headers in two new types:
|
||||
1. HSM header, used for spi-nand thru SNFI interface
|
||||
2. SPIM header, used for spi-nand thru spi-mem interface
|
||||
|
||||
The original nand header is renamed to AP header.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
tools/mtk_image.c | 23 ++-
|
||||
tools/mtk_nand_headers.c | 422 +++++++++++++++++++++++++++++++++++++--
|
||||
tools/mtk_nand_headers.h | 110 +++++++++-
|
||||
3 files changed, 525 insertions(+), 30 deletions(-)
|
||||
|
||||
--- a/tools/mtk_image.c
|
||||
+++ b/tools/mtk_image.c
|
||||
@@ -31,6 +31,9 @@ static const struct brom_img_type {
|
||||
}, {
|
||||
.name = "snand",
|
||||
.type = BRLYT_TYPE_SNAND
|
||||
+ }, {
|
||||
+ .name = "spim-nand",
|
||||
+ .type = BRLYT_TYPE_SNAND
|
||||
}
|
||||
};
|
||||
|
||||
@@ -48,7 +51,7 @@ static bool is_arm64_image;
|
||||
static char lk_name[32] = "U-Boot";
|
||||
|
||||
/* NAND header selected by user */
|
||||
-static const union nand_boot_header *hdr_nand;
|
||||
+static const struct nand_header_type *hdr_nand;
|
||||
static uint32_t hdr_nand_size;
|
||||
|
||||
/* GFH header + 2 * 4KB pages of NAND */
|
||||
@@ -318,20 +321,26 @@ static int mtk_image_verify_nand_header(
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
- bh = (struct brom_layout_header *)(ptr + info.page_size);
|
||||
+ if (!ret) {
|
||||
+ bh = (struct brom_layout_header *)(ptr + info.page_size);
|
||||
|
||||
- if (strcmp(bh->name, BRLYT_NAME))
|
||||
- return -1;
|
||||
+ if (strcmp(bh->name, BRLYT_NAME))
|
||||
+ return -1;
|
||||
+
|
||||
+ if (le32_to_cpu(bh->magic) != BRLYT_MAGIC)
|
||||
+ return -1;
|
||||
|
||||
- if (le32_to_cpu(bh->magic) != BRLYT_MAGIC) {
|
||||
- return -1;
|
||||
- } else {
|
||||
if (le32_to_cpu(bh->type) == BRLYT_TYPE_NAND)
|
||||
bootmedia = "Parallel NAND";
|
||||
else if (le32_to_cpu(bh->type) == BRLYT_TYPE_SNAND)
|
||||
bootmedia = "Serial NAND (SNFI/AP)";
|
||||
else
|
||||
return -1;
|
||||
+ } else {
|
||||
+ if (info.snfi)
|
||||
+ bootmedia = "Serial NAND (SNFI/HSM)";
|
||||
+ else
|
||||
+ bootmedia = "Serial NAND (SPIM)";
|
||||
}
|
||||
|
||||
if (print) {
|
||||
--- a/tools/mtk_nand_headers.c
|
||||
+++ b/tools/mtk_nand_headers.c
|
||||
@@ -188,55 +188,346 @@ static const union nand_boot_header nand
|
||||
}
|
||||
};
|
||||
|
||||
-static const struct nand_header_type {
|
||||
+/* HSM BROM NAND header for SPI NAND with 2KB page + 64B spare */
|
||||
+static const union hsm_nand_boot_header hsm_nand_hdr_2k_64_data = {
|
||||
+ .data = {
|
||||
+ 0x4E, 0x41, 0x4E, 0x44, 0x43, 0x46, 0x47, 0x21,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x08, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||
+ 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
+ 0xFF, 0x00, 0x00, 0x00, 0x21, 0xD2, 0xEE, 0xF6,
|
||||
+ 0xAE, 0xDD, 0x5E, 0xC2, 0x82, 0x8E, 0x9A, 0x62,
|
||||
+ 0x09, 0x8E, 0x80, 0xE2, 0x37, 0x0D, 0xC9, 0xFA,
|
||||
+ 0xA9, 0xDD, 0xFC, 0x92, 0x34, 0x2A, 0xED, 0x51,
|
||||
+ 0xA4, 0x1B, 0xF7, 0x63, 0xCC, 0x5A, 0xC7, 0xFB,
|
||||
+ 0xED, 0x21, 0x02, 0x23, 0x51, 0x31
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* HSM BROM NAND header for SPI NAND with 2KB page + 128B spare */
|
||||
+static const union hsm_nand_boot_header hsm_nand_hdr_2k_128_data = {
|
||||
+ .data = {
|
||||
+ 0x4E, 0x41, 0x4E, 0x44, 0x43, 0x46, 0x47, 0x21,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x08, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
|
||||
+ 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
+ 0xFF, 0x00, 0x00, 0x00, 0x71, 0x7f, 0x71, 0xAC,
|
||||
+ 0x42, 0xD0, 0x5B, 0xD2, 0x12, 0x81, 0x15, 0x0A,
|
||||
+ 0x0C, 0xD4, 0xF6, 0x32, 0x1E, 0x63, 0xE7, 0x81,
|
||||
+ 0x8A, 0x7F, 0xDE, 0xF9, 0x4B, 0x91, 0xEC, 0xC2,
|
||||
+ 0x70, 0x00, 0x7F, 0x57, 0xAF, 0xDC, 0xE4, 0x24,
|
||||
+ 0x57, 0x09, 0xBC, 0xC5, 0x35, 0xDC
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* HSM BROM NAND header for SPI NAND with 4KB page + 256B spare */
|
||||
+static const union hsm_nand_boot_header hsm_nand_hdr_4k_256_data = {
|
||||
+ .data = {
|
||||
+ 0x4E, 0x41, 0x4E, 0x44, 0x43, 0x46, 0x47, 0x21,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||
+ 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
+ 0xFF, 0x00, 0x00, 0x00, 0x62, 0x04, 0xD6, 0x1F,
|
||||
+ 0x2B, 0x57, 0x7A, 0x2D, 0xFE, 0xBB, 0x4A, 0x50,
|
||||
+ 0xEC, 0xF8, 0x70, 0x1A, 0x44, 0x15, 0xF6, 0xA2,
|
||||
+ 0x8E, 0xB0, 0xFD, 0xFA, 0xDC, 0xAA, 0x5A, 0x4E,
|
||||
+ 0xCB, 0x8E, 0xC9, 0x72, 0x08, 0xDC, 0x20, 0xB9,
|
||||
+ 0x98, 0xC8, 0x82, 0xD8, 0xBE, 0x44
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* HSM2.0 BROM NAND header for SPI NAND with 2KB page + 64B spare */
|
||||
+static const union hsm20_nand_boot_header hsm20_nand_hdr_2k_64_data = {
|
||||
+ .data = {
|
||||
+ 0x4E, 0x41, 0x4E, 0x44, 0x43, 0x46, 0x47, 0x21,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
+ 0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x08, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||
+ 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x5F, 0x4B, 0xB2, 0x5B, 0x8B, 0x1C, 0x35, 0xDA,
|
||||
+ 0x83, 0xE6, 0x6C, 0xC3, 0xFB, 0x8C, 0x78, 0x23,
|
||||
+ 0xD0, 0x89, 0x24, 0xD9, 0x6C, 0x35, 0x2C, 0x5D,
|
||||
+ 0x8F, 0xBB, 0xFC, 0x10, 0xD0, 0xE2, 0x22, 0x7D,
|
||||
+ 0xC8, 0x97, 0x9A, 0xEF, 0xC6, 0xB5, 0xA7, 0x4E,
|
||||
+ 0x4E, 0x0E
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* HSM2.0 BROM NAND header for SPI NAND with 2KB page + 128B spare */
|
||||
+static const union hsm20_nand_boot_header hsm20_nand_hdr_2k_128_data = {
|
||||
+ .data = {
|
||||
+ 0x4E, 0x41, 0x4E, 0x44, 0x43, 0x46, 0x47, 0x21,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
+ 0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x08, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||
+ 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0xF8, 0x7E, 0xC1, 0x5D, 0x61, 0x54, 0xEA, 0x9F,
|
||||
+ 0x5E, 0x66, 0x39, 0x66, 0x21, 0xFF, 0x8C, 0x3B,
|
||||
+ 0xBE, 0xA7, 0x5A, 0x9E, 0xD7, 0xBD, 0x9E, 0x89,
|
||||
+ 0xEE, 0x7E, 0x10, 0x31, 0x9A, 0x1D, 0x82, 0x49,
|
||||
+ 0xA3, 0x4E, 0xD8, 0x47, 0xD7, 0x19, 0xF4, 0x2D,
|
||||
+ 0x8E, 0x53
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* HSM2.0 BROM NAND header for SPI NAND with 4KB page + 256B spare */
|
||||
+static const union hsm20_nand_boot_header hsm20_nand_hdr_4k_256_data = {
|
||||
+ .data = {
|
||||
+ 0x4E, 0x41, 0x4E, 0x44, 0x43, 0x46, 0x47, 0x21,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
+ 0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
||||
+ 0x40, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||
+ 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x79, 0x01, 0x1F, 0x86, 0x62, 0x6A, 0x43, 0xAE,
|
||||
+ 0xE6, 0xF8, 0xDD, 0x5B, 0x29, 0xB7, 0xA2, 0x7F,
|
||||
+ 0x29, 0x72, 0x54, 0x37, 0xBE, 0x50, 0xD4, 0x24,
|
||||
+ 0xAB, 0x60, 0xF4, 0x44, 0x97, 0x3B, 0x65, 0x21,
|
||||
+ 0x73, 0x24, 0x1F, 0x93, 0x0E, 0x9E, 0x96, 0x88,
|
||||
+ 0x78, 0x6C
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* SPIM-NAND header for SPI NAND with 2KB page + 64B spare */
|
||||
+static const union spim_nand_boot_header spim_nand_hdr_2k_64_data = {
|
||||
+ .data = {
|
||||
+ 0x53, 0x50, 0x49, 0x4e, 0x41, 0x4e, 0x44, 0x21,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x08, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
+ 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x30,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* SPIM-NAND header for SPI NAND with 2KB page + 128B spare */
|
||||
+static const union spim_nand_boot_header spim_nand_hdr_2k_128_data = {
|
||||
+ .data = {
|
||||
+ 0x53, 0x50, 0x49, 0x4e, 0x41, 0x4e, 0x44, 0x21,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x08, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
|
||||
+ 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x30,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+/* SPIM-NAND header for SPI NAND with 4KB page + 256B spare */
|
||||
+static const union spim_nand_boot_header spim_nand_hdr_4k_256_data = {
|
||||
+ .data = {
|
||||
+ 0x53, 0x50, 0x49, 0x4e, 0x41, 0x4e, 0x44, 0x21,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
||||
+ 0x40, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x30,
|
||||
+ 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+struct nand_header_type {
|
||||
const char *name;
|
||||
- const union nand_boot_header *data;
|
||||
+ enum nand_boot_header_type type;
|
||||
+ union {
|
||||
+ const union nand_boot_header *ap;
|
||||
+ const union hsm_nand_boot_header *hsm;
|
||||
+ const union hsm20_nand_boot_header *hsm20;
|
||||
+ const union spim_nand_boot_header *spim;
|
||||
+ };
|
||||
} nand_headers[] = {
|
||||
{
|
||||
.name = "2k+64",
|
||||
- .data = &snand_hdr_2k_64_data
|
||||
+ .type = NAND_BOOT_AP_HEADER,
|
||||
+ .ap = &snand_hdr_2k_64_data,
|
||||
}, {
|
||||
.name = "2k+120",
|
||||
- .data = &snand_hdr_2k_128_data
|
||||
+ .type = NAND_BOOT_AP_HEADER,
|
||||
+ .ap = &snand_hdr_2k_128_data,
|
||||
}, {
|
||||
.name = "2k+128",
|
||||
- .data = &snand_hdr_2k_128_data
|
||||
+ .type = NAND_BOOT_AP_HEADER,
|
||||
+ .ap = &snand_hdr_2k_128_data,
|
||||
}, {
|
||||
.name = "4k+256",
|
||||
- .data = &snand_hdr_4k_256_data
|
||||
+ .type = NAND_BOOT_AP_HEADER,
|
||||
+ .ap = &snand_hdr_4k_256_data,
|
||||
}, {
|
||||
.name = "1g:2k+64",
|
||||
- .data = &nand_hdr_1gb_2k_64_data
|
||||
+ .type = NAND_BOOT_AP_HEADER,
|
||||
+ .ap = &nand_hdr_1gb_2k_64_data,
|
||||
}, {
|
||||
.name = "2g:2k+64",
|
||||
- .data = &nand_hdr_2gb_2k_64_data
|
||||
+ .type = NAND_BOOT_AP_HEADER,
|
||||
+ .ap = &nand_hdr_2gb_2k_64_data,
|
||||
}, {
|
||||
.name = "4g:2k+64",
|
||||
- .data = &nand_hdr_4gb_2k_64_data
|
||||
+ .type = NAND_BOOT_AP_HEADER,
|
||||
+ .ap = &nand_hdr_4gb_2k_64_data,
|
||||
}, {
|
||||
.name = "2g:2k+128",
|
||||
- .data = &nand_hdr_2gb_2k_128_data
|
||||
+ .type = NAND_BOOT_AP_HEADER,
|
||||
+ .ap = &nand_hdr_2gb_2k_128_data,
|
||||
}, {
|
||||
.name = "4g:2k+128",
|
||||
- .data = &nand_hdr_4gb_2k_128_data
|
||||
+ .type = NAND_BOOT_AP_HEADER,
|
||||
+ .ap = &nand_hdr_4gb_2k_128_data,
|
||||
+ }, {
|
||||
+ .name = "hsm:2k+64",
|
||||
+ .type = NAND_BOOT_HSM_HEADER,
|
||||
+ .hsm = &hsm_nand_hdr_2k_64_data,
|
||||
+ }, {
|
||||
+ .name = "hsm:2k+128",
|
||||
+ .type = NAND_BOOT_HSM_HEADER,
|
||||
+ .hsm = &hsm_nand_hdr_2k_128_data,
|
||||
+ }, {
|
||||
+ .name = "hsm:4k+256",
|
||||
+ .type = NAND_BOOT_HSM_HEADER,
|
||||
+ .hsm = &hsm_nand_hdr_4k_256_data,
|
||||
+ }, {
|
||||
+ .name = "hsm20:2k+64",
|
||||
+ .type = NAND_BOOT_HSM20_HEADER,
|
||||
+ .hsm20 = &hsm20_nand_hdr_2k_64_data,
|
||||
+ }, {
|
||||
+ .name = "hsm20:2k+128",
|
||||
+ .type = NAND_BOOT_HSM20_HEADER,
|
||||
+ .hsm20 = &hsm20_nand_hdr_2k_128_data,
|
||||
+ }, {
|
||||
+ .name = "hsm20:4k+256",
|
||||
+ .type = NAND_BOOT_HSM20_HEADER,
|
||||
+ .hsm20 = &hsm20_nand_hdr_4k_256_data,
|
||||
+ }, {
|
||||
+ .name = "spim:2k+64",
|
||||
+ .type = NAND_BOOT_SPIM_HEADER,
|
||||
+ .spim = &spim_nand_hdr_2k_64_data,
|
||||
+ }, {
|
||||
+ .name = "spim:2k+128",
|
||||
+ .type = NAND_BOOT_SPIM_HEADER,
|
||||
+ .spim = &spim_nand_hdr_2k_128_data,
|
||||
+ }, {
|
||||
+ .name = "spim:4k+256",
|
||||
+ .type = NAND_BOOT_SPIM_HEADER,
|
||||
+ .spim = &spim_nand_hdr_4k_256_data,
|
||||
}
|
||||
};
|
||||
|
||||
-const union nand_boot_header *mtk_nand_header_find(const char *name)
|
||||
+const struct nand_header_type *mtk_nand_header_find(const char *name)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(nand_headers); i++) {
|
||||
if (!strcmp(nand_headers[i].name, name))
|
||||
- return nand_headers[i].data;
|
||||
+ return &nand_headers[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-uint32_t mtk_nand_header_size(const union nand_boot_header *hdr_nand)
|
||||
+uint32_t mtk_nand_header_size(const struct nand_header_type *hdr_nand)
|
||||
{
|
||||
- return 2 * le16_to_cpu(hdr_nand->pagesize);
|
||||
+ switch (hdr_nand->type) {
|
||||
+ case NAND_BOOT_HSM_HEADER:
|
||||
+ return le32_to_cpu(hdr_nand->hsm->page_size);
|
||||
+
|
||||
+ case NAND_BOOT_HSM20_HEADER:
|
||||
+ return le32_to_cpu(hdr_nand->hsm20->page_size);
|
||||
+
|
||||
+ case NAND_BOOT_SPIM_HEADER:
|
||||
+ return le32_to_cpu(hdr_nand->spim->page_size);
|
||||
+
|
||||
+ default:
|
||||
+ return 2 * le16_to_cpu(hdr_nand->ap->pagesize);
|
||||
+ }
|
||||
}
|
||||
|
||||
static int mtk_nand_header_ap_info(const void *ptr,
|
||||
@@ -251,14 +542,45 @@ static int mtk_nand_header_ap_info(const
|
||||
info->page_size = le16_to_cpu(nh->pagesize);
|
||||
info->spare_size = le16_to_cpu(nh->oobsize);
|
||||
info->gfh_offset = 2 * info->page_size;
|
||||
+ info->snfi = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int mtk_nand_header_hsm_info(const void *ptr,
|
||||
+ struct nand_header_info *info)
|
||||
+{
|
||||
+ union hsm_nand_boot_header *nh = (union hsm_nand_boot_header *)ptr;
|
||||
+
|
||||
+ info->page_size = le16_to_cpu(nh->page_size);
|
||||
+ info->spare_size = le16_to_cpu(nh->spare_size);
|
||||
+ info->gfh_offset = info->page_size;
|
||||
+ info->snfi = true;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static int mtk_nand_header_spim_info(const void *ptr,
|
||||
+ struct nand_header_info *info)
|
||||
+{
|
||||
+ union spim_nand_boot_header *nh = (union spim_nand_boot_header *)ptr;
|
||||
+
|
||||
+ info->page_size = le16_to_cpu(nh->page_size);
|
||||
+ info->spare_size = le16_to_cpu(nh->spare_size);
|
||||
+ info->gfh_offset = info->page_size;
|
||||
+ info->snfi = false;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
int mtk_nand_header_info(const void *ptr, struct nand_header_info *info)
|
||||
{
|
||||
if (!strcmp((char *)ptr, NAND_BOOT_NAME))
|
||||
return mtk_nand_header_ap_info(ptr, info);
|
||||
+ else if (!strncmp((char *)ptr, HSM_NAND_BOOT_NAME, 8))
|
||||
+ return mtk_nand_header_hsm_info(ptr, info);
|
||||
+ else if (!strncmp((char *)ptr, SPIM_NAND_BOOT_NAME, 8))
|
||||
+ return mtk_nand_header_spim_info(ptr, info);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -273,14 +595,74 @@ bool is_mtk_nand_header(const void *ptr)
|
||||
return false;
|
||||
}
|
||||
|
||||
-uint32_t mtk_nand_header_put(const union nand_boot_header *hdr_nand, void *ptr)
|
||||
+static uint16_t crc16(const uint8_t *p, uint32_t len)
|
||||
+{
|
||||
+ uint16_t crc = 0x4f4e;
|
||||
+ uint32_t i;
|
||||
+
|
||||
+ while (len--) {
|
||||
+ crc ^= *p++ << 8;
|
||||
+ for (i = 0; i < 8; i++)
|
||||
+ crc = (crc << 1) ^ ((crc & 0x8000) ? 0x8005 : 0);
|
||||
+ }
|
||||
+
|
||||
+ return crc;
|
||||
+}
|
||||
+
|
||||
+static uint32_t mtk_nand_header_put_ap(const struct nand_header_type *hdr_nand,
|
||||
+ void *ptr)
|
||||
{
|
||||
- union nand_boot_header *nh = (union nand_boot_header *)ptr;
|
||||
int i;
|
||||
|
||||
/* NAND device header, repeat 4 times */
|
||||
- for (i = 0; i < 4; i++)
|
||||
- memcpy(nh + i, hdr_nand, sizeof(union nand_boot_header));
|
||||
+ for (i = 0; i < 4; i++) {
|
||||
+ memcpy(ptr, hdr_nand->ap, sizeof(*hdr_nand->ap));
|
||||
+ ptr += sizeof(*hdr_nand->ap);
|
||||
+ }
|
||||
+
|
||||
+ return le16_to_cpu(hdr_nand->ap->pagesize);
|
||||
+}
|
||||
|
||||
- return le16_to_cpu(hdr_nand->pagesize);
|
||||
+static uint32_t mtk_nand_header_put_hsm(const struct nand_header_type *hdr_nand,
|
||||
+ void *ptr)
|
||||
+{
|
||||
+ memcpy(ptr, hdr_nand->hsm, sizeof(*hdr_nand->hsm));
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static uint32_t mtk_nand_header_put_hsm20(const struct nand_header_type *hdr_nand,
|
||||
+ void *ptr)
|
||||
+{
|
||||
+ memcpy(ptr, hdr_nand->hsm20, sizeof(*hdr_nand->hsm20));
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static uint32_t mtk_nand_header_put_spim(const struct nand_header_type *hdr_nand,
|
||||
+ void *ptr)
|
||||
+{
|
||||
+ uint16_t crc;
|
||||
+
|
||||
+ memcpy(ptr, hdr_nand->spim, sizeof(*hdr_nand->spim));
|
||||
+
|
||||
+ crc = crc16(ptr, 0x4e);
|
||||
+ memcpy(ptr + 0x4e, &crc, sizeof(uint16_t));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+uint32_t mtk_nand_header_put(const struct nand_header_type *hdr_nand, void *ptr)
|
||||
+{
|
||||
+ switch (hdr_nand->type) {
|
||||
+ case NAND_BOOT_HSM_HEADER:
|
||||
+ return mtk_nand_header_put_hsm(hdr_nand, ptr);
|
||||
+
|
||||
+ case NAND_BOOT_HSM20_HEADER:
|
||||
+ return mtk_nand_header_put_hsm20(hdr_nand, ptr);
|
||||
+
|
||||
+ case NAND_BOOT_SPIM_HEADER:
|
||||
+ return mtk_nand_header_put_spim(hdr_nand, ptr);
|
||||
+
|
||||
+ default:
|
||||
+ return mtk_nand_header_put_ap(hdr_nand, ptr);
|
||||
+ }
|
||||
}
|
||||
--- a/tools/mtk_nand_headers.h
|
||||
+++ b/tools/mtk_nand_headers.h
|
||||
@@ -16,6 +16,7 @@ struct nand_header_info {
|
||||
uint32_t page_size;
|
||||
uint32_t spare_size;
|
||||
uint32_t gfh_offset;
|
||||
+ bool snfi;
|
||||
};
|
||||
|
||||
/* AP BROM Header for NAND */
|
||||
@@ -39,15 +40,117 @@ union nand_boot_header {
|
||||
uint8_t data[0x80];
|
||||
};
|
||||
|
||||
+/* HSM BROM Header for NAND */
|
||||
+union hsm_nand_boot_header {
|
||||
+ struct {
|
||||
+ char id[8];
|
||||
+ uint32_t version; /* Header version */
|
||||
+ uint32_t config; /* Header config */
|
||||
+ uint32_t sector_size; /* ECC step size */
|
||||
+ uint32_t fdm_size; /* User OOB size of a step */
|
||||
+ uint32_t fdm_ecc_size; /* ECC parity size of a step */
|
||||
+ uint32_t lbs;
|
||||
+ uint32_t page_size; /* NAND page size */
|
||||
+ uint32_t spare_size; /* NAND page spare size */
|
||||
+ uint32_t page_per_block; /* Pages of one block */
|
||||
+ uint32_t blocks; /* Total blocks of NAND chip */
|
||||
+ uint32_t plane_sel_position; /* Plane bit position */
|
||||
+ uint32_t pll; /* Value of pll reg */
|
||||
+ uint32_t acccon; /* Value of access timing reg */
|
||||
+ uint32_t strobe_sel; /* Value of DQS selection reg*/
|
||||
+ uint32_t acccon1; /* Value of access timing reg */
|
||||
+ uint32_t dqs_mux; /* Value of DQS mux reg */
|
||||
+ uint32_t dqs_ctrl; /* Value of DQS control reg */
|
||||
+ uint32_t delay_ctrl; /* Value of delay ctrl reg */
|
||||
+ uint32_t latch_lat; /* Value of latch latency reg */
|
||||
+ uint32_t sample_delay; /* Value of sample delay reg */
|
||||
+ uint32_t driving; /* Value of driving reg */
|
||||
+ uint32_t bl_start; /* Bootloader start addr */
|
||||
+ uint32_t bl_end; /* Bootloader end addr */
|
||||
+ uint8_t ecc_parity[42]; /* ECC parity of this header */
|
||||
+ };
|
||||
+
|
||||
+ uint8_t data[0x8E];
|
||||
+};
|
||||
+
|
||||
+/* HSM2.0 BROM Header for NAND */
|
||||
+union hsm20_nand_boot_header {
|
||||
+ struct {
|
||||
+ char id[8];
|
||||
+ uint32_t version; /* Header version */
|
||||
+ uint32_t config; /* Header config */
|
||||
+ uint32_t sector_size; /* ECC step size */
|
||||
+ uint32_t fdm_size; /* User OOB size of a step */
|
||||
+ uint32_t fdm_ecc_size; /* ECC parity size of a step */
|
||||
+ uint32_t lbs;
|
||||
+ uint32_t page_size; /* NAND page size */
|
||||
+ uint32_t spare_size; /* NAND page spare size */
|
||||
+ uint32_t page_per_block; /* Pages of one block */
|
||||
+ uint32_t blocks; /* Total blocks of NAND chip */
|
||||
+ uint32_t plane_sel_position; /* Plane bit position */
|
||||
+ uint32_t pll; /* Value of pll reg */
|
||||
+ uint32_t acccon; /* Value of access timing reg */
|
||||
+ uint32_t strobe_sel; /* Value of DQS selection reg*/
|
||||
+ uint32_t acccon1; /* Value of access timing reg */
|
||||
+ uint32_t dqs_mux; /* Value of DQS mux reg */
|
||||
+ uint32_t dqs_ctrl; /* Value of DQS control reg */
|
||||
+ uint32_t delay_ctrl; /* Value of delay ctrl reg */
|
||||
+ uint32_t latch_lat; /* Value of latch latency reg */
|
||||
+ uint32_t sample_delay; /* Value of sample delay reg */
|
||||
+ uint32_t driving; /* Value of driving reg */
|
||||
+ uint32_t reserved;
|
||||
+ uint32_t bl0_start; /* Bootloader start addr */
|
||||
+ uint32_t bl0_end; /* Bootloader end addr */
|
||||
+ uint32_t bl0_type; /* Bootloader type */
|
||||
+ uint8_t bl_reserve[84];
|
||||
+ uint8_t ecc_parity[42]; /* ECC parity of this header */
|
||||
+ };
|
||||
+
|
||||
+ uint8_t data[0xEA];
|
||||
+};
|
||||
+
|
||||
+/* SPIM BROM Header for SPI-NAND */
|
||||
+union spim_nand_boot_header {
|
||||
+ struct {
|
||||
+ char id[8];
|
||||
+ uint32_t version; /* Header version */
|
||||
+ uint32_t config; /* Header config */
|
||||
+ uint32_t page_size; /* NAND page size */
|
||||
+ uint32_t spare_size; /* NAND page spare size */
|
||||
+ uint16_t page_per_block; /* Pages of one block */
|
||||
+ uint16_t plane_sel_position; /* Plane bit position */
|
||||
+ uint16_t reserve_reg;
|
||||
+ uint16_t reserve_val;
|
||||
+ uint16_t ecc_error; /* ECC error reg addr */
|
||||
+ uint16_t ecc_mask; /* ECC error bit mask */
|
||||
+ uint32_t bl_start; /* Bootloader start addr */
|
||||
+ uint32_t bl_end; /* Bootloader end addr */
|
||||
+ uint8_t ecc_parity[32]; /* ECC parity of this header */
|
||||
+ uint32_t integrity_crc; /* CRC of this header */
|
||||
+ };
|
||||
+
|
||||
+ uint8_t data[0x50];
|
||||
+};
|
||||
+
|
||||
+enum nand_boot_header_type {
|
||||
+ NAND_BOOT_AP_HEADER,
|
||||
+ NAND_BOOT_HSM_HEADER,
|
||||
+ NAND_BOOT_HSM20_HEADER,
|
||||
+ NAND_BOOT_SPIM_HEADER
|
||||
+};
|
||||
+
|
||||
#define NAND_BOOT_NAME "BOOTLOADER!"
|
||||
#define NAND_BOOT_VERSION "V006"
|
||||
#define NAND_BOOT_ID "NFIINFO"
|
||||
|
||||
+#define HSM_NAND_BOOT_NAME "NANDCFG!"
|
||||
+#define SPIM_NAND_BOOT_NAME "SPINAND!"
|
||||
+
|
||||
/* Find nand header data by name */
|
||||
-const union nand_boot_header *mtk_nand_header_find(const char *name);
|
||||
+const struct nand_header_type *mtk_nand_header_find(const char *name);
|
||||
|
||||
/* Device header size using this nand header */
|
||||
-uint32_t mtk_nand_header_size(const union nand_boot_header *hdr_nand);
|
||||
+uint32_t mtk_nand_header_size(const struct nand_header_type *hdr_nand);
|
||||
|
||||
/* Get nand info from nand header (page size, spare size, ...) */
|
||||
int mtk_nand_header_info(const void *ptr, struct nand_header_info *info);
|
||||
@@ -56,6 +159,7 @@ int mtk_nand_header_info(const void *ptr
|
||||
bool is_mtk_nand_header(const void *ptr);
|
||||
|
||||
/* Generate Device header using give nand header */
|
||||
-uint32_t mtk_nand_header_put(const union nand_boot_header *hdr_nand, void *ptr);
|
||||
+uint32_t mtk_nand_header_put(const struct nand_header_type *hdr_nand,
|
||||
+ void *ptr);
|
||||
|
||||
#endif /* _MTK_NAND_HEADERS_H */
|
@ -2,7 +2,7 @@ This patch makes it possible to set a custom image magic.
|
||||
|
||||
--- a/tools/mkimage.c
|
||||
+++ b/tools/mkimage.c
|
||||
@@ -24,6 +24,7 @@ static struct image_tool_params params =
|
||||
@@ -26,6 +26,7 @@ static struct image_tool_params params =
|
||||
.arch = IH_ARCH_PPC,
|
||||
.type = IH_TYPE_KERNEL,
|
||||
.comp = IH_COMP_GZIP,
|
||||
@ -10,8 +10,8 @@ This patch makes it possible to set a custom image magic.
|
||||
.dtc = MKIMAGE_DEFAULT_DTC_OPTIONS,
|
||||
.imagename = "",
|
||||
.imagename2 = "",
|
||||
@@ -85,11 +86,12 @@ static void usage(const char *msg)
|
||||
" -l ==> list image header information\n",
|
||||
@@ -89,11 +90,12 @@ static void usage(const char *msg)
|
||||
" -q ==> quiet\n",
|
||||
params.cmdname);
|
||||
fprintf(stderr,
|
||||
- " %s [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image\n"
|
||||
@ -24,16 +24,16 @@ This patch makes it possible to set a custom image magic.
|
||||
" -a ==> set load address to 'addr' (hex)\n"
|
||||
" -e ==> set entry point to 'ep' (hex)\n"
|
||||
" -n ==> set image name to 'name'\n"
|
||||
@@ -155,7 +157,7 @@ static void process_args(int argc, char
|
||||
int opt;
|
||||
@@ -159,7 +161,7 @@ static int add_content(int type, const c
|
||||
}
|
||||
|
||||
while ((opt = getopt(argc, argv,
|
||||
- "a:A:b:B:c:C:d:D:e:Ef:FG:k:i:K:ln:N:p:O:rR:qstT:vVx")) != -1) {
|
||||
+ "a:A:b:B:c:C:d:D:e:Ef:FG:k:i:K:lM:n:N:p:O:rR:qstT:vVx")) != -1) {
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
params.addr = strtoull(optarg, &ptr, 16);
|
||||
@@ -245,6 +247,14 @@ static void process_args(int argc, char
|
||||
static const char optstring[] =
|
||||
- "a:A:b:B:c:C:d:D:e:Ef:Fg:G:i:k:K:ln:N:o:O:p:qrR:stT:vVx";
|
||||
+ "a:A:b:B:c:C:d:D:e:Ef:Fg:G:i:k:K:lM:n:N:o:O:p:qrR:stT:vVx";
|
||||
|
||||
static const struct option longopts[] = {
|
||||
{ "load-address", required_argument, NULL, 'a' },
|
||||
@@ -298,6 +300,14 @@ static void process_args(int argc, char
|
||||
case 'l':
|
||||
params.lflag = 1;
|
||||
break;
|
||||
@ -50,6 +50,15 @@ This patch makes it possible to set a custom image magic.
|
||||
break;
|
||||
--- a/tools/default_image.c
|
||||
+++ b/tools/default_image.c
|
||||
@@ -56,7 +56,7 @@ static int image_verify_header(unsigned
|
||||
*/
|
||||
memcpy(hdr, ptr, sizeof(image_header_t));
|
||||
|
||||
- if (be32_to_cpu(hdr->ih_magic) != IH_MAGIC) {
|
||||
+ if (be32_to_cpu(hdr->ih_magic) != params->magic) {
|
||||
debug("%s: Bad Magic Number: \"%s\" is no valid image\n",
|
||||
params->cmdname, params->imagefile);
|
||||
return -FDT_ERR_BADMAGIC;
|
||||
@@ -120,7 +120,7 @@ static void image_set_header(void *ptr,
|
||||
}
|
||||
|
||||
@ -61,7 +70,7 @@ This patch makes it possible to set a custom image magic.
|
||||
image_set_load(hdr, addr);
|
||||
--- a/tools/imagetool.h
|
||||
+++ b/tools/imagetool.h
|
||||
@@ -56,6 +56,7 @@ struct image_tool_params {
|
||||
@@ -59,6 +59,7 @@ struct image_tool_params {
|
||||
int arch;
|
||||
int type;
|
||||
int comp;
|
||||
|
@ -1,32 +0,0 @@
|
||||
diff --git a/tools/imagetool.h b/tools/imagetool.h
|
||||
index e229a34ffc..13775ff9b3 100644
|
||||
--- a/tools/imagetool.h
|
||||
+++ b/tools/imagetool.h
|
||||
@@ -271,11 +271,16 @@ int rockchip_copy_image(int fd, struct image_tool_params *mparams);
|
||||
* b) we need a API call to get the respective section symbols */
|
||||
#if defined(__MACH__)
|
||||
#include <mach-o/getsect.h>
|
||||
+#include <mach-o/dyld.h>
|
||||
|
||||
-#define INIT_SECTION(name) do { \
|
||||
+#define INIT_SECTION(name) struct image_type_params \
|
||||
+ **__cat(__start_, name), **__cat(__stop_, name); \
|
||||
+ do { \
|
||||
unsigned long name ## _len; \
|
||||
char *__cat(pstart_, name) = getsectdata("__DATA", \
|
||||
#name, &__cat(name, _len)); \
|
||||
+ __cat(pstart_, name) += \
|
||||
+ _dyld_get_image_vmaddr_slide(0); \
|
||||
char *__cat(pstop_, name) = __cat(pstart_, name) + \
|
||||
__cat(name, _len); \
|
||||
__cat(__start_, name) = (void *)__cat(pstart_, name); \
|
||||
@@ -283,7 +288,6 @@ int rockchip_copy_image(int fd, struct image_tool_params *mparams);
|
||||
} while (0)
|
||||
#define SECTION(name) __attribute__((section("__DATA, " #name)))
|
||||
|
||||
-struct image_type_params **__start_image_type, **__stop_image_type;
|
||||
#else
|
||||
#define INIT_SECTION(name) /* no-op for ELF */
|
||||
#define SECTION(name) __attribute__((section(#name)))
|
||||
--
|
||||
2.30.1 (Apple Git-130)
|
@ -0,0 +1,25 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Huangbin Zhan <zhanhb88@gmail.com>
|
||||
Date: Fri, 18 Feb 2022 14:19:23 +0800
|
||||
Subject: [PATCH] tools: disable TOOLS_FIT_FULL_CHECK
|
||||
|
||||
U-Boot disallows unit addresses by default. Disable TOOLS_FIT_FULL_CHECK
|
||||
to allow at symbol in node names.
|
||||
|
||||
https://github.com/openwrt/openwrt/commits/master/scripts/mkits.sh
|
||||
https://github.com/u-boot/u-boot/commit/3f04db891a353f4b127ed57279279f851c6b4917
|
||||
---
|
||||
tools/Kconfig | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/tools/Kconfig
|
||||
+++ b/tools/Kconfig
|
||||
@@ -31,7 +31,7 @@ config TOOLS_FIT
|
||||
Enable FIT support in the tools builds.
|
||||
|
||||
config TOOLS_FIT_FULL_CHECK
|
||||
- def_bool y
|
||||
+ bool "Do a full check of the FIT"
|
||||
help
|
||||
Do a full check of the FIT before using it in the tools builds
|
||||
|
@ -0,0 +1,11 @@
|
||||
--- a/tools/mkimage.h
|
||||
+++ b/tools/mkimage.h
|
||||
@@ -44,7 +44,7 @@ static inline ulong map_to_sysmem(void *
|
||||
#define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) type name[size]
|
||||
|
||||
#define MKIMAGE_TMPFILE_SUFFIX ".tmp"
|
||||
-#define MKIMAGE_MAX_TMPFILE_LEN 256
|
||||
+#define MKIMAGE_MAX_TMPFILE_LEN 1024
|
||||
#define MKIMAGE_DEFAULT_DTC_OPTIONS "-I dts -O dtb -p 500"
|
||||
#define MKIMAGE_MAX_DTC_CMDLINE_LEN 2 * MKIMAGE_MAX_TMPFILE_LEN + 35
|
||||
|
@ -1,14 +0,0 @@
|
||||
OpenWrt links the libressl statically against mkimage, make sure all the
|
||||
needed dependencies are added too.
|
||||
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -158,7 +158,7 @@ ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CON
|
||||
HOSTCFLAGS_kwbimage.o += \
|
||||
$(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "")
|
||||
HOSTLDLIBS_mkimage += \
|
||||
- $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
|
||||
+ $(shell pkg-config --libs --static libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
|
||||
|
||||
# OS X deprecate openssl in favour of CommonCrypto, supress deprecation
|
||||
# warnings on those systems
|
@ -1,33 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2010-2016 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:=mm-macros
|
||||
PKG_VERSION:=1.0.0
|
||||
|
||||
PKG_SOURCE_URL:=@GNOME/mm-common/1.0
|
||||
PKG_SOURCE:=mm-common-$(PKG_VERSION).tar.xz
|
||||
PKG_HASH:=b97d9b041e5952486cab620b44ab09f6013a478f43b6699ae899b8a4da189cd4
|
||||
|
||||
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/mm-common-$(PKG_VERSION)
|
||||
|
||||
HOST_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOST)/share/aclocal
|
||||
$(INSTALL_DATA) $(HOST_BUILD_DIR)/macros/*.m4 $(STAGING_DIR_HOST)/share/aclocal/
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
|
||||
$(call Host/Clean/Default)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
@ -25,4 +25,8 @@ HOST_CONFIGURE_ARGS += \
|
||||
--with-mpfr=$(TOPDIR)/staging_dir/host \
|
||||
--with-gmp=$(TOPDIR)/staging_dir/host
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -25,4 +25,8 @@ HOST_CONFIGURE_ARGS += \
|
||||
--enable-thread-safe \
|
||||
--with-gmp=$(STAGING_DIR_HOST)
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -7,11 +7,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mtools
|
||||
PKG_VERSION:=4.0.40
|
||||
PKG_VERSION:=4.0.41
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
|
||||
PKG_HASH:=a22fca42354011dd2293a7f51f228b46ebbd802e7740b0975912afecb79d5df4
|
||||
PKG_HASH:=2542152264fb3eff7ed70662abf4f4eef8133bc37d0b7a686c240df2b5f80a13
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
|
@ -22,4 +22,8 @@ include $(INCLUDE_DIR)/host-build.mk
|
||||
HOSTCC := $(HOSTCC_NOCACHE)
|
||||
HOSTCXX := $(HOSTCXX_NOCACHE)
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -24,4 +24,8 @@ define Host/Install
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/src/patchelf $(STAGING_DIR_HOST)/bin/patchelf
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -rf $(STAGING_DIR_HOST)/bin/patchelf
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -6,8 +6,8 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sparse
|
||||
|
||||
PKG_VERSION:=0.6.3
|
||||
PKG_HASH:=d4f6dbad8409e8e20a19f164b2c16f1edf76438ff77cf291935fde081b61a899
|
||||
PKG_VERSION:=0.6.4
|
||||
PKG_HASH:=6ab28b4991bc6aedbd73550291360aa6ab3df41f59206a9bde9690208a6e387c
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
@ -21,4 +21,8 @@ define Host/Install
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/sparse $(STAGING_DIR_HOST)/bin
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/sparse
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=squashfskit4
|
||||
PKG_VERSION:=4.14
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
PKG_SOURCE:=squashfskit-v$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://github.com/squashfskit/squashfskit/releases/download/v$(PKG_VERSION)/
|
||||
PKG_HASH:=5761aaa3aedc4f7112b708367d891c9abdc1ffea972e3fe47923ddba23984d95
|
||||
|
@ -28,16 +28,14 @@ Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
|
||||
squashfs-tools/mksquashfs.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/squashfs-tools/mksquashfs.h b/squashfs-tools/mksquashfs.h
|
||||
index 1beefef7..b6503063 100644
|
||||
--- a/squashfs-tools/mksquashfs.h
|
||||
+++ b/squashfs-tools/mksquashfs.h
|
||||
@@ -143,7 +143,7 @@ struct append_file {
|
||||
#endif
|
||||
@@ -133,7 +133,7 @@ struct append_file {
|
||||
#define BLOCK_OFFSET 2
|
||||
|
||||
extern struct cache *reader_buffer, *fragment_buffer, *reserve_cache;
|
||||
-struct cache *bwriter_buffer, *fwriter_buffer;
|
||||
+extern struct cache *bwriter_buffer, *fwriter_buffer;
|
||||
extern struct queue *to_reader, *to_deflate, *to_writer, *from_writer,
|
||||
*to_frag, *locked_fragment, *to_process_frag;
|
||||
*locked_fragment, *to_process_frag;
|
||||
extern struct append_file **file_mapping;
|
||||
|
14
tools/squashfskit4/patches/0020-big-endian.patch
Normal file
14
tools/squashfskit4/patches/0020-big-endian.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- a/squashfs-tools/xz_wrapper.c
|
||||
+++ b/squashfs-tools/xz_wrapper.c
|
||||
@@ -192,7 +192,10 @@ static void xz_display_options(void *buf
|
||||
if(size != sizeof(struct comp_opts))
|
||||
goto failed;
|
||||
|
||||
- SQUASHFS_INSWAP_LZMA_COMP_OPTS(comp_opts);
|
||||
+#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
+ comp_opts->dictionary_size = inswap_le32(comp_opts->dictionary_size);
|
||||
+ comp_opts->flags = inswap_le32(comp_opts->flags);
|
||||
+#endif
|
||||
|
||||
dictionary_size = comp_opts->dictionary_size;
|
||||
flags = comp_opts->flags;
|
@ -28,4 +28,8 @@ HOST_CONFIGURE_ARGS += \
|
||||
--disable-acl \
|
||||
--disable-nls
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -7,11 +7,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=upx
|
||||
PKG_VERSION:=3.95
|
||||
PKG_VERSION:=3.96
|
||||
|
||||
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
|
||||
PKG_HASH:=47774df5c958f2868ef550fb258b97c73272cb1f44fe776b798e393465993714
|
||||
|
||||
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)-src
|
||||
|
||||
|
@ -7,12 +7,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=xz
|
||||
PKG_VERSION:=5.2.6
|
||||
PKG_VERSION:=5.2.7
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=@SF/lzmautils \
|
||||
http://tukaani.org/xz
|
||||
PKG_HASH:=13e3402e301b6018f6a71ef0e497f714c6d11e214ae82dab156b81c2a64acb25
|
||||
PKG_HASH:=b65f1d0c2708e57716f4dd2216989a73847ac6fdb4168ffceb155767e22b834b
|
||||
PKG_CPE_ID:=cpe:/a:tukaani:xz
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
@ -33,4 +33,8 @@ define Host/Install
|
||||
+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) install xzlinks="unxz xzcat"
|
||||
endef
|
||||
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -32,5 +32,8 @@ define Host/Install
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/zip $(STAGING_DIR_HOST)/bin/
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -rf $(STAGING_DIR_HOST)/bin/zip
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
#$(eval $(call BuildPackage,zip))
|
||||
|
@ -1,145 +0,0 @@
|
||||
From 6d659fc87451c02c8777dc33f750b16834e4c715 Mon Sep 17 00:00:00 2001
|
||||
From: Mathias Kresin <dev@kresin.me>
|
||||
Date: Sat, 12 Jan 2019 19:33:33 +0100
|
||||
Subject: [PATCH] add option for reproducible archives
|
||||
|
||||
Add the option -mt/--mtime to pass a timestamp which is used as filedate
|
||||
for the containing files.
|
||||
|
||||
So far, it isn't used for anything written to the extra fields,
|
||||
therefore requires the -X (eXclude eXtra file attributes) parameter to
|
||||
be effective.
|
||||
|
||||
Signed-off-by: Mathias Kresin <dev@kresin.me>
|
||||
---
|
||||
globals.c | 1 +
|
||||
util.c | 22 ++++++++++++++++++++++
|
||||
zip.c | 6 ++++++
|
||||
zip.h | 1 +
|
||||
zipup.c | 4 +++-
|
||||
5 files changed, 33 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/globals.c
|
||||
+++ b/globals.c
|
||||
@@ -205,6 +205,7 @@ uzoff_t bytes_this_split = 0; /* byt
|
||||
int read_split_archive = 0; /* 1=scanzipf_reg detected spanning signature */
|
||||
int split_method = 0; /* 0=no splits, 1=seekable, 2=data desc, -1=no */
|
||||
uzoff_t split_size = 0; /* how big each split should be */
|
||||
+time_t timestamp = -1; /* fixed timestamp for archive content filedate */
|
||||
int split_bell = 0; /* when pause for next split ring bell */
|
||||
uzoff_t bytes_prev_splits = 0; /* total bytes written to all splits before this */
|
||||
uzoff_t bytes_this_entry = 0; /* bytes written for this entry across all splits */
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -1217,6 +1217,7 @@ int DisplayNumString(file, i)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+
|
||||
/* Read numbers with trailing size multiplier (like 10M) and return number.
|
||||
10/30/04 EG */
|
||||
|
||||
@@ -1279,6 +1280,29 @@ uzoff_t ReadNumString( numstring )
|
||||
}
|
||||
|
||||
|
||||
+uzoff_t ReadNumStringUL( numstring )
|
||||
+ char *numstring;
|
||||
+{
|
||||
+ zoff_t num = 0;
|
||||
+
|
||||
+ /* check if valid number (currently no negatives) */
|
||||
+ if (numstring == NULL) {
|
||||
+ zipwarn("Unable to read empty number in ReadNumString", "");
|
||||
+ return (uzoff_t)-1;
|
||||
+ }
|
||||
+ if (numstring[0] < '0' || numstring[0] > '9') {
|
||||
+ zipwarn("Unable to read number (must start with digit): ", numstring);
|
||||
+ return (uzoff_t)-1;
|
||||
+ }
|
||||
+ if (strlen(numstring) > 10) {
|
||||
+ zipwarn("Number too long to read (10 characters max): ", numstring);
|
||||
+ return (uzoff_t)-1;
|
||||
+ }
|
||||
+
|
||||
+ return (uzoff_t)atoll(numstring);
|
||||
+}
|
||||
+
|
||||
+
|
||||
/* Write the number as a string with a multiplier (like 10M) to outstring.
|
||||
Always writes no more than 3 digits followed maybe by a multiplier and
|
||||
returns the characters written or -1 if error.
|
||||
--- a/zip.c
|
||||
+++ b/zip.c
|
||||
@@ -1942,6 +1942,7 @@ int set_filetype(out_path)
|
||||
#ifdef UNICODE_TEST
|
||||
#define o_sC 0x146
|
||||
#endif
|
||||
+#define o_mt 0x255
|
||||
|
||||
|
||||
/* the below is mainly from the old main command line
|
||||
@@ -2036,6 +2037,7 @@ struct option_struct far options[] = {
|
||||
{"m", "move", o_NO_VALUE, o_NOT_NEGATABLE, 'm', "add files to archive then delete files"},
|
||||
{"mm", "", o_NO_VALUE, o_NOT_NEGATABLE, o_mm, "not used"},
|
||||
{"MM", "must-match", o_NO_VALUE, o_NOT_NEGATABLE, o_MM, "error if in file not matched/not readable"},
|
||||
+ {"mt", "mtime", o_REQUIRED_VALUE, o_NOT_NEGATABLE, o_mt, "use fixed timestamp for archive content filedate"},
|
||||
{"n", "suffixes", o_REQUIRED_VALUE, o_NOT_NEGATABLE, 'n', "suffixes to not compress: .gz:.zip"},
|
||||
{"nw", "no-wild", o_NO_VALUE, o_NOT_NEGATABLE, o_nw, "no wildcards during add or update"},
|
||||
#if defined(AMIGA) || defined(MACOS)
|
||||
@@ -2440,6 +2442,7 @@ char **argv; /* command line
|
||||
split_method = 0; /* 0=no splits, 1=update LHs, 2=data descriptors */
|
||||
split_size = 0; /* how big each split should be */
|
||||
split_bell = 0; /* when pause for next split ring bell */
|
||||
+ timestamp = -1; /* fixed timestamp for archive content filedate */
|
||||
bytes_prev_splits = 0; /* total bytes written to all splits before this */
|
||||
bytes_this_entry = 0; /* bytes written for this entry across all splits */
|
||||
noisy_splits = 0; /* be verbose about creating splits */
|
||||
@@ -2897,6 +2900,9 @@ char **argv; /* command line
|
||||
dispose = 1; break;
|
||||
case o_MM: /* Exit with error if input file can't be read */
|
||||
bad_open_is_error = 1; break;
|
||||
+ case o_mt: /* fixed timestamp for archive content filedate */
|
||||
+ timestamp = ReadNumStringUL(value);
|
||||
+ break;
|
||||
case 'n': /* Don't compress files with a special suffix */
|
||||
special = value;
|
||||
/* special = NULL; */ /* will be set at next argument */
|
||||
--- a/zip.h
|
||||
+++ b/zip.h
|
||||
@@ -502,6 +502,7 @@ extern uzoff_t bytes_this_split; /* byte
|
||||
extern int read_split_archive; /* 1=scanzipf_reg detected spanning signature */
|
||||
extern int split_method; /* 0=no splits, 1=seekable, 2=data descs, -1=no */
|
||||
extern uzoff_t split_size; /* how big each split should be */
|
||||
+extern time_t timestamp; /* fixed timestamp for archive content filedate */
|
||||
extern int split_bell; /* when pause for next split ring bell */
|
||||
extern uzoff_t bytes_prev_splits; /* total bytes written to all splits before this */
|
||||
extern uzoff_t bytes_this_entry; /* bytes written for this entry across all splits */
|
||||
@@ -789,6 +790,7 @@ char *zip_fzofft OF((zoff_t, char
|
||||
int DisplayNumString OF ((FILE *file, uzoff_t i));
|
||||
int WriteNumString OF((uzoff_t num, char *outstring));
|
||||
uzoff_t ReadNumString OF((char *numstring));
|
||||
+uzoff_t ReadNumStringUL OF((char *numstring));
|
||||
|
||||
/* returns true if abbrev is abbreviation for string */
|
||||
int abbrevmatch OF((char *, char *, int, int));
|
||||
--- a/zipup.c
|
||||
+++ b/zipup.c
|
||||
@@ -415,7 +415,6 @@ struct zlist far *z; /* zip entry to
|
||||
char *tempextra = NULL;
|
||||
char *tempcextra = NULL;
|
||||
|
||||
-
|
||||
#ifdef WINDLL
|
||||
# ifdef ZIP64_SUPPORT
|
||||
extern _int64 filesize64;
|
||||
@@ -441,6 +440,9 @@ struct zlist far *z; /* zip entry to
|
||||
if (tim == 0 || q == (zoff_t) -3)
|
||||
return ZE_OPEN;
|
||||
|
||||
+ if (timestamp > 0)
|
||||
+ tim = unix2dostime(×tamp);
|
||||
+
|
||||
/* q is set to -1 if the input file is a device, -2 for a volume label */
|
||||
if (q == (zoff_t) -2) {
|
||||
isdir = 1;
|
41
tools/zip/patches/011-reproducible-mtime.patch
Normal file
41
tools/zip/patches/011-reproducible-mtime.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 501ae4e93fd6fa2f7d20d00d1b011f9006802eae Mon Sep 17 00:00:00 2001
|
||||
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
|
||||
Date: Fri, 3 May 2019 16:32:24 +0200
|
||||
Subject: [PATCH] Override mtime with zip -X
|
||||
|
||||
with SOURCE_DATE_EPOCH
|
||||
to allow for reproducible builds of .zip files
|
||||
|
||||
See https://reproducible-builds.org/ for why this is good
|
||||
and https://reproducible-builds.org/specs/source-date-epoch/
|
||||
for the definition of this variable.
|
||||
|
||||
Uses clamping to keep older mtimes than SOURCE_DATE_EPOCH intact.
|
||||
---
|
||||
zipup.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
--- a/zipup.c
|
||||
+++ b/zipup.c
|
||||
@@ -414,6 +414,7 @@ struct zlist far *z; /* zip entry to
|
||||
ush tempcext = 0;
|
||||
char *tempextra = NULL;
|
||||
char *tempcextra = NULL;
|
||||
+ const char *source_date_epoch;
|
||||
|
||||
|
||||
#ifdef WINDLL
|
||||
@@ -674,6 +675,13 @@ struct zlist far *z; /* zip entry to
|
||||
|
||||
} /* strcmp(z->name, "-") == 0 */
|
||||
|
||||
+ if (extra_fields == 0 && (source_date_epoch = getenv("SOURCE_DATE_EPOCH")) != NULL) {
|
||||
+ time_t epoch = strtoull(source_date_epoch, NULL, 10);
|
||||
+ if (epoch > 0) {
|
||||
+ ulg epochtim = unix2dostime(&epoch);
|
||||
+ if (z->tim > epochtim) z->tim = epochtim;
|
||||
+ }
|
||||
+ }
|
||||
if (extra_fields == 2) {
|
||||
unsigned len;
|
||||
char *p;
|
@ -0,0 +1,75 @@
|
||||
From db9165814823401d57383a8f9e82642129cf4223 Mon Sep 17 00:00:00 2001
|
||||
From: Sungbo Eo <mans0n@gorani.run>
|
||||
Date: Sat, 12 Feb 2022 16:42:14 +0900
|
||||
Subject: [PATCH] make encrypted archives reproducible
|
||||
|
||||
Zip always try to generate new encryption header depending on execution
|
||||
time and process id, which is far from being reproducible. This commit
|
||||
changes the zip srand() seed to a predictable value to generate
|
||||
reproducible random bytes for the encryption header. This will compromise
|
||||
the goal of secure archive encryption, but it would not be a big problem
|
||||
for our purpose.
|
||||
|
||||
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
|
||||
---
|
||||
crypt.c | 8 ++++++--
|
||||
globals.c | 1 +
|
||||
zip.h | 1 +
|
||||
zipup.c | 2 +-
|
||||
4 files changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/crypt.c
|
||||
+++ b/crypt.c
|
||||
@@ -29,7 +29,6 @@
|
||||
version without encryption capabilities).
|
||||
*/
|
||||
|
||||
-#define ZCRYPT_INTERNAL
|
||||
#include "zip.h"
|
||||
#include "crypt.h"
|
||||
#include "ttyio.h"
|
||||
@@ -219,7 +218,12 @@ void crypthead(passwd, crc)
|
||||
* often poorly implemented.
|
||||
*/
|
||||
if (++calls == 1) {
|
||||
- srand((unsigned)time(NULL) ^ ZCR_SEED2);
|
||||
+ unsigned zcr_seed1 = (unsigned)time(NULL);
|
||||
+#ifndef ZCRYPT_INTERNAL
|
||||
+ if (epoch > 0)
|
||||
+ zcr_seed1 = (unsigned)epoch;
|
||||
+#endif
|
||||
+ srand(zcr_seed1 ^ ZCR_SEED2);
|
||||
}
|
||||
init_keys(passwd);
|
||||
for (n = 0; n < RAND_HEAD_LEN-2; n++) {
|
||||
--- a/globals.c
|
||||
+++ b/globals.c
|
||||
@@ -206,6 +206,7 @@ int read_split_archive = 0; /* 1=s
|
||||
int split_method = 0; /* 0=no splits, 1=seekable, 2=data desc, -1=no */
|
||||
uzoff_t split_size = 0; /* how big each split should be */
|
||||
int split_bell = 0; /* when pause for next split ring bell */
|
||||
+time_t epoch = 0; /* timestamp from SOURCE_DATE_EPOCH */
|
||||
uzoff_t bytes_prev_splits = 0; /* total bytes written to all splits before this */
|
||||
uzoff_t bytes_this_entry = 0; /* bytes written for this entry across all splits */
|
||||
int noisy_splits = 0; /* note when splits are being created */
|
||||
--- a/zip.h
|
||||
+++ b/zip.h
|
||||
@@ -502,6 +502,7 @@ extern uzoff_t bytes_this_split; /* byte
|
||||
extern int read_split_archive; /* 1=scanzipf_reg detected spanning signature */
|
||||
extern int split_method; /* 0=no splits, 1=seekable, 2=data descs, -1=no */
|
||||
extern uzoff_t split_size; /* how big each split should be */
|
||||
+extern time_t epoch; /* timestamp from SOURCE_DATE_EPOCH */
|
||||
extern int split_bell; /* when pause for next split ring bell */
|
||||
extern uzoff_t bytes_prev_splits; /* total bytes written to all splits before this */
|
||||
extern uzoff_t bytes_this_entry; /* bytes written for this entry across all splits */
|
||||
--- a/zipup.c
|
||||
+++ b/zipup.c
|
||||
@@ -676,7 +676,7 @@ struct zlist far *z; /* zip entry to
|
||||
} /* strcmp(z->name, "-") == 0 */
|
||||
|
||||
if (extra_fields == 0 && (source_date_epoch = getenv("SOURCE_DATE_EPOCH")) != NULL) {
|
||||
- time_t epoch = strtoull(source_date_epoch, NULL, 10);
|
||||
+ epoch = strtoull(source_date_epoch, NULL, 10);
|
||||
if (epoch > 0) {
|
||||
ulg epochtim = unix2dostime(&epoch);
|
||||
if (z->tim > epochtim) z->tim = epochtim;
|
@ -8,35 +8,34 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=zlib
|
||||
PKG_VERSION:=1.2.12
|
||||
PKG_VERSION:=1.2.13
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/madler/zlib
|
||||
PKG_MIRROR_HASH:=a162fc219763635f0c1591ec515d4b08684e4b0bfb4b1c8e65e4eab18d597c27
|
||||
PKG_SOURCE_VERSION:=21767c654d31d2dccdde4330529775c6c5fd5389
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://github.com/madler/zlib/releases/download/v$(PKG_VERSION)
|
||||
PKG_HASH:=d14c38e313afc35a9a8760dadf26042f51ea0f5d154b0630a31da0540107fb98
|
||||
|
||||
PKG_LICENSE:=Zlib
|
||||
PKG_LICENSE_FILES:=README
|
||||
PKG_CPE_ID:=cpe:/a:gnu:zlib
|
||||
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
HOST_CFLAGS +=-fPIC
|
||||
HOSTCC := $(HOSTCC_NOCACHE)
|
||||
HOST_CFLAGS += $(HOST_FPIC)
|
||||
|
||||
define Host/Install
|
||||
$(CP) $(HOST_BUILD_DIR)/libz.a $(STAGING_DIR_HOST)/lib/
|
||||
$(CP) $(HOST_BUILD_DIR)/zconf.h $(STAGING_DIR_HOST)/include/
|
||||
$(CP) $(HOST_BUILD_DIR)/zlib.h $(STAGING_DIR_HOST)/include/
|
||||
$(CP) $(HOST_BUILD_DIR)/zlib.pc $(STAGING_DIR_HOST)/lib/pkgconfig/
|
||||
endef
|
||||
HOST_CONFIGURE_ARGS = \
|
||||
--prefix=$(STAGING_DIR_HOST) \
|
||||
--sysconfdir=$(STAGING_DIR_HOST)/etc \
|
||||
--localstatedir=$(STAGING_DIR_HOST)/var \
|
||||
--libdir=$(STAGING_DIR_HOST)/lib \
|
||||
--includedir=$(STAGING_DIR_HOST)/include \
|
||||
--static
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/lib/libz.a
|
||||
rm -f $(STAGING_DIR_HOST)/include/zconf.h
|
||||
rm -f $(STAGING_DIR_HOST)/include/zlib.h
|
||||
rm -f $(STAGING_DIR_HOST)/lib/pkgconfig//zlib.pc
|
||||
define Host/Uninstall
|
||||
-$(call Host/Compile/Default,uninstall)
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
@ -11,15 +11,25 @@ PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_CPE_ID:=cpe:/a:facebook:zstandard
|
||||
|
||||
CMAKE_SOURCE_SUBDIR:=build/cmake
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
include $(INCLUDE_DIR)/meson.mk
|
||||
|
||||
CMAKE_HOST_OPTIONS += \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="" \
|
||||
-DCMAKE_C_COMPILER=$(HOSTCC_NOCACHE) \
|
||||
-DZSTD_LEGACY_SUPPORT=OFF
|
||||
MESON_HOST_BUILD_DIR:=$(HOST_BUILD_DIR)/build/meson/openwrt-build
|
||||
|
||||
HOSTCC:= $(HOSTCC_NOCACHE)
|
||||
HOST_LDFLAGS += -Wl,-rpath,$(STAGING_DIR_HOST)/lib
|
||||
|
||||
MESON_HOST_ARGS += \
|
||||
-Dlegacy_level=7 \
|
||||
-Ddebug_level=0 \
|
||||
-Dbacktrace=false \
|
||||
-Dstatic_runtime=false \
|
||||
-Dbin_programs=true \
|
||||
-Dbin_tests=false \
|
||||
-Dbin_contrib=false \
|
||||
-Dmulti_thread=enabled \
|
||||
-Dzlib=disabled \
|
||||
-Dlzma=disabled \
|
||||
-Dlz4=disabled
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
|
Loading…
Reference in New Issue
Block a user