Firefly Open Source Community

   Login   |   Register   |
New_Topic
123
New Topic
Print Previous Topic Next Topic

How To get your brand new RK3399 to actually boot linux.

46

Credits

1

Prestige

0

Contribution

new registration

Rank: 1

Credits
46

How To get your brand new RK3399 to actually boot linux.

Posted at 5/13/2018 14:53:02      View:16948 | Replies:27        Print      Only Author   [Copy Link] 1#
I've seen a few posts here by users figuring they have a defective unit.

Whenever they ask for help they are just pointed to some web page that's badly written with directions that don't work.

I'm not sure if a recent batch of FireFly RK3399's were shipped to people like me with only the Android image installed, whether the Quick Start > Starter Guide is just really out of date or there's a QC (Quality Cotroll) problem with the shipments.

My shiny new unit, booted up Android fine and I immediately wanted to boot to Linux as the Fly is advertised as being dual-boot.

(I personally have no interest in Android and will probably never use it and question why it's installed as the default boot, but someone must have figured that's what most users want.)

The problem is, if you follow Quick Start > Sarter Guide > Q1: How to switch to Ubuntu from Android - it will always boot to a black screen - because there is no Ubuntu pre-installed. Why on earth that option was set in Android if there is no Ubuntu partition to boot to is beyond me.

I've discovered that most of the documentation I've run across on the FireFly site is badly written and/or out of date. This is probably because quite a lot of it comes from the RockChip site. To make matters worse, there are so many versions of dev programs that probably originated at RockChip and ended up on gihub and gitlab and elsewhere.

Add to the list that Downloads pages such as the following for Firmware Upgrade Tool only have notes in Chinese. Two tools are listed there with different names and versions.

Anyway, let's hope FireFily do something about making this experience of purchasing one of their products enjoyable instead of painful.

Here's how I got linux installed on my Fly.

1.        I don't use Windows, so I had to install Linux on an old Mac Mini. I set it up for dual boot.

2.        Download an Ubuntu Linux image file onto your Linux host machine.

        There were a couple listed around here, somewhere I dound and downloaded the one named:
                Firefly-RK3399-ubuntu16.04-20180416112819.img

        which unpacked (tar xzf) to
                Firefly-RK3399-ubuntu16.04-20180416112819.img

3.        Download both of the upgrade tools from Download > Tools > Firmware > Linux to your host
        linux machine:

                Linux_Upgrade_Tool_v1.24.zip
                upgrade_tool_v1_26.tar.gz

4.        Untar/Unzip each in a separate directory.

        Name the directories something like:

                ut-v1_24
                ut-v1_26

        Unzip Linux_Upgrade_Tool_v1.24.zip         in ut-v1_24
        Untar upgrade_tool_v1_26.tar.gz                        in ut-v1_26

        The v1.24 probably works, but I used the v1_26.

        (There is also a v1_33 on RockChip's github area that I found later on, but I haven't
        tested it).

5.        The compressed tar file upgrade_tool_v1_26.tar.gz is missing an important file called
        config.ini, so copy if rom the ut-v1_24 directory to the ut-v1_26 directory.

        You can also create your own config.ini with the following lines:

                firmware=
                loader=
                parameter=
                misc=
                boot=
                kernel=
                system=
                recovery=
                rockusb_id=
                msc_id=

6.        I made a symbolic link in the v1_26 update_tool directory to the image file that I'd downloaded
        in step 2 to make life easier. I called it 'update.img' because that seems to be the norm.

        So in the v1_26 directory:

                ln -s ../path/to/Firefly-RK3399-ubuntu16.04-20180416112819.img        update.img

        (Be careful, if you're new to using 'ln -s' it's easy to nuke the source file if you swap the
        source and target names)

7.        Make sure your FireFly RK3399 is powered up.

        Plug in the USB -> USB-C cable between your linux host and the FireFly and then
        get it into loader mode:

                Press and *hold* the Recovery button (left hand side)
                Briefly press and release the Reset button (right hand side)
                Wait a second and release the Recovery button.

8.        Fire up upgrade_tool in the v1_26 directory. it should give a list of connected
        devices, yours is likely to be 1, so type 1 and press return:

        sudo ./upgrade_tool

        List of rockusb connected
        DevNo=1        Vid=0x2207,Pid=0x330c,LocationID=107        Loader
        Found 1 rockusb,Select input DevNo,Rescan press <R>,Quit press <Q>:1

        ---------------------Tool Usage ---------------------
        Help:             H
        Quit:             Q
        Version:          V
        Clear Screen:     CS
        ------------------Upgrade Command ------------------
        ChooseDevice:        CD
        SwitchDevice:        SD
        UpgradeFirmware:        UF <Firmware>
        UpgradeLoader:        UL <Loader>
        DownloadImage:        DI <-p|-b|-k|-s|-r|-m image> [parameter file]
        DownloadBoot:        DB <Loader>
        EraseFlash:        EF <Loader|firmware>
        LowerFormat:        LF
        ----------------Professional Command -----------------
        TestDevice:        TD
        ResetDevice:        RD [subcode]
        ResetPipe:        RP [pipe]
        ReadFlashID:        RID
        ReadFlashInfo:        RFI
        ReadChipInfo:        RCI
        ReadSector:        RS  <BeginSec> <SectorLen> [-decode] [File]
        WriteSector:        WS  <BeginSec> <File>
        ReadLBA:        RL  <BeginSec> <SectorLen> [File]
        WriteLBA:        WL  <BeginSec> <File>
        EraseBlock:        EB <CS> <BeginBlock> <BlokcLen> [--Force]
        -------------------------------------------------------

        Now  just run the UpgradeFirmware command with the name of the image file:

        Rockusb>uf update.img


        Once it's done uploading, type 'Q' to quite.

9.        Reboot the FireFly - you can probably just press and hold the Reset button (right hand side)
        for a second and let go.

10.        With some luck, you will boot into Linux.


I'm very impressed with the built quality of my FireFly RK3399. It's just such a pity that support and documentation are so poor.

Case in point, next I want to install the rootfs (linux) onto my Samsung T5 portable SSD just plugged into the USB 3.0 port. It can average about 350 MB/sec versus 40 MB/sec on the eMCC.

I've been able to unpack the image file above and alter the parameter file to use /dev/sdaX,  but I've been unable to re-pack things together. It's frustrating as hell and really shouldn't be.

已有 1评分Prestige +1 Pack up reason
Pschae + 1 Very important, precise and well written

View all ratings

Reply

Use props Report

39

Credits

0

Prestige

0

Contribution

new registration

Rank: 1

Credits
39
Posted at 5/14/2018 10:44:52        Only Author  2#
@rpk.firefly
Thanks for your kind sharing the information.

Unfortunately,  In my case, RK3399 MAX (wtih 4GB/128GB) refuse to enter the so called upgrade mode with Recovery (hold) - Reset - Recovery (release) sequence.

I have tried MASK ROM mode but only to fail.

I expect your information on rootfs (linux) onto my Samsung T5 portable SSD just plugged into the USB 3.0 port.
It would be super solution for relatively slow EMM.

Cheers

Cheers
Reply

Use props Report

46

Credits

1

Prestige

0

Contribution

new registration

Rank: 1

Credits
46
Posted at 5/15/2018 15:31:36        Only Author  3#
kimkk Posted at 5/14/2018 10:44
@rpk.firefly
Thanks for your kind sharing the information.

Sorry to hear about not getting into a loader mode.

Were you able to initially boot and it came up with Android?

Reply

Use props Report

46

Credits

1

Prestige

0

Contribution

new registration

Rank: 1

Credits
46
Posted at 5/15/2018 15:55:16        Only Author  4#
I've made some headway on re-packing the image file.

All the examples I've come across from this site and RockChip are extremely messed up. The toolsets are included in parent folders named 'rktools' and 'rockdev'. The two main programs there are 'afptool' and 'rkImageMaker' - however the scripts set up to pack/unpack are badly written as far as pipeline is concerned. Also the 'package-file' is some generic default and won't work until you fix it. Kinda lame.

I partitioned the Samsung T5 with 3 standard partitions (my reasoning was I could always
plug the drive into another box after modding the EFI partition):

EFI - 500MB (sda1)
swap - 500MB (sda2)
rootfs - remainder (sda3)

and modified the CMDLINE to use root=/dev/sda3 in the parameter.txt file.

Everything uploaded fine, but didn't boot to the disk. I'm not sure yet if I need to clear the eMMC flash first.

Anyway, I've reloaded the old image file, and I'm just going to format the drive with a single partition and try that.

I'll post some sensible instructions if/when I get this all sorted out.

I hope that when China puts a bunch of dudes in a rocket to the Moon they're not using RockChip or FireFly software
and instructions [hah!]
Reply

Use props Report

46

Credits

1

Prestige

0

Contribution

new registration

Rank: 1

Credits
46
Posted at 5/15/2018 20:05:45        Only Author  5#
I had to jump through some hoops, but I was able to get Linux installed and booting the FireFly on the Samsung T5 SSD via the USB 3.0 port.

I'm going to repartition the drive tomorrow and add swap and a general filesystem so that I can run the gnome_disks benchmark (you can't run it on a partition that's running the system).

I'll post instructions later.
Reply

Use props Report

46

Credits

1

Prestige

0

Contribution

new registration

Rank: 1

Credits
46
Posted at 5/16/2018 14:40:03        Only Author  6#


Here's a benchmark made with gnome-disks on a partition of a Samsung T5 portable SSD mounted via the USB 3.0 port on the FireFly RK3399. The FireFly was running Ubuntu 16.04 and booted from a different partition on the same drive.

Average Read Rate is 373.3 MB/s and Average Write Rate is 381.4 MB/s.

Tied with the 10/100/1000 based ethernet port, this model of the "Fly" has the potential of being a cool little server.




RockChip, the suppliers of the main chipset in the RK339 state on their website that the unit can have the boot (kernel) and the rootfs mounted via a USB device, however I haven't located documentation of the FireFly site yet as to how to specify a USB based partition for boot.

Unfortunately there appears to be a bug in the current firmware when the RK3399 is in the firmware update mode. It should be possible to upload the linuxrootfs.img portion of the update.img to an external USB device. The program update_tool does not give any errors when an upload is made, but the image does not get installed.

I realized later that there is no power on either the USB 3.0 or the USB 2.0 ports when the unit is in the update mode.

I used gnome-disks to install the linuxrootfs_normal.img (extracted from the update.img package with unpack.sh in the RockChip rockdev utilities) to a partition and then ran resize2fs to utilize the full partition size.

It occurred to me that if you are running Linux (as opposed to Windows) on the machine that you are uploading to the FireFly from, you can manage all the partitioning and installation of the linuxrootfs.img on that machine instead of the FireFly.

I haven't looked at the Android image installation process, but I assume you could have multiple Android images pre-installed on their own partitions too.

I formatted this drive with an 500 MB EFI partition (you do not need that) followed by a 5.5 GB linux-swap partition, then two 100 GB ext4 partitions to load different versions of Ubuntu onto.

I haven't looked at configuring the swap partition yet, but I assume it won't be hard and it will 9-10 times faster than using the onboard eMMC Flash memory.

The really cool part of the process is how simple it is to switch the boot partitions on the FireFly.

First of all, you should install a full update to the onboard eMMC Flash so that you can always switch to it as the main boot if you need to as a safety precaution (or I assume load Android onto it).

After that, it's really simple to switch to partitions on a USB drive for startup. You start by putting the FireFly into update mode via the Recovery-Reset-Recovery button combination and run the upgrade_tool application on the other computer.

You just need a simple text file specifying the boot partition and use upgrade_tool to upload that file with the command (after you've selected the FireFly):

  1. di -p parameterFileName
Copy the code



Here's an example, just set the root=/dev/sda(number) to the partition number on the USB drive that has a linuxrootfs installed - in this example I have a rootfs installed on /dev/sda3:

  1. CMDLINE: console=ttyFIQ0 root=/dev/sda3 rw rootwait mtdparts=rk29xxnand:0x00002000@0x00002000(uboot),0x00002000@0x00004000(trust),0x00008000@0x00006000(resource),0x0000A000@0x0000E000(kernel),0x00002000@0x00018000(backup),-@0x0001A000(boot)
Copy the code



To switch back to the eMCC root partition, you can have another text file that specifies /dev/mmcblk1p6 as the partion to use for the rootfs and send that once again with upgrade_tool:

  1. CMDLINE: console=ttyFIQ0 root=/dev/mmcblk1p6 rw rootwait mtdparts=rk29xxnand:0x00002000@0x00002000(uboot),0x00002000@0x00004000(trust),0x00008000@0x00006000(resource),0x0000A000@0x0000E000(kernel),0x00002000@0x00018000(backup),-@0x0001A000(boot)
Copy the code



If you have any questions, just leave a reply here and I'll get back (it might be a day or so).

I've been making lots of screenshots, so at some point I can write something more in depth about the whole process.

Reply

Use props Report

31

Credits

0

Prestige

0

Contribution

new registration

Rank: 1

Credits
31
Posted at 5/24/2018 15:57:31        Only Author  7#
HI Rpk
Just ordered a Firefly-RK3399 , I guess it will takes sometime to get it, but as soon as I get it I will try to load debian/ubuntu on it... will see
Cheers

This post is useless, I try it here to see how this forum works
Reply

Use props Report

31

Credits

0

Prestige

0

Contribution

new registration

Rank: 1

Credits
31
Posted at 5/24/2018 15:58:01        Only Author  8#
Ok it works
Reply

Use props Report

46

Credits

1

Prestige

0

Contribution

new registration

Rank: 1

Credits
46
Posted at 5/25/2018 06:34:44        Only Author  9#
phi Posted at 5/24/2018 15:57
HI Rpk
Just ordered a Firefly-RK3399 , I guess it will takes sometime to get it, but as soon as I g ...

Hi phi,

feel free to ask questions if you run into problems and I'll help if I can.

I only check the forums a couple of times a week though.

I really need to spend time on writing up some decent step by step instructions on installing
Ubuntu as I've personally found the FireFly documents and the RockChip utilites somewhat
lacking.

Good luck with your new unit.

I'm actually pretty impressed with it so far but also frustrated at times on the absence of
decent documentation and support.



Reply

Use props Report

31

Credits

0

Prestige

0

Contribution

new registration

Rank: 1

Credits
31
Posted at 5/25/2018 13:53:11        Only Author  10#
rpk.firefly Posted at 5/25/2018 06:34
Hi phi,

feel free to ask questions if you run into problems and I'll help if I can.

Hi Rpk,
Cool, I will volunteer to review your install process and may be add some infos to it

If you want to send me preview, or if you have a git repos don't hesitate to send at
phi dot debian at gmail dot com

Cheers,
Phi
Reply

Use props Report

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

This forum Credits Rules

Quick Reply Back to top Back to list