AMD hudson & SB800 - Fix issues with mawk
When calculating the offsets of the various binary blobs within the coreboot.rom file, we noticed that using mawk as the awk tool instead of using gawk led to build issues. This was finally traced to the maximum value of the unsigned long variables within mawk - 0x7fff_ffff. Because we were doing calculations on values up in the 0xffxxxxxx range, these numbers would either be turned into floating point values and printed using scientific notation, or truncated at 0x7fff_ffff. To fix this, we print the values out as floating point, with no decimal digits. This works in gawk, mawk, and original-awk and as the testing below show, seems to be the best way to do this. printf %u 0xFFFFFFFF | awk '{printf("%.0f %u %d", $1 , $1 , $1 )}' mawk: 4294967295 2147483647 2147483647 original-awk: 4294967295 2147483648 4294967295 gawk: 4294967295 4294967295 4294967295 The issue of %d not matching gawk and original-awk has been reported to ubuntu. In the future, I'd recommend that whenever awk is used, a format is specified. It doesn't seem that we can count on the representation being the same between the different versions. Change-Id: I7b6b821c8ab13ad11f72e674ac726a98e8678710 Signed-off-by: Martin Roth <martin.roth@se-eng.com> Reviewed-on: http://review.coreboot.org/2628 Reviewed-by: Dave Frodin <dave.frodin@se-eng.com> Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
d0d7e7d761
commit
d2be1f11e1
|
@ -25,7 +25,8 @@ HUDSON_FWM_POSITION=$(shell printf %u $(CONFIG_HUDSON_FWM_POSITION))
|
||||||
#assume the cbfs header is less than 128 bytes.
|
#assume the cbfs header is less than 128 bytes.
|
||||||
ROMSIG_SIZE=16
|
ROMSIG_SIZE=16
|
||||||
ifeq ($(CONFIG_HUDSON_XHCI_FWM), y)
|
ifeq ($(CONFIG_HUDSON_XHCI_FWM), y)
|
||||||
HUDSON_XHCI_POSITION=$(shell echo $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) 128 | awk '{print $$1 + $$2 + $$3}')
|
HUDSON_XHCI_POSITION=$(shell echo $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) 128 \
|
||||||
|
| awk '{printf("%.0f", $$1 + $$2 + $$3)}')
|
||||||
XHCI_FWM_SIZE=$(word 5,$(shell ls -l $(CONFIG_HUDSON_XHCI_FWM_FILE)))
|
XHCI_FWM_SIZE=$(word 5,$(shell ls -l $(CONFIG_HUDSON_XHCI_FWM_FILE)))
|
||||||
else
|
else
|
||||||
HUDSON_XHCI_POSITION=0
|
HUDSON_XHCI_POSITION=0
|
||||||
|
@ -34,7 +35,8 @@ endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_HUDSON_GEC_FWM), y)
|
ifeq ($(CONFIG_HUDSON_GEC_FWM), y)
|
||||||
HUDSON_GEC_POSITION=$(shell echo $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) 128 \
|
HUDSON_GEC_POSITION=$(shell echo $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) 128 \
|
||||||
$(XHCI_FWM_SIZE) 128 | awk '{print $$1 + $$2 + $$3 + $$4 + $$5}')
|
$(XHCI_FWM_SIZE) 128 \
|
||||||
|
| awk '{printf("%.0f", $$1 + $$2 + $$3 + $$4 + $$5)}')
|
||||||
GEC_FWM_SIZE=$(word 5,$(shell ls -l $(CONFIG_HUDSON_GEC_FWM_FILE)))
|
GEC_FWM_SIZE=$(word 5,$(shell ls -l $(CONFIG_HUDSON_GEC_FWM_FILE)))
|
||||||
else
|
else
|
||||||
HUDSON_GEC_POSITION=0
|
HUDSON_GEC_POSITION=0
|
||||||
|
@ -42,10 +44,11 @@ GEC_FWM_SIZE=0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_HUDSON_IMC_FWM), y)
|
ifeq ($(CONFIG_HUDSON_IMC_FWM), y)
|
||||||
HUDSON_IMC_POSITION_UNALIGN=$(shell echo $(HUDSON_FWM_POSITION) $(ROMSIG_SIZE) 128 \
|
HUDSON_IMC_POSITION_UNALIGN=$(shell echo $(HUDSON_FWM_POSITION) \
|
||||||
$(XHCI_FWM_SIZE) 128 \
|
$(ROMSIG_SIZE) 128 $(XHCI_FWM_SIZE) 128 $(GEC_FWM_SIZE) 128 65535 \
|
||||||
$(GEC_FWM_SIZE) 128 65535 | awk '{print $$1 + $$2 + $$3 + $$4 + $$5 + $$6 + $$7 + $$8}')
|
| awk '{printf("%.0f", $$1 + $$2 + $$3 + $$4 + $$5 + $$6 + $$7 + $$8)}')
|
||||||
HUDSON_IMC_POSITION=$(shell echo $(HUDSON_IMC_POSITION_UNALIGN) | awk '{print $$1 - $$1 % 65536}')
|
HUDSON_IMC_POSITION=$(shell echo $(HUDSON_IMC_POSITION_UNALIGN) \
|
||||||
|
| awk '{printf("%.0f", $$1 - $$1 % 65536)}')
|
||||||
else
|
else
|
||||||
HUDSON_IMC_POSITION=0
|
HUDSON_IMC_POSITION=0
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -70,8 +70,10 @@ SB800_FWM_POSITION=$(shell printf %u $(CONFIG_SB800_FWM_POSITION))
|
||||||
#assume the cbfs header is less than 128 bytes.
|
#assume the cbfs header is less than 128 bytes.
|
||||||
ROMSIG_SIZE=16
|
ROMSIG_SIZE=16
|
||||||
|
|
||||||
SB800_IMC_POSITION_UNALIGN=$(shell echo $(SB800_FWM_POSITION) $(ROMSIG_SIZE) 128 65535 | awk '{print $$1 + $$2 + $$3 + $$4}')
|
SB800_IMC_POSITION_UNALIGN=$(shell echo $(SB800_FWM_POSITION) $(ROMSIG_SIZE) \
|
||||||
SB800_IMC_POSITION=$(shell echo $(SB800_IMC_POSITION_UNALIGN) | awk '{print $$1 - $$1 % 65536}')
|
128 65535 | awk '{printf("%.0f", $$1 + $$2 + $$3 + $$4)}')
|
||||||
|
SB800_IMC_POSITION=$(shell echo $(SB800_IMC_POSITION_UNALIGN) \
|
||||||
|
| awk '{printf("%.0f", $$1 - $$1 % 65536)}')
|
||||||
|
|
||||||
$(obj)/coreboot_SB800_romsig.bin: \
|
$(obj)/coreboot_SB800_romsig.bin: \
|
||||||
$(call strip_quotes, $(CONFIG_SB800_IMC_FWM_FILE)) \
|
$(call strip_quotes, $(CONFIG_SB800_IMC_FWM_FILE)) \
|
||||||
|
|
Loading…
Reference in New Issue