The officially official Devuan Forum!

You are not logged in.

#1 2020-03-24 14:00:50

tuxd3v
Member
Registered: 2019-11-14
Posts: 183  

[ ARM64 ] Build for Radaxa RockPi4{A|B}

Hello All,
I have been busy trying to port Devuan to Radaxa RockPi4{A|B}.

This Image is initially a Server Role, later will come a Desktop Version..

In this case, v0.2beta Server build.

Features & Versions:

1) - Arm Trusted Firmware  - Master Branch BL31 Stage ( drivers for - CortexM0( PowerManagment ), The code to run in CPU cores are arm64 )
     U-boot boot-loader       - v2020.01 ( built for arm64 )
2) - Linux Kernel                - MainLine 5.6-rc7 ( built for arm64 )
3) - UserSpace                  - Devuan Beowulf ( for arm64 )

4) - ChangeLog                  - Beowulf,Add PanFrost Kernel Drivers,created Kernel deb packages
5) - Problems & to be done - This Image is beign tested, for stability, and will also start to be tested for features, audio, camera, display,mpcie,sdcard speeds, etc

1) BootLoader( ATF + u-boot )

Disk Partitioning scheme:

# parted /dev/mmcblk1
(...)                                                         
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      32.8kB  4129kB  4096kB               idbloader
 2      8389kB  12.6MB  4194kB               uboot
 3      12.6MB  16.8MB  4194kB               none
 4      16.8MB  130MB   113MB   ext2         boot       boot, esp
 5      134MB   1700MB  1566MB  ext4         rootfs

a)   - Bootloader( Arm Trusted Firmware + U-Boot ),
        1st partition( starting at sector 64, til sector 8063 ) 'idbloader.img'
        2nd partition( starting at sector 16384, til sector 24575 ) 'uboot.itb'
        3rd partition( starting at sector 24576, til sector 32767s ) 'none - empty'
  a1) - The Bootloader will search for a file called 'boot.scr', and after initialize the u-boot environment, will execute that script..
  a2) - In  'boot.scr', for this image, it will point to 'RockPi4A' Device Tree Binary File by default( was tested there.. )..
  a3) - If you have other board than  'RockPi4A', exe: 'rk3399-khadas-edge', please Read Bellow in the 'Notes Section'..   
b)  - 4th partition( starting at sector 32768 ), is mounted as  '/boot', and contain 'boot.scr' refered in a1),a2).
c)  - 5th partition( starting at sector 262144 ) is mounted as rootfs '/'

NOTA!
The Bootloader in a) usually takes ~1MiB( idbloader.img + uboot.itb )..
Each time a bootloader is built, all area [ sectors 64 - 32767 ], needs to be clean first( so that you can flash the new bootloader.. because could still be there any bits of the previous one.. which could lead to unpredictable consequences.. ).
In this case as you see above we are using only partition 1, and 2 of the bootloader.

If you have Other Board than 'RockPi4A', situation described in a3):
The 'boot.cmd' script( format, Human Readable ):

setenv macaddr 42 6A C3 80 24 65
#setenv console tty1
#setenv stdout serial,vga
#setenv stderr serial,vga

#setenv scriptaddr 0x00500000
#setenv kernel_addr_r 0x02080000
#setenv fdt_addr_r 0x01f00000

setenv devtype mmc
setenv devnum 1

part uuid ${devtype} ${devnum}:5 uuid
setenv bootargs earlyprintk earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1 coherent_pool=1m net.ifnames=0 biosdevname=0 console=ttyS2,1500000n8 root=PARTUUID=${uuid} ro fsck.repair=yes rootwait

if ext2load ${devtype} ${devnum}:4 ${kernel_addr_r} vmlinuz; then
  if ext4load ${devtype} ${devnum}:5 ${fdt_addr_r} /usr/lib/linux-image-5.6.0-rc7/rockchip/rk3399-rock-pi-4.dtb; then
    fdt addr ${fdt_addr_r}
    fdt resize 65536
    fdt set /ethernet@fe300000 local-mac-address "[${macaddr}]"
    booti ${kernel_addr_r} - ${fdt_addr_r}
  fi;
fi

Write this Image, to a sd-card, then mount it, and change the 'boot.cmd' script to point to your board..
# You can find a list of supported boards in: '/usr/lib/linux-image-5.6.0-rc7/rockchip'
# Edit the file 'boot.cmd', with 'vi' for example.
# change the line:

if ext4load ${devtype} ${devnum}:5 ${fdt_addr_r} /usr/lib/linux-image-5.6.0-rc7/rockchip/rk3399-rock-pi-4.dtb; then

to

if ext4load ${devtype} ${devnum}:5 ${fdt_addr_r} /usr/lib/linux-image-5.6.0-rc7/rockchip/your-board; then

Save the file,
# Generate the real script file( binary ), 'boot.scr'

mkimage -C none -A arm64 -T script -d boot.cmd boot.scr

2) - Linux Kernel

Packages:
Linux Kernel 5.6-rc7:

root@RockPi4A:~# dpkg -l |grep -E "(linux-.*(headers|image|libc-dev))"
ii  linux-headers-5.6.0-rc7    5.6.0-rc7-1                        arm64        Linux kernel headers for 5.6.0-rc7 on arm64
ii  linux-image-5.6.0-rc7      5.6.0-rc7-1                        arm64        Linux kernel, version 5.6.0-rc7
ii  linux-libc-dev:arm64       5.6.0-rc7-1                        arm64        Linux support headers for userspace development

The target will be to reach, at least Linux kernel 5.6, improve  the Device Tree Bindings, when possible..

3) - UserSpace -Users & Passwords:

1) root      - password 'toor'
2) devuan - password 'devuan'

NOTA!
SSH is enabled, so that you can login, but root login, is disabled, you should login as 'devuan', only then switch to 'root', if you want to.. for that,
After Login as 'devuan', issue:

sudo su -

And type your 'devuan' password, that's it..

4) - Changelog

a) kernel update to 5.6-rc7,
b) Beowulf  Userspace,
c) Panfrost Kernel Graphics Driver,
d) Power provided by QUALCOMM QUICK CHARGE 2 or 3 was detected and Working
f) Now the image contains traditional kernel deb-packages( .deb )

5) - Problems and testings to be done..

a) After migration to beowulf, its impossible, for now, to automount zramfs as swap, automatically.. you need to issue

swapon -a

it could be related with several packages, including those(  most probably): init init-system-helpers initscripts insserv eudev mawk sed
This problem does not occur in RPi1 Image
b) - Testing is needed, on camera interfaces, display Interface, HDMI( but its working, resolution needs fix's ).
c) - Testing is needed on Video and Audio.
d) - Testing is needed on mpcie( M.2 ) interface, and also on emmc( Flash ).
e) - Compile UserSpace Mesa Panfrost Driver stack( userspace counterpart for kernel space one.. )
f) - Check USB2/USB3 functionality( USB3 was tested already with a mouse and a keyboard, but more serious tests will ne needed )
g) - Check Power on via tipical USB Type-C

For this image, to reach more Supported Hardware and Users, your help is also needed smile
Testing this image, and posting your feedback.

SHA256sum:

$ sha256sum devuan-beowulf-rockpi4A-arm64-0.2-beta.img.xz
f6f24a29797f22b816b9e6318007ac4db0b706aed40a1b0023b8869cc1d73fb4  devuan-beowulf-rockpi4A-arm64-0.2-beta.img.xz

Best Regards,
tux

Last edited by tuxd3v (2020-04-03 17:49:33)


Best Regards,
tux

Offline

Board footer