apritzel / pine64

Pine64 Linux images and information
119 stars 28 forks source link

How it is created #7

Closed ghost closed 7 years ago

ghost commented 8 years ago

Hi, First I wanna thank you for this fantastic work, that's what I was waitinf for for my board. I just want to know if it's possible that you share how you did it and explain all the steps followed. thanks in advance,

apritzel commented 8 years ago

Thanks for your interest! I will push some elaborate documentation later this week, but for now a quick and coarse list of things:

  1. use an arm64 cross compiler: export CROSS_COMPILE=aarch64-linux-gnu-
  2. get ATF (allwinner branch of arm-trusted-firmware from my github)
  3. build ATF: make PLAT=sun50iw1p1 DEBUG=1 bl31
  4. get upstream U-Boot
  5. build U-Boot: make pine64_plus_defconfig && make
  6. get hold of a boot0.img file (dd if=/dev/sdx of=boot0.img bs=8k skip=1 count=4 from an existing image, which could be Android as well)
  7. get and compile the boot0img tool from this repo
  8. combine all the binaries into an image: ./boot0img -b boot0.img -d trampoline64:0x44000 -u u-boot.bin -e -s bl31.bin -a 0x44008 -o pine64.img
  9. write that binary to a microSD card: dd if=pine64.img of=/dev/sdx bs=8k seek=1 skip=1
vagrantc commented 8 years ago

some more detailed instructions here: https://gist.github.com/apritzel/68941c29c77955f1daa45b50d36c5425

stolendata commented 7 years ago

May I ask what toolchain and compiler you are using? With GCC 5.4.0 (GNU as 2.26.1) I run into this problem:

bl31/aarch64/runtime_exceptions.S: Assembler messages:
bl31/aarch64/runtime_exceptions.S:193: Error: non-constant expression in ".if" statement
...

This if-clause in include/common/aarch64/asm_macros.S seems to be the problem:

.macro check_vector_size since
  .if (. - \since) > (32 * 4)
    .error "Vector exceeds 32 instructions"
  .endif
.endm
apritzel commented 7 years ago

I guess you are building the wrong branch. Please checkout the allwinner branch and build that according to the instructions given: make PLAT=sun50iw1p1 DEBUG=1 bl31

But to not dodge your question: Yes, this is a known problem. ATF (since commit 79627dc37259) unfortunately relies on a fixed toolchain, since this issue is caused by a binutils bug. You can quickly fix this by removing the ",0" after the .align directives in include/common/aarch64/asm_macros.S, as in:

--- a/include/common/aarch64/asm_macros.S
+++ b/include/common/aarch64/asm_macros.S
@@ -77,7 +77,7 @@
         */
        .macro vector_base  label
        .section .vectors, "ax"
-       .align 11, 0
+       .align 11
        \label:
        .endm

@@ -90,7 +90,7 @@
         */
        .macro vector_entry  label
        .section .vectors, "ax"
-       .align 7, 0
+       .align 7
        \label:
        .endm