PINE64
how to compile Linux from the SDK ? - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Quartz64 (https://forum.pine64.org/forumdisplay.php?fid=166)
+--- Forum: Linux on Quartz64 (https://forum.pine64.org/forumdisplay.php?fid=168)
+--- Thread: how to compile Linux from the SDK ? (/showthread.php?tid=15350)



how to compile Linux from the SDK ? - dieselnutjob - 11-17-2021

There is a "BSP Linux SDK ver 4.19 for Quartz64 model A SBC"  here https://wiki.pine64.org/wiki/Quartz64#BSP_Linux_SDK

But it isn't obvious how to use it.

So I had a guess.  I want Linux for a Quartz64 model A.

First I run ./envsetup.sh and it asks me to pick a "combo" out of 0-91.
Code:
62. rockchip_rk3566

looks good to me. So I go for that.

Then I run ./build.sh

it asks me
Code:
You're building on Linux
Lunch menu...pick a combo:

0. default BoardConfig.mk
1. BoardConfig-rk3566-evb2-lp4x-v10.mk
2. BoardConfig-rk3568-evb1-ddr4-v10-spi-nor-64M.mk
3. BoardConfig-rk3568-evb1-ddr4-v10.mk
4. BoardConfig-rk3568-nvr-spi-nand.mk
5. BoardConfig-rk3568-nvr.mk
6. BoardConfig.mk
Which would you like? [0]:

Which one is a Quartz64 ?



Must be option 1 right? as it's the only option with RK3566

Code:
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.host:108: scripts/dtc/dtc] Error 1
make[1]: *** [scripts/Makefile.build:425: scripts/dtc] Error 2
make: *** [Makefile:491: scripts] Error 2
ERROR: Running build_uboot failed!
ERROR: exit code 2 from line 341:
    ./make.sh $RK_UBOOT_DEFCONFIG ${RK_TRUST_INI_CONFIG:+../rkbin/RKTRUST/$RK_TRUST_INI_CONFIG} ${RK_SPL_INI_CONFIG:+../rkbin/RKBOOT/$RK_SPL_INI_CONFIG} ${RK_UBOOT_SIZE_CONFIG:+--sz-uboot $RK_UBOOT_SIZE_CONFIG} ${RK_TRUST_SIZE_CONFIG:+--sz-trust $RK_TRUST_SIZE_CONFIG}

Sad

The same patch that I suggest here for Android https://wiki.pine64.org/wiki/Android_SDK_for_RK3566 seems to help with Linux too


RE: how to compile Linux from the SDK ? - CounterPillow - 11-17-2021

Is there any reason why you're picking the BSP Linux? Mainline kernels are pretty far with regards to support at the moment.

Even if you want to use BSP Linux, I recommend you just use the BSP kernel from https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/


RE: how to compile Linux from the SDK ? - dieselnutjob - 11-17-2021

I really thought it was going to finish compiling, but then:-
Code:
2021-11-17T19:32:41 Scanning dependencies of target pseudo_valgrind
2021-11-17T19:32:41 [ 91%] Building CXX object Tests/CMakeLib/PseudoMemcheck/CMakeFiles/pseudo_valgrind.dir/ret0.cxx.o
2021-11-17T19:32:41 /data.ssd/philip/rk3566/manjaro/sdk/new_rk3566_linux/buildroot/output/rockchip_rk3566/build/host-cmake-3.8.2/Source/cmServerProtocol.cxx: In member function 'std::size_t std::hash<LanguageData>::operator()(const LanguageData&) const':
2021-11-17T19:32:41 /data.ssd/philip/rk3566/manjaro/sdk/new_rk3566_linux/buildroot/output/rockchip_rk3566/build/host-cmake-3.8.2/Source/cmServerProtocol.cxx:620:43: error: 'numeric_limits' is not a member of 'std'
2021-11-17T19:32:41 620 |                          (i.second ? std::numeric_limits<size_t>::max() : 0));
2021-11-17T19:32:41 |                                           ^~~~~~~~~~~~~~
2021-11-17T19:32:41 /data.ssd/philip/rk3566/manjaro/sdk/new_rk3566_linux/buildroot/output/rockchip_rk3566/build/host-cmake-3.8.2/Source/cmServerProtocol.cxx:620:64: error: expected primary-expression before '>' token
2021-11-17T19:32:41 620 |                          (i.second ? std::numeric_limits<size_t>::max() : 0));
2021-11-17T19:32:41 |                                                                ^
2021-11-17T19:32:41 /data.ssd/philip/rk3566/manjaro/sdk/new_rk3566_linux/buildroot/output/rockchip_rk3566/build/host-cmake-3.8.2/Source/cmServerProtocol.cxx:620:67: error: '::max' has not been declared; did you mean 'std::max'?
2021-11-17T19:32:41 620 |                          (i.second ? std::numeric_limits<size_t>::max() : 0));
2021-11-17T19:32:41 |                                                                   ^~~
2021-11-17T19:32:41 |                                                                   std::max



RE: how to compile Linux from the SDK ? - dieselnutjob - 11-18-2021

adding these two lines to buildroot/output/rockchip_rk3566/build/host-cmake-3.8.2/Source/cmServerProtocol.cxx seems to fix cmake:-
Code:
#include <stdexcept>
#include <limits>



RE: how to compile Linux from the SDK ? - dieselnutjob - 11-19-2021

(11-17-2021, 03:14 PM)CounterPillow Wrote: Is there any reason why you're picking the BSP Linux? Mainline kernels are pretty far with regards to support at the moment.

Even if you want to use BSP Linux, I recommend you just use the BSP kernel from https://gitlab.com/pine64-org/quartz-bsp/rockchip-linux/

BSP isn't my motive.

I have been able to modify an Armbian image from another device to boot on the quartz, and there are mara's excellent SLARM64 images, and the official Mandrake images as well (but none with the older 4.19 kernel, so no HDMI output).

However there is nothing that I can find that I can compile myself from source. I want working, compilable source code.

If anyone can help me to compile something for myself then I would be really helpful.

The boards are supposed to be "open source", but if all that you can run on them are images that other people have compiled and you can't compile it yourself, then is it really open source?


RE: how to compile Linux from the SDK ? - CounterPillow - 11-19-2021

(11-19-2021, 06:17 AM)dieselnutjob Wrote: However there is nothing that I can find that I can compile myself from source. I want working, compilable source code.

Then use upstream linux 5.16-rc1 and your own userland (buildroot or whatever?) instead of these jank rockchip bsp source dumps with awful tooling.

You can for example see what pgwipeout's CI does: https://gitlab.com/pgwipeout/quartz64_ci/-/blob/main/.gitlab-ci.yml


RE: how to compile Linux from the SDK ? - dieselnutjob - 11-19-2021

(11-19-2021, 08:33 AM)CounterPillow Wrote: You can for example see what pgwipeout's CI does: https://gitlab.com/pgwipeout/quartz64_ci/-/blob/main/.gitlab-ci.yml

would you mind explaining what that is please?

I don't think it's the kernel that's the problem. I am struggling to get u-boot to compile in Armbian. Once that works as you say it would be pretty easy to swap in any kernel that we like.


RE: how to compile Linux from the SDK ? - CounterPillow - 11-19-2021

For u-boot, you'll currently have to use downstream u-boot with some quartz specific patches, which you can find here: https://gitlab.com/pine64-org/quartz-bsp/u-boot/-/tree/quartz64

The CI I linked shows you how pgwipeout builds his u-boot for example in "u-boot-job", the lines in the "script" section of the yaml file are the shell commands that are run.