build: introduce $(MKHASH)

Before this commit, it was assumed that mkhash is in the PATH. While
this was fine for the normal build workflow, this led to some issues if

    make TOPDIR="$(pwd)" -C "$pkgdir" compile

was called manually. In most of the cases, I just saw warnings like this:

    make: Entering directory '/home/.../package/gluon-status-page'
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    [...]

While these were only warnings and the package still compiled sucessfully,
I also observed that some package even fail to build because of this.

After applying this commit, the variable $(MKHASH) is introduced. This
variable points to $(STAGING_DIR_HOST)/bin/mkhash, which is always the
correct path.

Signed-off-by: Leonardo Mörlein <me@irrelefant.net>
This commit is contained in:
Leonardo Mörlein 2021-05-09 22:28:15 +02:00 committed by Petr Štetiar
parent ce8af0ace0
commit b993b68b6c
25 changed files with 40 additions and 39 deletions

View File

@ -11,7 +11,7 @@
DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp" -x "*/.pkgdir*" DEP_FINDPARAMS := -x "*/.svn*" -x ".*" -x "*:*" -x "*\!*" -x "* *" -x "*\\\#*" -x "*/.*_check" -x "*/.*.swp" -x "*/.pkgdir*"
find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -printf "%p%T@\n" | sort | mkhash md5 find_md5=find $(wildcard $(1)) -type f $(patsubst -x,-and -not -path,$(DEP_FINDPARAMS) $(2)) -printf "%p%T@\n" | sort | $(MKHASH) md5
define rdep define rdep
.PRECIOUS: $(2) .PRECIOUS: $(2)

View File

@ -74,7 +74,7 @@ else
check_warn = $(if $(filter-out undefined,$(origin F_$(1))),$(filter ,$(shell $(call F_$(1),$(2),$(3),$(4)) >&2)),$(check_warn_nofix)) check_warn = $(if $(filter-out undefined,$(origin F_$(1))),$(filter ,$(shell $(call F_$(1),$(2),$(3),$(4)) >&2)),$(check_warn_nofix))
endif endif
gen_sha256sum = $(shell mkhash sha256 $(DL_DIR)/$(1)) gen_sha256sum = $(shell $(MKHASH) sha256 $(DL_DIR)/$(1))
ifdef FIXUP ifdef FIXUP
F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2) F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2)

View File

@ -198,7 +198,7 @@ define Build/elx-header
dd bs=20 count=1 conv=sync; \ dd bs=20 count=1 conv=sync; \
echo -ne "$$(printf '%08x' $$(stat -c%s $@) | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \ echo -ne "$$(printf '%08x' $$(stat -c%s $@) | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
dd bs=8 count=1 conv=sync; \ dd bs=8 count=1 conv=sync; \
echo -ne "$$($(STAGING_DIR_HOST)/bin/mkhash md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \ echo -ne "$$($(MKHASH) md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
dd bs=58 count=1 conv=sync; \ dd bs=58 count=1 conv=sync; \
) > $(KDIR)/tmp/$(DEVICE_NAME).header ) > $(KDIR)/tmp/$(DEVICE_NAME).header
$(call Build/xor-image,-p $(xor_pattern) -x) $(call Build/xor-image,-p $(xor_pattern) -x)

View File

@ -26,7 +26,7 @@ param_get_default = $(firstword $(call param_get,$(1),$(2)) $(3))
param_mangle = $(subst $(space),_,$(strip $(1))) param_mangle = $(subst $(space),_,$(strip $(1)))
param_unmangle = $(subst _,$(space),$(1)) param_unmangle = $(subst _,$(space),$(1))
mkfs_packages_id = $(shell echo $(sort $(1)) | mkhash md5 | cut -b1-8) mkfs_packages_id = $(shell echo $(sort $(1)) | $(MKHASH) md5 | cut -b1-8)
mkfs_target_dir = $(if $(call param_get,pkg,$(1)),$(KDIR)/target-dir-$(call param_get,pkg,$(1)),$(TARGET_DIR)) mkfs_target_dir = $(if $(call param_get,pkg,$(1)),$(KDIR)/target-dir-$(call param_get,pkg,$(1)),$(TARGET_DIR))
KDIR=$(KERNEL_BUILD_DIR) KDIR=$(KERNEL_BUILD_DIR)
@ -40,8 +40,8 @@ IMG_PREFIX_VERCODE:=$(if $(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERS
IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
IMG_ROOTFS:=$(IMG_PREFIX)-rootfs IMG_ROOTFS:=$(IMG_PREFIX)-rootfs
IMG_COMBINED:=$(IMG_PREFIX)-combined IMG_COMBINED:=$(IMG_PREFIX)-combined
IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | mkhash md5 | cut -b1-8) IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | cut -b1-8)
IMG_PART_DISKGUID:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | mkhash md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/') IMG_PART_DISKGUID:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/')
MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt

View File

@ -116,7 +116,7 @@ define Kernel/Configure/Default
cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \ cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev; \
} }
$(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install $(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(KERNEL_MAKE) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | mkhash md5 > $(LINUX_DIR)/.vermagic grep '=[ym]' $(LINUX_DIR)/.config.set | LC_ALL=C sort | $(MKHASH) md5 > $(LINUX_DIR)/.vermagic
endef endef
define Kernel/Configure/Initramfs define Kernel/Configure/Initramfs
@ -186,5 +186,3 @@ define Kernel/Clean/Default
rm -f $(LINUX_KERNEL) rm -f $(LINUX_KERNEL)
$(_SINGLE)$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean $(_SINGLE)$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
endef endef

View File

@ -221,7 +221,7 @@ $(_endef)
ifneq ($$(CONFIG_IPK_FILES_CHECKSUMS),) ifneq ($$(CONFIG_IPK_FILES_CHECKSUMS),)
(cd $$(IDIR_$(1)); \ (cd $$(IDIR_$(1)); \
( \ ( \
find . -type f \! -path ./CONTROL/\* -exec mkhash sha256 -n \{\} \; 2> /dev/null | \ find . -type f \! -path ./CONTROL/\* -exec $(MKHASH) sha256 -n \{\} \; 2> /dev/null | \
sed 's|\([[:blank:]]\)\./| \1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \ sed 's|\([[:blank:]]\)\./| \1/|' > $$(IDIR_$(1))/CONTROL/files-sha256sum \
) || true \ ) || true \
) )

View File

@ -159,7 +159,7 @@ define Quilt/Template
false; \ false; \
} }
@[ -n "$$$$(ls $(1)/patches/series)" -o \ @[ -n "$$$$(ls $(1)/patches/series)" -o \
"$$$$(cat $(1)/patches/series | mkhash md5)" = "$$(sort $(1)/patches/series | mkhash md5)" ] || { \ "$$$$(cat $(1)/patches/series | $(MKHASH) md5)" = "$$(sort $(1)/patches/series | $(MKHASH) md5)" ] || { \
echo "The patches are not sorted in the right order. Please fix."; \ echo "The patches are not sorted in the right order. Please fix."; \
false; \ false; \
} }

View File

@ -1,4 +1,5 @@
include $(TOPDIR)/include/verbose.mk include $(TOPDIR)/include/verbose.mk
include $(TOPDIR)/rules.mk
TMP_DIR:=$(TOPDIR)/tmp TMP_DIR:=$(TOPDIR)/tmp
all: $(TMP_DIR)/.$(SCAN_TARGET) all: $(TMP_DIR)/.$(SCAN_TARGET)
@ -100,7 +101,7 @@ $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
$(TARGET_STAMP):: $(TARGET_STAMP)::
+( \ +( \
$(NO_TRACE_MAKE) $(FILELIST); \ $(NO_TRACE_MAKE) $(FILELIST); \
MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | mkhash md5 | awk '{print $$1}'); \ MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | $(MKHASH) md5 | awk '{print $$1}'); \
[ -f "$@.$$MD5SUM" ] || { \ [ -f "$@.$$MD5SUM" ] || { \
rm -f $@.*; \ rm -f $@.*; \
touch $@.$$MD5SUM; \ touch $@.$$MD5SUM; \

View File

@ -30,7 +30,7 @@ PKG_CONFIG_DEPENDS += \
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
ifneq ($(DUMP),1) ifneq ($(DUMP),1)
STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5) STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | $(MKHASH) md5)
TARGET:=-$(BOARD) TARGET:=-$(BOARD)
endif endif

View File

@ -24,7 +24,7 @@ export SHELL:=/bin/sh
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
ifeq ($(DUMP),) ifeq ($(DUMP),)
STAMP_BUILT:=$(STAMP_BUILT)_$(shell $(SCRIPT_DIR)/kconfig.pl $(LINUX_DIR)/.config | mkhash md5) STAMP_BUILT:=$(STAMP_BUILT)_$(shell $(SCRIPT_DIR)/kconfig.pl $(LINUX_DIR)/.config | $(MKHASH) md5)
-include $(LINUX_DIR)/.config -include $(LINUX_DIR)/.config
endif endif

View File

@ -322,7 +322,7 @@ endif
OPENSSL_TARGET:=linux-$(call qstrip,$(CONFIG_ARCH))-openwrt OPENSSL_TARGET:=linux-$(call qstrip,$(CONFIG_ARCH))-openwrt
STAMP_CONFIGURED := $(STAMP_CONFIGURED)_$(shell echo $(OPENSSL_OPTIONS) | mkhash md5) STAMP_CONFIGURED := $(STAMP_CONFIGURED)_$(shell echo $(OPENSSL_OPTIONS) | $(MKHASH) md5)
define Build/Configure define Build/Configure
(cd $(PKG_BUILD_DIR); \ (cd $(PKG_BUILD_DIR); \

View File

@ -37,7 +37,7 @@ PKG_CONFIG_DEPENDS:= \
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
ifneq ($(DUMP),1) ifneq ($(DUMP),1)
STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5) STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | $(MKHASH) md5)
endif endif
define Package/dropbear/Default define Package/dropbear/Default

View File

@ -28,7 +28,7 @@ include $(INCLUDE_DIR)/package.mk
ifeq ($(DUMP),) ifeq ($(DUMP),)
-include $(LINUX_DIR)/.config -include $(LINUX_DIR)/.config
include $(INCLUDE_DIR)/netfilter.mk include $(INCLUDE_DIR)/netfilter.mk
STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep 'NETFILTER' $(LINUX_DIR)/.config | mkhash md5) STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep 'NETFILTER' $(LINUX_DIR)/.config | $(MKHASH) md5)
endif endif

View File

@ -32,7 +32,7 @@ include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk include $(INCLUDE_DIR)/cmake.mk
ifeq ($(DUMP),) ifeq ($(DUMP),)
STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | mkhash md5) STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell echo $(CONFIG_TARGET_INIT_PATH) | $(MKHASH) md5)
endif endif
CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)" CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)"

View File

@ -38,7 +38,7 @@ endif
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
ifeq ($(DUMP),) ifeq ($(DUMP),)
STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | mkhash md5) STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | $(MKHASH) md5)
endif endif
# All files provided by busybox will serve as fallback alternatives by opkg. # All files provided by busybox will serve as fallback alternatives by opkg.

View File

@ -27,7 +27,7 @@ empty:=
space:= $(empty) $(empty) space:= $(empty) $(empty)
comma:=, comma:=,
merge=$(subst $(space),,$(1)) merge=$(subst $(space),,$(1))
confvar=$(shell echo '$(foreach v,$(1),$(v)=$(subst ','\'',$($(v))))' | $(STAGING_DIR_HOST)/bin/mkhash md5) confvar=$(shell echo '$(foreach v,$(1),$(v)=$(subst ','\'',$($(v))))' | $(MKHASH) md5)
strip_last=$(patsubst %.$(lastword $(subst .,$(space),$(1))),%,$(1)) strip_last=$(patsubst %.$(lastword $(subst .,$(space),$(1))),%,$(1))
paren_left = ( paren_left = (
@ -266,6 +266,9 @@ TARGET_CXX:=$(TARGET_CROSS)g++
KPATCH:=$(SCRIPT_DIR)/patch-kernel.sh KPATCH:=$(SCRIPT_DIR)/patch-kernel.sh
SED:=$(STAGING_DIR_HOST)/bin/sed -i -e SED:=$(STAGING_DIR_HOST)/bin/sed -i -e
ESED:=$(STAGING_DIR_HOST)/bin/sed -E -i -e ESED:=$(STAGING_DIR_HOST)/bin/sed -E -i -e
MKHASH:=$(STAGING_DIR_HOST)/bin/mkhash
# MKHASH is used in /scripts, so we export it here.
export MKHASH
CP:=cp -fpR CP:=cp -fpR
LN:=ln -sf LN:=ln -sf
XARGS:=xargs -r XARGS:=xargs -r
@ -399,7 +402,7 @@ endef
# $(2) => If set, recurse into subdirectories # $(2) => If set, recurse into subdirectories
define sha256sums define sha256sums
(cd $(1); find . $(if $(2),,-maxdepth 1) -type f -not -name 'sha256sums' -printf "%P\n" | sort | \ (cd $(1); find . $(if $(2),,-maxdepth 1) -type f -not -name 'sha256sums' -printf "%P\n" | sort | \
xargs -r $(STAGING_DIR_HOST)/bin/mkhash -n sha256 | sed -ne 's!^\(.*\) \(.*\)$$!\1 *\2!p' > sha256sums) xargs -r $(MKHASH) -n sha256 | sed -ne 's!^\(.*\) \(.*\)$$!\1 *\2!p' > sha256sums)
endef endef
# file extension # file extension

View File

@ -63,7 +63,7 @@ while [ "$#" -gt 1 ]
[ ! -f "$file" ] && echo "$ME: Not a valid file: $file" && usage [ ! -f "$file" ] && echo "$ME: Not a valid file: $file" && usage
FILES="$FILES $file" FILES="$FILES $file"
md5=$(mkhash md5 "$file") md5=$($MKHASH md5 "$file")
printf "%-32s%08x%32s" "$filename" $(stat -c "%s" "$file") "${md5%% *}" >> "${IMG_TMP_OUT}" printf "%-32s%08x%32s" "$filename" $(stat -c "%s" "$file") "${md5%% *}" >> "${IMG_TMP_OUT}"
shift 2 shift 2
done done

View File

@ -16,7 +16,7 @@ dd if="$1" of="$kern" bs=$BLKSZ conv=sync 2>/dev/null
dd if="$2" of="$root" bs=$BLKSZ conv=sync 2>/dev/null dd if="$2" of="$root" bs=$BLKSZ conv=sync 2>/dev/null
# Calculate md5sum over combined kernel and rootfs image. # Calculate md5sum over combined kernel and rootfs image.
md5=$(cat "$kern" "$root" | mkhash md5) md5=$(cat "$kern" "$root" | $MKHASH md5)
# Write image header followed by kernel and rootfs image. # Write image header followed by kernel and rootfs image.
# The header is padded to 64k, format is: # The header is padded to 64k, format is:

View File

@ -65,8 +65,8 @@ sub hash_cmd() {
my $len = length($file_hash); my $len = length($file_hash);
my $cmd; my $cmd;
$len == 64 and return "mkhash sha256"; $len == 64 and return "$ENV{'MKHASH'} sha256";
$len == 32 and return "mkhash md5"; $len == 32 and return "$ENV{'MKHASH'} md5";
return undef; return undef;
} }
@ -296,4 +296,3 @@ while (!-f "$target/$filename") {
} }
$SIG{INT} = \&cleanup; $SIG{INT} = \&cleanup;

View File

@ -18,7 +18,7 @@ for pkg in `find $pkg_dir -name '*.ipk' | sort`; do
[[ "$name" = "libc" ]] && continue [[ "$name" = "libc" ]] && continue
echo "Generating index for package $pkg" >&2 echo "Generating index for package $pkg" >&2
file_size=$(stat -L -c%s $pkg) file_size=$(stat -L -c%s $pkg)
sha256sum=$(mkhash sha256 $pkg) sha256sum=$($MKHASH sha256 $pkg)
# Take pains to make variable value sed-safe # Take pains to make variable value sed-safe
sed_safe_pkg=`echo $pkg | sed -e 's/^\.\///g' -e 's/\\//\\\\\\//g'` sed_safe_pkg=`echo $pkg | sed -e 's/^\.\///g' -e 's/\\//\\\\\\//g'`
tar -xzOf $pkg ./control.tar.gz | tar xzOf - ./control | sed -e "s/^Description:/Filename: $sed_safe_pkg\\ tar -xzOf $pkg ./control.tar.gz | tar xzOf - ./control | sed -e "s/^Description:/Filename: $sed_safe_pkg\\

View File

@ -54,8 +54,8 @@ esac
CHECK_BS=65536 CHECK_BS=65536
KERNEL_SIZE=$(stat -c%s "$KERNEL_PATH") KERNEL_SIZE=$(stat -c%s "$KERNEL_PATH")
KERNEL_MD5=$(mkhash md5 $KERNEL_PATH) KERNEL_MD5=$($MKHASH md5 $KERNEL_PATH)
KERNEL_SHA256=$(mkhash sha256 $KERNEL_PATH) KERNEL_SHA256=$($MKHASH sha256 $KERNEL_PATH)
KERNEL_PART_SIZE_KB=$((KERNEL_SIZE / 1024)) KERNEL_PART_SIZE_KB=$((KERNEL_SIZE / 1024))
KERNEL_PART_SIZE=$(printf $SIZE_FORMAT $(($KERNEL_PART_SIZE_KB * $SIZE_FACTOR))) KERNEL_PART_SIZE=$(printf $SIZE_FORMAT $(($KERNEL_PART_SIZE_KB * $SIZE_FACTOR)))
@ -63,9 +63,9 @@ ROOTFS_FLASH_ADDR=$(addr=$(($KERNEL_FLASH_ADDR + ($KERNEL_PART_SIZE_KB * 1024)))
ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH") ROOTFS_SIZE=$(stat -c%s "$ROOTFS_PATH")
ROOTFS_SQUASHFS_SIZE=$((ROOTFS_SIZE-4)) ROOTFS_SQUASHFS_SIZE=$((ROOTFS_SIZE-4))
ROOTFS_CHECK_BLOCKS=$((ROOTFS_SQUASHFS_SIZE / CHECK_BS)) ROOTFS_CHECK_BLOCKS=$((ROOTFS_SQUASHFS_SIZE / CHECK_BS))
ROOTFS_MD5=$(dd if=$ROOTFS_PATH bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | mkhash md5) ROOTFS_MD5=$(dd if=$ROOTFS_PATH bs=$CHECK_BS count=$ROOTFS_CHECK_BLOCKS 2>&- | $MKHASH md5)
ROOTFS_MD5_FULL=$(mkhash md5 $ROOTFS_PATH) ROOTFS_MD5_FULL=$($MKHASH md5 $ROOTFS_PATH)
ROOTFS_SHA256_FULL=$(mkhash sha256 $ROOTFS_PATH) ROOTFS_SHA256_FULL=$($MKHASH sha256 $ROOTFS_PATH)
ROOTFS_CHECK_SIZE=$(printf '0x%x' $ROOTFS_SQUASHFS_SIZE) ROOTFS_CHECK_SIZE=$(printf '0x%x' $ROOTFS_SQUASHFS_SIZE)
ROOTFS_PART_SIZE_KB=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE_KB)) ROOTFS_PART_SIZE_KB=$(($MAX_PART_SIZE - $KERNEL_PART_SIZE_KB))
ROOTFS_PART_SIZE=$(printf $SIZE_FORMAT $(($ROOTFS_PART_SIZE_KB * $SIZE_FACTOR))) ROOTFS_PART_SIZE=$(printf $SIZE_FORMAT $(($ROOTFS_PART_SIZE_KB * $SIZE_FACTOR)))

View File

@ -35,7 +35,7 @@ define Build/addpattern
endef endef
define Build/append-md5sum-bin define Build/append-md5sum-bin
$(STAGING_DIR_HOST)/bin/mkhash md5 $@ | sed 's/../\\\\x&/g' |\ $(MKHASH) md5 $@ | sed 's/../\\\\x&/g' |\
xargs echo -ne >> $@ xargs echo -ne >> $@
endef endef

View File

@ -91,7 +91,7 @@ endef
define Build/netis-tail define Build/netis-tail
echo -n $(1) >> $@ echo -n $(1) >> $@
echo -n $(UIMAGE_NAME)-yun | $(STAGING_DIR_HOST)/bin/mkhash md5 | \ echo -n $(UIMAGE_NAME)-yun | $(MKHASH) md5 | \
sed 's/../\\\\x&/g' | xargs echo -ne >> $@ sed 's/../\\\\x&/g' | xargs echo -ne >> $@
endef endef

View File

@ -9,9 +9,9 @@ DEVICE_VARS += DLINK_ROM_ID DLINK_FAMILY_MEMBER DLINK_FIRMWARE_SIZE DLINK_IMAGE_
define Build/elecom-header define Build/elecom-header
cp $@ $(KDIR)/v_0.0.0.bin cp $@ $(KDIR)/v_0.0.0.bin
( \ ( \
mkhash md5 $(KDIR)/v_0.0.0.bin && \ $(MKHASH) md5 $(KDIR)/v_0.0.0.bin && \
echo 458 \ echo 458 \
) | mkhash md5 > $(KDIR)/v_0.0.0.md5 ) | $(MKHASH) md5 > $(KDIR)/v_0.0.0.md5
$(STAGING_DIR_HOST)/bin/tar -c \ $(STAGING_DIR_HOST)/bin/tar -c \
$(if $(SOURCE_DATE_EPOCH),--mtime=@$(SOURCE_DATE_EPOCH)) \ $(if $(SOURCE_DATE_EPOCH),--mtime=@$(SOURCE_DATE_EPOCH)) \
--owner=0 --group=0 -f $@ -C $(KDIR) v_0.0.0.bin v_0.0.0.md5 --owner=0 --group=0 -f $@ -C $(KDIR) v_0.0.0.bin v_0.0.0.md5

View File

@ -13,7 +13,7 @@ define Build/elecom-wrc-gs-factory
$(eval product=$(word 1,$(1))) $(eval product=$(word 1,$(1)))
$(eval version=$(word 2,$(1))) $(eval version=$(word 2,$(1)))
$(eval hash_opt=$(word 3,$(1))) $(eval hash_opt=$(word 3,$(1)))
$(STAGING_DIR_HOST)/bin/mkhash md5 $(hash_opt) $@ >> $@ $(MKHASH) md5 $(hash_opt) $@ >> $@
( \ ( \
echo -n "ELECOM $(product) v$(version)" | \ echo -n "ELECOM $(product) v$(version)" | \
dd bs=32 count=1 conv=sync; \ dd bs=32 count=1 conv=sync; \
@ -61,13 +61,13 @@ define Build/ubnt-erx-factory-image
$(TAR) -cf $(1) --transform='s/^.*/compat/' $(1).compat; \ $(TAR) -cf $(1) --transform='s/^.*/compat/' $(1).compat; \
\ \
$(TAR) -rf $(1) --transform='s/^.*/vmlinux.tmp/' $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE); \ $(TAR) -rf $(1) --transform='s/^.*/vmlinux.tmp/' $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE); \
mkhash md5 $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) > $(1).md5; \ $(MKHASH) md5 $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) > $(1).md5; \
$(TAR) -rf $(1) --transform='s/^.*/vmlinux.tmp.md5/' $(1).md5; \ $(TAR) -rf $(1) --transform='s/^.*/vmlinux.tmp.md5/' $(1).md5; \
\ \
echo "dummy" > $(1).rootfs; \ echo "dummy" > $(1).rootfs; \
$(TAR) -rf $(1) --transform='s/^.*/squashfs.tmp/' $(1).rootfs; \ $(TAR) -rf $(1) --transform='s/^.*/squashfs.tmp/' $(1).rootfs; \
\ \
mkhash md5 $(1).rootfs > $(1).md5; \ $(MKHASH) md5 $(1).rootfs > $(1).md5; \
$(TAR) -rf $(1) --transform='s/^.*/squashfs.tmp.md5/' $(1).md5; \ $(TAR) -rf $(1) --transform='s/^.*/squashfs.tmp.md5/' $(1).md5; \
\ \
echo '$(BOARD) $(VERSION_CODE) $(VERSION_NUMBER)' > $(1).version; \ echo '$(BOARD) $(VERSION_CODE) $(VERSION_NUMBER)' > $(1).version; \