Firefly Open Source Community

   Login   |   Register   |
New_Topic
Print Previous Topic Next Topic

Build everything from scratch

112

Credits

10

Prestige

12

Contribution

registered members

Rank: 2

Credits
112
Posted at 3/15/2018 18:38:26      1#
I personally recommend using rockchip u-boot instead of firefly u-boot.

First sync rockchip repos:

repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b master
repo sync

build u-boot and flash the images to emmc:

build/mk-uboot.sh rk3399-firefly
rkdeveloptool wl 0x40 idbloader.img
rkdeveloptool wl 0x4000 uboot.img
rkdeveloptool wl 0x6000 trust.img

Now you can power on the device, use serial console to stop auto booting (hit any key before it proceeds), and write partitions tables with u-boot shell:
gpt write mmc 0 $partitions

After writing the partition table, connect the usb-c to your PC and use u-boot command "ums 0 mmc 0" to mount the emmc as mass storage, and there will be /dev/sdX1-sdX7, which is the default partition layout for RK3399.

You only need to care about sdX6 and sdX7, sdX6 is boot partition and sdX7 is rootfs.
Format sdX6 as fat32 or ext2 and place extlinux/extlinux.conf, kernel and dtb files there. (reference: http://opensource.rock-chips.com/wiki_Rockchip_Kernel)
sdX7 can be used as rootfs then. (ext4 or whatever your kernel supports. This should be specified in boot parameters, in extlinux.conf)
已有 1评分Prestige +10 Money +11 Contribution +12 Pack up reason
markwylde + 10 + 11 + 12

View all ratings

Reply

Use props Report

112

Credits

10

Prestige

12

Contribution

registered members

Rank: 2

Credits
112
Posted at 3/20/2018 09:32:52      2#
markwylde Posted at 3/20/2018 07:02
@cb182d thank you so much for your help. It's now getting further and to uboot. Still not at the s ...

Getting Linux working is relatively easy, you can even try to install mainline Debian buster on top of that (mount ext2 mmcblk1p6 on /boot, mmcblk1p7 on /, then just apt install flash-kernel linux-image-4.15-arm64), though it is only useful when you are planning a headless deploy and I haven't tried myself yet.

The most functional kernel is the Firefly kernel (https://gitlab.com/TeeFirefly/linux-kernel)
Just build this repo and copy arch/arm64/boot/Image and arch/arm64/boot/dts/rockchip/rk3399-firefly-linux.dtb to mmcblk1p6 (ext2) and create extlinux.conf

In case you have the following file layout

/boot
|-- Image
|-- extlinux
|   `-- extlinux.conf
`-- rk3399-firefly-linux.dtb

Then the extlinux.conf should be

label kernel
    kernel /Image
    fdt /rk3399-firefly-linux.dtb
    append  earlyprintk console=ttyFIQ0,115200 rw root=PARTUUID=b921b045-1d rootfstype=ext4 init=/sbin/init rootwait

the arg "PARTUUID=b921b045-1d" is the default partition UUID of "/dev/mmcblk1p7" when you create the gpt partition table on emmc with "gpt write mmc 0 $partitions" in u-boot.
This seems to be the only way to specify the root partition. I tried root=/dev/mmcblk1p7 but the kernel failed to locate the partition.
Reply

Use props Report

112

Credits

10

Prestige

12

Contribution

registered members

Rank: 2

Credits
112
Posted at 3/26/2018 13:07:12      3#
maarten Posted at 3/26/2018 10:50
Thanks a lot for these hints @cb182d! I have two questions:

1. when you say it's only useful for  ...

Display, GPU and VPU will not work with mainline kernel. (check http://opensource.rock-chips.com/wiki_Status_Matrix)
The big.LITTLE scheduling will not work either, CPU-bound tasks will not be pinned to Cortex-A72 cores, resulting unstable performance.
I haven't tested others by myself, because I only succeeded to boot into mainline Debian once and ssh into it.

For updating the kernel, if you use Debian packages (install both linux-image-*-arm64 and flash-kernel package), you will be able to update the kernel using apt, and "flash-kernel" package will generate everything needed in /boot partition. You don't need, and shouldn't, create extlinux.conf if you plan to use flash-kernel.
Reply

Use props Report

You need to log in before you can reply Login | Register

This forum Credits Rules

Quick Reply Back to top Back to list