[coreboot] Patch set updated for coreboot: 7fa9070 AMD Hudson: use awk to calulate instead of expr

Zheng Bao (zheng.bao@amd.com) gerrit at coreboot.org
Mon Sep 17 07:41:56 CEST 2012


Zheng Bao (zheng.bao at amd.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1527

-gerrit

commit 7fa90703dd54e85e0104a7e1112bbb9945c062ed
Author: Zheng Bao <fishbaozi at gmail.com>
Date:   Mon Sep 17 15:39:44 2012 +0800

    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 at amd.com>
    Signed-off-by: Zheng Bao <fishbaozi at gmail.com>
---
 src/southbridge/amd/agesa/hudson/Makefile.inc | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/southbridge/amd/agesa/hudson/Makefile.inc b/src/southbridge/amd/agesa/hudson/Makefile.inc
index 971f731..014524d 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)




More information about the coreboot mailing list