Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Beaglebone black install - header.S fails compile[SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures
View previous topic :: View next topic  
Author Message
peterb001
n00b
n00b


Joined: 19 May 2013
Posts: 2

PostPosted: Mon May 20, 2013 7:21 am    Post subject: Beaglebone black install - header.S fails compile[SOLVED] Reply with quote

Hi,

I am attempting to install Gentoo on a Beaglebone black as per the instructions:

http://dev.gentoo.org/~armin76/arm/beagleboneblack/install.xml

The instruction to download a kernel:
Code:
(Download a kernel.org and patch it, may take a while)
# ./patch.sh

results in the assembly file "./kernel/arch/arm/boot/compressed/head.S" being downloaded.

The instruction to cross compile the kernel:
Code:
(Replace 9 with the number of cores you have on your computer)
# make -j9 ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- uImage dtbs

results in a number of errors indicating that the above file "head.S" needs editing to resolve the errors. Also another error I have not looked into regarding "vmlinux"

Output follows:
Code:
  SYSMAP  System.map
  OBJCOPY arch/arm/boot/Image
  Kernel: arch/arm/boot/Image is ready
  AS      arch/arm/boot/compressed/head.o
arch/arm/boot/compressed/head.S: Assembler messages:
arch/arm/boot/compressed/head.S:120: Error: selected processor does not support requested special purpose register -- `mrs r9,cpsr'
arch/arm/boot/compressed/head.S:133: Error: selected processor does not support requested special purpose register -- `mrs r2,cpsr'
arch/arm/boot/compressed/head.S:140: Error: selected processor does not support requested special purpose register -- `mrs r0,cpsr'
arch/arm/boot/compressed/head.S:140: Error: selected processor does not support requested special purpose register -- `msr spsr_cxsf,r0'
arch/arm/boot/compressed/head.S:140: Error: selected processor does not support requested special purpose register -- `msr cpsr_c,r0'
arch/arm/boot/compressed/head.S:141: Error: selected processor does not support requested special purpose register -- `msr spsr_cxsf,r9'
make[2]: *** [arch/arm/boot/compressed/head.o] Error 1
make[1]: *** [arch/arm/boot/compressed/vmlinux] Error 2
make: *** [uImage] Error 2



Are the instructions at the above URL tested and complete?
Is there a patch or updated "arch/arm/boot/compressed/head.S" known?
Anything else I need to know to get Gentoo installed on the Beaglebone black?

Or can you point me to where I can find that information.

Thanks in advance.
Peter


Last edited by peterb001 on Tue May 28, 2013 8:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
rbv4531
n00b
n00b


Joined: 24 Dec 2003
Posts: 18

PostPosted: Tue May 28, 2013 4:00 pm    Post subject: Reply with quote

The command-line for building that file is pretty weird. Here's my guess at an explanation:

Have you ever put a x86_64 live image into an x86 computer without 64-bit support? You get a nice readable message printed to the display that your hardware is missing the 64-bit features required by this kernel.

In order to make that work, the very early bootstrap code needs to not use any hardware-specific features, because it has to run long enough on any hardware (assuming a related architecture) to test for those features. For that reason, the Linux kernel is set to build the early bootstrap code with -march=all instead of the specific processor the kernel is configured for. This works well on BIOS-based and EFI systems, where there's a hardware abstraction layer provided by the firmware that the early bootstrap code can use to report errors. On an embedded system, checking for the features is absolutely useless because there's no universal way to tell the user what's wrong.

Unfortunately, the linux kernel uses -march=all even on ARM systems. And the patched early bootstrap code is using instructions available only on the ARMv7 and above, which breaks with -march=all.

The workaround is to edit the Makefile used for the bootstrap code and just take -march=all out of the ASFLAGS. After that it will finish building.

Code:
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 5cad8a6..dfe5687 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -121,7 +121,7 @@ KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
 endif
 
 ccflags-y := -fpic -fno-builtin -I$(obj)
-asflags-y := -Wa,-march=all -DZIMAGE
+asflags-y := -DZIMAGE
 
 # Supply kernel BSS size to the decompressor via a linker symbol.
 KBSS_SZ = $(shell $(CROSS_COMPILE)size $(obj)/../../../../vmlinux | \
Back to top
View user's profile Send private message
peterb001
n00b
n00b


Joined: 19 May 2013
Posts: 2

PostPosted: Tue May 28, 2013 8:49 pm    Post subject: Reply with quote

rbv4531,

Thank you - that one change to "arch/arm/boot/compressed/Makefile" resulted in a successful build.

I am now able to proceed.


Thank you
Peterl
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum