A Clean Gentoo for 'Rockchip'.

This recipe will re-create the hygienic gentoo installed on the RK pilot plant
at Pizarro. The resulting install will also contain the full set of
distfiles used in the rebuilding of the 'world', in /usr/portage/distfiles.

No promises are made of fitness for a particular use, or of provenance,
OTHER THAN as described above.

---------
Materials
---------

0 ) My PGP key

1 ) A rk3328-roc-cc machine

2 ) microSD card of at least 256MB capacity

3 ) USB3 drive of at least 8GB capacity

4 ) The prepared gentoo root fs: rk-gentoo.tar.gz

^ This is a CONVENTIONAL (i.e. not musltronic ) gentoo for arm64 architecture.

Only the SD card will contain machine-specific bootloaderisms:

5 ) The bootloaderisms: loaders.tar.gz

6 ) OPTIONAL: vendor-patched kernel source and .config:

asciilifeform-kernel.tar.gz

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 ) Verify the signature and hashes of above in MANIFEST.TXT !!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

----------------
SD Card for Boot
----------------

The rk3328-roc-cc can boot from either eMMC (not discussed, I do not
use it ) or microSD card (we will use the latter. ) To prepare a u-SD
card for booting, obtain a card of at least 256MB capacity, and place
into a suitable reader. The instructions below assume that this device
shows up on your system as /dev/sdb, and is writeable to by the user
as which you are working. Adjust as necessary.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WARNING: if you are careless, you WILL nuke YOUR workstation's disk!!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

First, create the partitions:

1 ) parted -s /dev/sdb mklabel gpt

2 ) parted -s -a optimal /dev/sdb unit s mkpart l1 64 8063

3 ) parted -s -a optimal /dev/sdb unit s mkpart l2 16384 24575

4 ) parted -s -a optimal /dev/sdb unit s mkpart t 24576 32767

5 ) parted -s -a optimal /dev/sdb unit s mkpart boot fat16 32768 262143

6 ) parted -s -a optimal /dev/sdb set 4 boot on

7 ) sync

Now extract the loader images:

8 ) tar xvfz loaders.tar.gz

9 ) dd if=l1.bin of=/dev/sdb1

^ this is the vendor's RAM initializer. Recent uboot obsoletes it,
but I have not tested this yet. For now we use the original.

10 ) dd if=l2.bin of=/dev/sdb2

^ this is more or less ordinary u-boot, Rockchip's www has the
source.

11 ) dd if=t.bin of=/dev/sdb3

^ this is the ARM hypervisor turd; ARM's www has the source.
AFAIK this thing does not actually do anything without OS support.

12 ) dd if=kern.bin of=/dev/sdb4

^ this is a FAT16 partition containing my kernel ( see further
below. ) It will get mounted as /boot later .

13 ) sync

14 ) Disconnect the SD reader from your workstation !

----------------------------
USB3 Stick for '/' Partition
----------------------------

Obtain a suitable USB3 stick. I recommend Samsung's.

It is also possible to use a mechanical (or SSD) SATA drive,
via a suitable adapter cable.

Do not use USB2 disks, gentooation will be painfully slow on these.

The instructions again assume that it is seen by the machine as
/dev/sdb. If this is not the case on your system, adjust the recipe.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WARNING: if you are careless, you WILL nuke YOUR workstation's disk!!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

1 ) parted -s -a optimal /dev/sdb mklabel gpt -- mkpart primary ext4 1 -1

2 ) mkfs.ext4 /dev/sdb1

3 ) sync

4 ) mount /dev/sdb1 /mnt/usb

5 ) tar pxvfz rk-gentoo.tar.gz -C /mnt/usb

6 ) edit, with your favourite text editor, /mnt/usb/conf.d/net :

comment out, if required, the line with dhcp, and uncomment and
properly adjust the ones pertaining to static ip; or leave this
config alone for a dhcp on boot.

7 ) put your hostname in /mnt/usb/conf.d/hostname

8 ) sync

9 ) umount /mnt/usb

10 ) Insert the SD card and USB3 drive into the RK machine;
connect the network cable, but see below first:

11 ) WARNING -- DO NOT EXPOSE THE BOX ON PUBLIC NET YET:

%%% the root password is null! %%%
%%% the ssh host privkey is unsecret! %%%

To fix these, boot up on an isolated LAN first, and, via ssh,

11-1 ) set the root password using the passwd command.

11-2 ) generate a NEW SSH HOSTKEY :

ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N ""

12 ) The kit is now ready for use.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Be aware that my kernel does not support video, mice, or keyboards,
it is meant purely for headless machines. If this is not what you
want, unpack asciilifeform-kernel.tar.gz , edit the config, and
build a new kernel; then install it into /boot (i.e. your SD card.)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This entry was written by Stanislav , posted on Tuesday April 24 2018 , filed under Bitcoin, Cold Air, Computation, Friends, Gentoo, NonLoper, SoftwareArchaeology, SoftwareSucks . Bookmark the permalink . Post a comment below or leave a trackback: Trackback URL.

10 Responses to “A Clean Gentoo for 'Rockchip'.”

  • spyked says:

    Hi Stan,

    Can you give any info on how you obtained the rootfs? Does the standard recipe for bootstrapping the Gentoo world work here, or is there more to it?

    • Stanislav says:

      Dear spyked,

      Great question!

      Answer: starting point was stage3-arm64-20161219.tar.bz2 (SHA512: 65618fe506d29fa124f9a9d3cdd4ba9ca263b9fb8af53e70fe8630069082a8ffc09a0bfdf4723719e61969baf842a74a4cd94c76a7c3e2e1d3385a1fee68f7ca) from gentoo.org; followed by the application of my gentoo delousing formula (see archive copy), a total world rebuild, and the installation of a few handy things (sbcl, midnight commander, etc).

      The 2016 snapshot was chosen on account of being (AFAIK) the last unafflicted with gcc5+ism.

      Yours,
      -S

      • spyked says:

        Thank you, Stan! I have some older ARMv7 boards lying around at the uni lab (old TI stuff, Beagleboard, Pandaboard, which if I remember correctly had most of the software stack open-sourced, including bootloader) and I want to give this a shot at some point. Won't beat the Pizarro Rockchip, but at least it should be fun to play with.

  • phf says:

    your nosuchlabs links no longer resolve, for example rk-gentoo.tar.gz

    • Stanislav says:

      Dear phf,

      All of the nosuchlabs.com/pub/... links should work again, as of right now. Please let me know if anything remains missing.

      Come and visit me in #asciilifeform on fleanode. You may want to catch up on logs first, however.

      Yours,
      -S

  • mitkey says:

    Hi Stanislav,

    I followed all steps above with success, but I was surprised that root password was not null! I had to create /root/.ssh/authorized_keys and copy a key there. (root fs downloaded from: http://nosuchlabs.com/pub/rockchip/rk-gentoo.tar.gz)
    In points 6 and 7 regarding to IP and hostname setup "etc" is missing in path /mnt/usb/conf.d/net

    • Stanislav says:

      Dear mitkey,

      Indeed not null: it was a random one generated during early tests. (Note that the user is reminded to change it, however.) Ditto re: 6 and 7.

      At some point I'll post an updated version of the RK snapshot: there are yet-other items that ought to be included in it, which at the time were not.

      Out of curiosity, what was your intended use case for this item ?

      Yours,
      -S

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" highlight="">


MANDATORY: Please prove that you are human:

21 xor 110 = ?

What is the serial baud rate of the FG device ?


Answer the riddle correctly before clicking "Submit", or comment will NOT appear! Not in moderation queue, NOWHERE!