Subject: linux-next: firmware build failure

From: Stephen Rothwell <[email-masked]>
Date: Wed, 4 Jun 2008 16:46:23 +1000

Hi David,

Today's linux-next build (x86_64 allmodconfig) failed like this:

firmware/whiteheat_loader.fw.gen.S: Assembler messages:
firmware/whiteheat_loader.fw.gen.S:8: Error: alignment not a power of 2
firmware/whiteheat_loader.fw.gen.S:12: Error: alignment not a power of 2

This file looked like:
-------------------------------------------
/* Generated by firmware/Makefile */
    .section .rodata
    .align 
_fw_whiteheat_loader_fw_bin:
    .incbin "firmware/whiteheat_loader.fw"
_fw_end:
   .section .rodata.str,"aMS",@progbits,1
    .align 3
_fw_whiteheat_loader_fw_name:
    .string "whiteheat_loader.fw"
    .section .builtin_fw,"a",@progbits
    .align 3
    .quad _fw_whiteheat_loader_fw_name
    .quad _fw_whiteheat_loader_fw_bin
    .quad _fw_end - _fw_whiteheat_loader_fw_bin
------------------------------------------------

My gas manual says: "The way the required alignment is specified varies
from system to system."  So you should probably use .p2align instead (see
patch below.

Also:

drivers/net/usb/kaweth.c: In function 'kaweth_download_firmware':
drivers/net/usb/kaweth.c:422: error: 'data' undeclared (first use in this function)

Fixed by patch below (should be done better).
-- 
Cheers,
Stephen Rothwell                    [email-masked]

>>From f0c5123415078e99c9b37d73afb9221dafcecd1d Mon Sep 17 00:00:00 2001
From: Stephen Rothwell <[email-masked]>
Date: Wed, 4 Jun 2008 16:44:11 +1000
Subject: [PATCH] firmware: build fixes 1

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 drivers/net/usb/kaweth.c |    2 ++
 firmware/Makefile        |    6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 156b61c..9b1da4b 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -419,9 +419,11 @@ static int kaweth_download_firmware(struct kaweth_device *kaweth,
 	dbg("High: %i, Low:%i", kaweth->firmware_buf[3],
 		   kaweth->firmware_buf[2]);
 
+#if 0
 	dbg("Downloading firmware at %p to kaweth device at %p",
 	    data,
 	    kaweth);
+#endif
 	dbg("Firmware length: %d", data_len);
 
 	return kaweth_control(kaweth,
diff --git a/firmware/Makefile b/firmware/Makefile
index 1d84237..d1e4675 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -61,16 +61,16 @@ quiet_cmd_fwbin = MK_FW   $@
 		  ASM_ALIGN=$(if $(CONFIG_64BIT),3,2);			     \
 		  echo "/* Generated by firmware/Makefile */"		> $@;\
 		  echo "    .section .rodata"				>>$@;\
-		  echo "    .align $(ASM_ALIGN)"			>>$@;\
+		  echo "    .p2align $${ASM_ALIGN}"			>>$@;\
 		  echo "_fw_$${FWSTR}_bin:"				>>$@;\
 		  echo "    .incbin \"$(2)\""				>>$@;\
 		  echo "_fw_end:"					>>$@;\
 		  echo "   .section .rodata.str,\"aMS\",@progbits,1"	>>$@;\
-		  echo "    .align $${ASM_ALIGN}"			>>$@;\
+		  echo "    .p2align $${ASM_ALIGN}"			>>$@;\
 		  echo "_fw_$${FWSTR}_name:"				>>$@;\
 		  echo "    .string \"$$FWNAME\""			>>$@;\
 		  echo "    .section .builtin_fw,\"a\",@progbits"	>>$@;\
-		  echo "    .align $${ASM_ALIGN}"			>>$@;\
+		  echo "    .p2align $${ASM_ALIGN}"			>>$@;\
 		  echo "    $${ASM_WORD} _fw_$${FWSTR}_name" 		>>$@;\
 		  echo "    $${ASM_WORD} _fw_$${FWSTR}_bin" 		>>$@;\
 		  echo "    $${ASM_WORD} _fw_end - _fw_$${FWSTR}_bin"	>>$@;
-- 
1.5.5.3