summaryrefslogtreecommitdiff
path: root/src/southbridge
diff options
context:
space:
mode:
authorZheng Bao <fishbaozi@gmail.com>2012-09-17 15:39:44 +0800
committerPatrick Georgi <patrick@georgi-clan.de>2012-09-17 10:37:29 +0200
commitfec5b647fc05484f8d8703f118f84e958b85329e (patch)
tree857f60cbb294549daffb89ab69386781b3a1169d /src/southbridge
parent615304c667dc690aeecfdd655adf8073aafc3cad (diff)
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>
Diffstat (limited to 'src/southbridge')
-rw-r--r--src/southbridge/amd/agesa/hudson/Makefile.inc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/southbridge/amd/agesa/hudson/Makefile.inc b/src/southbridge/amd/agesa/hudson/Makefile.inc
index 971f731db1..014524dc04 100644
--- a/src/southbridge/amd/agesa/hudson/Makefile.inc
+++ b/src/southbridge/amd/agesa/hudson/Makefile.inc
@@ -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)