BUILD CUSTOM SDK
#1
Made this bsp/sdk because the beta wich is on the site don't makes a image wich you can flash and boot from sd/emmc
and while mainline is cool a working bsp/sdk makes it more complete for me

I looked how raxda and firefly made their bsp/sdk and made a custom one for the Quartz64
used some scripts of them and adjusted so they work to build a image
Most sources are from rockchip and the just 2 or 3 comes from other sources (from firefly: rawimg script, qsetting and camera_engine_rkaiq package)
So i tried to keep it some kind rockchip original and those packages were not on the rockhcip site or other open places so if it is a problem i can remove them

The bsp/sdk builds a buildroot ,debian or yocto distro wich you can flash on a sd/emmc or rockchip images to do it the difficult way
the hardest part was to get the right revisions to make some packages work

The bsp/sdk has 2 kernel options kernel 4.19.19 or 5.10.66 from rockchip sources

the 4.19 is common used kernel for the rk3566/68 bsp/sdk kernel and it has
working hdmi,lan,usb,wifi,gpu and npu

* 4.19.219-2022-01-18

the 5.10 is a newer(experimental) one it is for the coming rk3588 and proberly for the newer android 12 rk3566/68 no confirmation but saw some info
working hdmi,lan,usb,gpu

* 5.10.66-2022-01-18

!! keep in mind 5.10 is way from stable npu crash no video but hdmi works !!!

pcie and bluetooth not tested
not included lcd,touchscreen (just broke one)

Uboot

just the latest from 2022-02-11

the distros have some simple usage and some test files are included like for the video ,gpu npu,wifi etc

Sure it it is far from perfect but at least it works to make a image

*** ADDED ***
Added buildconfigs for other pine boards with a rk356x  PineNote ,Quartz64-b and Soquartz
!!! DTS files not included only added a pinenote dts the soquartz and quartz64-b are just quartz64-a dts !!
so if you got a dts for dowmstream kernel bards you can add them

so instead of

quartz64-rk3566-buildroot-k4.mk
 you do
quartz64b-rk3566-buildroot-k4.mk        For building a Quartz64-B image
or
pinenote-rk3566-buildroot-k4.mk         For Building a Pinenote image
or
soquartz-rk3566-buildroot-k4.mk         For building a Soquartz image

and same for

quartz64-rk3566-raw-k4.mk

quartz64b-rk3566-raw-k4.mk        For building a Quartz64-B  SD-image
or
pinenote-rk3566-raw-k4.mk         For Building a Pinenote SD-image
or
soquartz-rk3566-raw-k4.mk         For building a Soquartz SD-image


*Needed*

Time Smile
Ubuntu 18.04 or 20.04
at least 200+GB of free space (yeah it likes to grow maybey more)

*Building*

#Packages Needed on pc

sudo apt-get install repo git ssh make gcc libssl-dev liblz4-tool \
expect g++ patchelf chrpath gawk texinfo chrpath diffstat binfmt-support \
qemu-user-static live-build bison flex fakeroot cmake gcc-multilib g++-multilib \
unzip device-tree-compiler python-pip ncurses-dev python-pyelftools

*Download BSP*

#make bsp/sdk folder

mkdir Quartz64

#go to Quartz64 folder

cd Quartz64

# make .repo folder

mkdir .repo

#go to .repo folder

cd .repo

#download repo

git clone https://github.com/rockchip-linux/repo
or
git clone https://gerrit.googlesource.com/git-repo repo

#make repo executable

chmod a+rx repo/repo

#go back

cd ..

# Download repo manifest

.repo/repo/repo init -u https://github.com/Shaggy013/manifests -b master -m rk356x_linux_custom_v1.2.8_20220309.xml

# Dowload bsp/sdk

.repo/repo/repo sync --no-clone-bundle

***** trouble ****
if it gives trouble about github account
https://elinux.org/Buildroot_how_to_contribute
configure section
**** only by trouble ****

Now you see that your Quartz64 folder is full with new folders and files
your Download is finished Smile

*Building*

There are 4 distros you can build Buildroot,Debian,Ubuntu and Yocto
You can choose to make the distro against the 4.19 or 5.10 kernel

First you choose wich kernel

#for 4.19

./build.sh quartz64-rk3566-buildroot-k4.mk

#or 5.10

./build.sh quartz64-rk3566-buildroot-k5.mk

For the first time you have to do it twice the first time can give a error

you see something like this

***** example ****
processing option: quartz64-rk3566-buildroot-k4.mk
link kernel to proper kernel-directory
renew kernel to proper kernel-directory
link kernel 4
link Debian to proper Debian-distro
renew Debian to proper Debian-Distro
link debian to bullseye or buster
link kernel 4
switching to board: /home/thc013/corner/Quartz64-release/device/rockchip/rk356x/quartz64-rk3566-buildroot-k4.mk

****** example ****

so now you bsp is set to the right options

You have multiple options but you have to make a uboot,kernel and recovery and a rootfs so the best start is just as a base for the later buiding of distros

# build all (uboot,kernel,recovery,rootfs"buildroot",rockchip image) / AKA BUILDROOT

./build.sh

**Info**
For the 4.19 kernel you get after a few minutes a blue screen where you have to give the right voltage for the io-domains
watch carefull some domains are not asked Wink
the domain info comes from the schematic or the dts file

pmuio1-supply = <&vcc3v3_pmu>; not asked
pmuio2-supply = <&vcc_3v3>;
vccio1-supply = <&vccio_acodec>; 3,3
vccio2-supply = <&vcc_1v8>; not asked
vccio3-supply = <&vccio_sd>; 3,3
vccio4-supply = <&vcca1v8_pmu>;
vccio5-supply = <&vcc_3v3>;
vccio6-supply = <&vcc1v8_dvp>;
vccio7-supply = <&vcc_3v3>;
After that the buildroot will start the rest of the building
****

Depening on the speed of your pc it takes from a hour to ?
so after some coffee and some heat for the cold weather you get

Now it build a rockhip image DO NOT FLASH TO SD !!!!!!!!

Make buildroot image ok!
..../Quartz64/rockdev/pack/QUARTZ64-RK3566-BUILDROOT-K4-GPT-!DATE!-2137.img

Now it builds a rockhip image DO NOT FLASH TO SD !!!!!!!!

#change to the SD/EMMC IMAGE option

.#for 4.19

./build.sh quartz64-rk3566-raw-k4.mk

#or 5.10

./build.sh quartz64-rk3566-raw-k5.mk

#Build image

./build.sh rawimg

***Info ***
Make raw image ok!
..../Quartz64/rockdev/pack/QUARTZ64-RK3566-RAW-K4-GPT-!DATE!-2137.img

Now you can flash that image RAW to a sd or EMMC with your desired tool Etcher,dd etc

*****

Now you can build a Debian or a Yocto image

**** DEBIAN ******

#for 4.19

./build.sh quartz64-rk3566-buildroot-k4.mk

#or 5.10

./build.sh quartz64-rk3566-buildroot-k5.mk

!!
before building you have to install extra packages they differ from ubuntu and debian so you have to install or overwrite them first

sudo apt-get install binfmt-support qemu-user-static
sudo dpkg -i ubuntu-build-service/packages/*
sudo apt-get install -f


# build Debian rootfs

./build.sh debian

Now it build a rockhip image DO NOT FLASH TO SD !!!!!!!!

#change to the SD/EMMC IMAGE option

.#for 4.19

./build.sh quartz64-rk3566-raw-k4.mk

#or 5.10

./build.sh quartz64-rk3566-raw-k5.mk

#Build image

./build.sh rawimg

***Info ***
Make raw image ok!
..../Quartz64/rockdev/pack/QUARTZ64-RK3566-RAW-K4-GPT-!DATE!-2137.img

Now you can flash that image RAW to a sd or EMMC with your desired tool Etcher,dd etc

Same as rest /Quartz64/rockdev/pack/

**** Ubuntu ******

#for 4.19

./build.sh quartz64-rk3566-buildroot-k4.mk

#or 5.10

./build.sh quartz64-rk3566-buildroot-k5.mk

!!
before building you have to install extra packages they differ from ubuntu and debian so you have to install or overwrite them first

sudo apt-get install binfmt-support qemu-user-static
sudo dpkg -i ubuntu-build-service/packages/*
sudo apt-get install -f

# build Ubuntu rootfs

./build.sh ubuntu

*** This build option ask after a few minutes the keyboard and region settings ****

Now it build a rockhip image DO NOT FLASH TO SD !!!!!!!!

#change to the SD/EMMC IMAGE option

.#for 4.19

./build.sh quartz64-rk3566-raw-k4.mk

#or 5.10

./build.sh quartz64-rk3566-raw-k5.mk

#Build image

./build.sh rawimg

***Info ***
Make raw image ok!
..../Quartz64/rockdev/pack/QUARTZ64-RK3566-RAW-K4-GPT-!DATE!-2137.img

Now you can flash that image RAW to a sd or EMMC with your desired tool Etcher,dd etc

Same as rest /Quartz64/rockdev/pack/



***** YOCTO *****
!!! Yocto can take a time to build the toolchain has also clang etc included !!!

#for 4.19

./build.sh quartz64-rk3566-buildroot-k4.mk

#or 5.10

./build.sh quartz64-rk3566-buildroot-k5.mk

# build Debian rootfs

./build.sh yocto

Now it build a rockhip image DO NOT FLASH TO SD !!!!!!!!

#change to the SD/EMMC IMAGE option

.#for 4.19

./build.sh quartz64-rk3566-raw-k4.mk

#or 5.10

./build.sh quartz64-rk3566-raw-k5.mk

#Build image

./build.sh rawimg

***Info ***
Make raw image ok!
..../Quartz64/rockdev/pack/QUARTZ64-RK3566-RAW-K4-GPT-!DATE!-2137.img

Now you can flash that image RAW to a sd or EMMC with your desired tool Etcher,dd etc

Same as rest /Quartz64/rockdev/pack/

***** BUILD OPTIONS ****

Available options:

*.mk              -switch to specified board config
launch              -list current SDK boards and switch to specified board config
uboot              -build uboot
spl                -build spl
loader            -build loader
kernel            -build kernel"
modules            -build kernel modules
modules2          -build kernel modules to rockdev/pack/modules *added*
toolchain          -build toolchain
extboot            -build extlinux boot.img, boot from EFI partition
rootfs            -build default rootfs, currently build buildroot as default
buildroot          -build buildroot rootfs
ramboot            -build ramboot image
multi-npu_boot    -build boot image for multi-npu board
yocto              -build yocto rootfs
debian            -build debian 9 or 10 rootfs !! set in config !! !! only bullseye included
ubuntu            -build Ubuntu 20.04 rootfs !! set in config !! !! only focal included
pcba              -build pcba not tested
recovery          -build recovery
all                -build uboot, kernel, rootfs, recovery image
cleanall          -clean uboot, kernel, rootfs, recovery
firmware          -pack all the image we need to boot up system
updateimg          -pack update image not tested
rawimg            -pack raw image
otapackage        -pack ab update otapackage image (update_ota.img) not tested
sdpackage          -pack update sdcard package image (update_sdcard.img) not tested
save              -save images, patches, commands used to debug
allsave            -build all & firmware & updateimg & save
check              -check the environment of building
info              -see the current board building information
app/<pkg>          -build packages in the dir of app/*
external/<pkg>    -build packages in the dir of external/*

**** Examples ****

For if you made changes to uboot or the kernel
buildroot is another story Smile

#u-boot

./build.sh uboot

#kernel

./build.sh kernel

#recovery

./build.sh recovery


***** Making modules from the kernel ****
it can be that you want to copy or have some kernel modules to copy to your image

./build.sh modules2

makes in the folder rockdev/pack/modules the kernel-modules

**********************************************************************************************************************

****** TESTS ******

the distros all contain a folder rockchip test with some simple demos and test even a benchmark

cd ~/rockchip_test

# some test options

./rockhip_test.sh

The npu video and gpu are most fun Smile

********

ddr test :                  1 (memtester & stressapptest)
cpufreq test:              2 (cpufreq stresstest)
????flash stress test:          3
# not working # bluetooth test:      4 (bluetooth on&off test)
# not working # audio test:          5
recovery test:              6 (default wipe all)
suspend_resume test:        7 (suspend & resume)
wifi test:                  8
ethernet test:              9
auto reboot test:          10
ddr freq scaling test       11
#not working # npu test              12
npu2 test                  13 (rk356x or rk3588)
??? camera test                14 (use rkisp_demo)
video test                  15 (use gstreamer-wayland and app_demo)
gpu test                            16 (use glmark2)
# not working# chromium test          17 (chromium with video hardware acceleration)"
nand power lost test:       18

*****

************ Last Info ******

That is almost step for step i hope Smile
it just started with a dts and boardconfig Smile but got a little bigger
if i made any faults or i missed something please let me know
no debug program just plain doing diff,reading(there is a lot),copy paste and some simple adjustments to make it work for me
well it was something diffrent as making a custom limo os for the limo M1 360 from vodafone in 2009 (got first to root cdc_nand) gone glory Smile
the sources and info you can all find them on google and github and gitlab

so no OFFICIAL ROCKCHIP or QUARTZ64 JUST !!CUSTOM!!


I will include download links with the images it compiles

and to make it work for another 3566 or 68 just make a boardconfig.mk in ?/Quartz64/device/rockchip/rk356x/
and make sure the defconfigs and dts are inthe right places Smile
well at least it gets you on the way Wink

SPECIAL THNX TO quartz64 chat , my free time ,a quartz64 too stay still alive ,ryzen 3700x+5700xt to keep me warm,20TB nas for the space,R.I.P sd (2),touchscreen,monitor and OPI4 (well the opi semi dead dont fuss with the fusb32 in uboot )


DOWNLOAD

# Buildroot 4.19
https://drive.google.com/file/d/1xdv4Tid...sp=sharing

# Yocto 4.19
https://drive.google.com/file/d/1sqNHhae...sp=sharing

# Debian Bullseye 4.19
https://drive.google.com/file/d/1GQV98SA...sp=sharing

*******

#Buildroot 5.10
https://drive.google.com/file/d/1_rK2d5t...sp=sharing

#Yocto 5.10
https://drive.google.com/file/d/1kRkdwrT...sp=sharing

#Debian Bullseye 5.10
https://drive.google.com/file/d/1kguM3XA...sp=sharing
  Reply
#2
Thanks for this, looks quite straightforward and detailed.
Bought a QUARTZ64 Model-A and as soon as it comes I will try to install Debian Linux. Does HDMI video output works with this Debian ARM dristribution?

If I got this correctly I can build this in another Linux and then make the Quartz computer boot from SD card?
Need to get around a lot of things so I can start with some clarity.
fasani.de
C++ programmer
  Reply
#3
well there are easier ways to build a own distro
you could extend on this but i would not recommend it

see it more that this is how you build a distro on the rockchip kernel . with all the troubels of a kernel from a brand

you would have more fun with building a own distro with the mainline kernel
  Reply
#4
Appreciate and thanks on the comprehensive build instruction. Can I repost on PINE64 wiki page?
  Reply
#5
(02-27-2022, 04:12 PM)tllim Wrote: Appreciate and thanks on the comprehensive build instruction. Can I repost on PINE64 wiki page?

Big Thnx Big Grin

Sure i made it as a guide so i cannot me be more happy if it is apreciated .
I can update it and a add a ubuntu build with it ? , or instead of 2 debian versions a ubuntu and debian one ?
Extend it to support other boards ?. or a add a little guide for it ?
that would make it complete Smile

i talk too much if you want some adjustments please let me know .
  Reply
#6
Updated the Guide

included Ubuntu

And added config files for other boards
!! DTS has still to be added !!

* the pinenote config has a change it works that dts is from the androd build .
  Reply
#7
(03-02-2022, 03:04 AM)shaggy013 Wrote: Updated the Guide

included Ubuntu

And added config files for other boards
!! DTS has still to be added !!

* the pinenote config has a change it works that dts is from the androd build .

Hello,
can you publish link to updated guide ?
Thankls
P.S. I check schematics for Quartz64-A and found that VCCIO5 use vcc_1v8 domain.
  Reply
#8
(03-05-2022, 12:06 AM)x893 Wrote:
(03-02-2022, 03:04 AM)shaggy013 Wrote: Updated the Guide

included Ubuntu

And added config files for other boards
!! DTS has still to be added !!

* the pinenote config has a change it works that dts is from the androd build .

Hello,
can you publish link to updated guide ?
Thankls
P.S. I check schematics for Quartz64-A and found that VCCIO5 use vcc_1v8 domain.
Thnx

Nice to see you checked shematics . and indeed page 5 says 1.8v then you scroll down to page 18 then you see 3,3v
and if you look at the dts of mainline and downstream it both says 3.3v Wink


https://gitlab.com/pine64-org/quartz-bsp...artz64.dts
https://gitlab.com/pine64-org/quartz-bsp...tz64-a.dts

sound and bluetooth need some attention that i didnt test well .
  Reply
#9
(03-07-2022, 09:57 AM)shaggy013 Wrote:
(03-05-2022, 12:06 AM)x893 Wrote:
(03-02-2022, 03:04 AM)shaggy013 Wrote: Updated the Guide

included Ubuntu

And added config files for other boards
!! DTS has still to be added !!

* the pinenote config has a change it works that dts is from the androd build .

Hello,
can you publish link to updated guide ?
Thankls
P.S. I check schematics for Quartz64-A and found that VCCIO5 use vcc_1v8 domain.
Thnx

Nice to see you checked shematics . and indeed page 5 says 1.8v then you scroll down to page 18 then you see 3,3v
and if you look at the dts of mainline and downstream it both says 3.3v Wink


https://gitlab.com/pine64-org/quartz-bsp...artz64.dts
https://gitlab.com/pine64-org/quartz-bsp...tz64-a.dts

sound and bluetooth need some attention that i didnt test well .

Hi,
today i build images (i have SD only) for SOQuartz and Quartz64-A but not check in depth.
I add issue for io-domain.sh to your github repository.
May be helpful to everyone.
Later check images with hardware.
Yes, some mistakes presents in schematics - VCCIO5 for SOQuartz abd Quartz64.
May be you know about ability to use X88 Pro 20 (8Gb/64Gb) as hardware for Ubuntu (can't found schematics for X88 Pro :-( )?
  Reply
#10
Have I understood correctly that with your 4.19 the MIPI-DSI LCD panel will work, but with your 5.10 it won't ?
I understand why everyone says just to use mainline, but for an LCD panel it doesn't yet work (though I think that they are getting near).
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SOQuartz Getting a working build dl-m10 7 4,968 01-23-2023, 06:38 PM
Last Post: diederik
  PCIe not working on custom board (soquartz) dferrg 1 2,374 02-23-2022, 04:31 AM
Last Post: dferrg
  Debian Userland on top of existing Linux build? dieselnutjob 3 4,007 01-25-2022, 01:12 PM
Last Post: dieselnutjob

Forum Jump:


Users browsing this thread: 1 Guest(s)