From dfd8c45a98f82c69cad7a622016aa70210b025c5 Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Tue, 12 Nov 2019 14:27:06 +0000 Subject: [PATCH] build: image: posix compatibility cut v head Replace 2 instances of non posix use of 'head' with posix compliant 'cut'. 'head -c n' cuts 'n' bytes from the passed string and happens to work on Linux & Mac OS X even though '-c' is not posix. 'head --bytes n' does the same thing and happens to work on linux but not on Mac OS X and is also not posix. 'cut -b1-8' cuts the first 8 bytes from the passed string and is posix compliant, hence works on Linux & Mac OS X. Our usage of 'head --bytes' was particularly unfortunate since it was used to calculated the RootFS UUID passed to grub - the net result being a non-functioning system waiting for the root file system to appear. Thanks to karlp, ynezz & others for pointers on solving this. Signed-off-by: Kevin Darbyshire-Bryant --- include/image.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/image.mk b/include/image.mk index 8755c4832a..8592c19b99 100644 --- a/include/image.mk +++ b/include/image.mk @@ -30,7 +30,7 @@ param_get_default = $(firstword $(call param_get,$(1),$(2)) $(3)) param_mangle = $(subst $(space),_,$(strip $(1))) param_unmangle = $(subst _,$(space),$(1)) -mkfs_packages_id = $(shell echo $(sort $(1)) | mkhash md5 | head -c 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)) KDIR=$(KERNEL_BUILD_DIR) @@ -44,7 +44,7 @@ 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_ROOTFS:=$(IMG_PREFIX)-rootfs IMG_COMBINED:=$(IMG_PREFIX)-combined -IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | mkhash md5 | head --bytes 8) +IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | mkhash md5 | cut -b1-8) MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt -- 2.25.1