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


Messages In This Thread
BUILD CUSTOM SDK - by shaggy013 - 02-14-2022, 05:29 PM
RE: BUILD CUSTOM SDK - by fasani - 02-24-2022, 07:17 AM
RE: BUILD CUSTOM SDK - by shaggy013 - 02-24-2022, 08:53 AM
RE: BUILD CUSTOM SDK - by tllim - 02-27-2022, 04:12 PM
RE: BUILD CUSTOM SDK - by shaggy013 - 02-28-2022, 06:33 AM
RE: BUILD CUSTOM SDK - by shaggy013 - 03-02-2022, 03:04 AM
RE: BUILD CUSTOM SDK - by x893 - 03-05-2022, 12:06 AM
RE: BUILD CUSTOM SDK - by shaggy013 - 03-07-2022, 09:57 AM
RE: BUILD CUSTOM SDK - by x893 - 03-07-2022, 12:34 PM
RE: BUILD CUSTOM SDK - by shaggy013 - 03-10-2022, 05:58 AM
RE: BUILD CUSTOM SDK - by dieselnutjob - 03-07-2022, 04:59 PM
RE: BUILD CUSTOM SDK - by shaggy013 - 03-08-2022, 01:43 PM
RE: BUILD CUSTOM SDK - by shaggy013 - 03-09-2022, 05:09 PM
RE: BUILD CUSTOM SDK - by x893 - 03-10-2022, 03:44 AM
RE: BUILD CUSTOM SDK - by shaggy013 - 03-11-2022, 01:02 PM
RE: BUILD CUSTOM SDK - by Randomuser - 07-15-2022, 04:40 PM
RE: BUILD CUSTOM SDK - by dieselnutjob - 03-10-2022, 09:41 AM
RE: BUILD CUSTOM SDK - by shaggy013 - 03-10-2022, 12:13 PM
RE: BUILD CUSTOM SDK - by x893 - 03-10-2022, 04:01 PM
RE: BUILD CUSTOM SDK - by shaggy013 - 03-11-2022, 07:14 AM
RE: BUILD CUSTOM SDK - by Randomuser - 07-17-2022, 10:49 AM
RE: BUILD CUSTOM SDK - by shaggy013 - 07-17-2022, 11:00 AM
RE: BUILD CUSTOM SDK - by Randomuser - 07-18-2022, 10:30 AM
RE: BUILD CUSTOM SDK - by shaggy013 - 07-18-2022, 11:55 AM
RE: BUILD CUSTOM SDK - by Randomuser - 07-18-2022, 10:11 PM
RE: BUILD CUSTOM SDK - by shaggy013 - 07-20-2022, 07:37 AM
RE: BUILD CUSTOM SDK - by shaggy013 - 12-03-2022, 04:33 AM
RE: BUILD CUSTOM SDK - by shaggy013 - 12-05-2022, 01:05 PM

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

Forum Jump:


Users browsing this thread: 1 Guest(s)