AMD Hudson: use awk to calulate instead of expr

Command expr in some systems only take 32bit as integer, which
value is at 0x7FFFFFFF ~ -0x80000000. Use awk as alternate way to
calculate.
And some system doesnt take hex value in Makefile, even in awk instruction.

Change-Id: Ie35d6a5b96eea4192bd9cab857af4d4dcb37b9ed
Signed-off-by: Zheng Bao <zheng.bao@amd.com>
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: http://review.coreboot.org/1527
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
This commit is contained in:
Zheng Bao 2012-09-17 15:39:44 +08:00 committed by Patrick Georgi
parent 615304c667
commit fec5b647fc
1 changed files with 8 additions and 8 deletions

View File

@ -24,7 +24,7 @@ HUDSON_FWM_POSITION=$(shell printf %d $(CONFIG_HUDSON_FWM_POSITION))
#assume the cbfs header is less than 128 bytes.
ROMSIG_SIZE=16
ifeq ($(CONFIG_HUDSON_XHCI_FWM), y)
HUDSON_XHCI_POSITION=$(shell expr $(HUDSON_FWM_POSITION) + $(ROMSIG_SIZE) + 128)
HUDSON_XHCI_POSITION=$(shell echo $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) 128 | awk '{print $$1 + $$2 + $$3}')
XHCI_FWM_SIZE=$(word 5,$(shell ls -l $(CONFIG_HUDSON_XHCI_FWM_FILE)))
else
HUDSON_XHCI_POSITION=0
@ -32,8 +32,8 @@ XHCI_FWM_SIZE=0
endif
ifeq ($(CONFIG_HUDSON_GEC_FWM), y)
HUDSON_GEC_POSITION=$(shell expr $(HUDSON_FWM_POSITION) + $(ROMSIG_SIZE) + 128 \
+ $(XHCI_FWM_SIZE) + 128)
HUDSON_GEC_POSITION=$(shell echo $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) 128 \
$(XHCI_FWM_SIZE) 128 | awk '{print $$1 + $$2 + $$3 + $$4 + $$5}')
GEC_FWM_SIZE=$(word 5,$(shell ls -l $(CONFIG_HUDSON_GEC_FWM_FILE)))
else
HUDSON_GEC_POSITION=0
@ -41,10 +41,10 @@ GEC_FWM_SIZE=0
endif
ifeq ($(CONFIG_HUDSON_IMC_FWM), y)
HUDSON_IMC_POSITION_UNALIGN=$(shell expr $(HUDSON_FWM_POSITION) + $(ROMSIG_SIZE) + 128 \
+ $(XHCI_FWM_SIZE) + 128 \
+ $(GEC_FWM_SIZE) + 128 + 65535)
HUDSON_IMC_POSITION=$(shell expr $(HUDSON_IMC_POSITION_UNALIGN) - $(HUDSON_IMC_POSITION_UNALIGN) % 65536)
HUDSON_IMC_POSITION_UNALIGN=$(shell echo $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) 128 \
$(XHCI_FWM_SIZE) 128 \
$(GEC_FWM_SIZE) 128 65535 | awk '{print $$1 + $$2 + $$3 + $$4 + $$5 + $$6 + $$7 + $$8}')
HUDSON_IMC_POSITION=$(shell echo $(HUDSON_IMC_POSITION_UNALIGN) | awk '{print $$1 - $$1 % 65536}')
else
HUDSON_IMC_POSITION=0
endif
@ -58,7 +58,7 @@ $(obj)/hudson_romsig.bin: $(call strip_quotes, $(CONFIG_HUDSON_XHCI_FWM_FILE)) \
$(HUDSON_IMC_POSITION) \
$(HUDSON_GEC_POSITION) \
$(HUDSON_XHCI_POSITION) ; do \
echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 0x100, $$1/0x100 % 0x100, $$1/0x10000 % 0x100, $$1/0x1000000);}'; \
echo $$fwm | LC_ALL=C awk '{printf ("%c%c%c%c", $$1 % 256, $$1/256 % 256, $$1/65536 % 256, $$1/16777216);}'; \
done > $@
ifeq ($(CONFIG_HUDSON_FWM), y)