The Mer Wiki now uses your Mer user account and password (create account on https://bugs.merproject.org/)


Adaptations/PinePhone64

From Mer Wiki
< Adaptations(Difference between revisions)
Jump to: navigation, search
(Automatic boot)
(Build the kernel)
Line 129: Line 129:
 
  export LOCALVERSION=-nemo
 
  export LOCALVERSION=-nemo
 
  make clean
 
  make clean
  make olddefconfig
+
  make oldconfig
 
  make Image modules dtbs
 
  make Image modules dtbs
  

Revision as of 14:34, 22 August 2019

Contents

Hardware Support

Full information of hardware spec Here

PineTab

In pinetab we have jack to uart port cable. For enable UART console move selector nearby sd-card slot away from sd-card slot.

Testing the vibrator motor

You need to have the CONFIG_GPIO_SYSFS enabled in your kernel config for this!

Vibrator motor is on pin PD2. You can calculate the PIN number for PD2 as followed (more information): (4-1) * 32 + 2 = 98

echo "98" > /sys/class/gpio/export # Make pin available
echo "out" > /sys/class/gpio/gpio98/direction # Set as output
echo "1" > /sys/class/gpio/gpio98/value # On
echo "1" > /sys/class/gpio/gpio98/value # Off
echo "98" > /sys/class/gpio/unexport # When you're done

Installation

Prepare SD card

Use GParted or any other tool to create the following EXT4 partitions:

  1. boot: Holds the mainline kernel Image and Device Tree files
  2. data: Holds the Sailfish OS rootFS

GParted will ask you to leave the first MB free of the SD card when creating the first partition, this is correct. This 1 MB will be used to store the U-boot boot loader.

U-Boot

We will now build the mainline U-boot boot loader from Git.

Clone U-boot (master branch):

You can find the U-boot mirror repository on Github:

git clone github.com/u-boot/u-boot

Compile U-boot

You have to cross compile U-boot with the arm64 arch:

export CROSS_COMPILE=aarch64-linux-gnu-
ARCH=arm64 make clean
ARCH=arm64 make sopine_baseboard_defconfig
ARCH=arm64 make

The sopine_baseboard_defconfig is the same for the Don't Be Evil devkit.

Burn U-boot to your SD card

Copy the compiled U-boot bootloader to the first sector on your SD card:

sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=8k seek=1


Manually loading the kernel

Serial TTY Baudrate over UART = 115200 for screen, example: screen /dev/ttyUSB0 115200 You have to start screen first, before turning on the devkit.

Interrupt the U-boot autoboot process when you see a message in the U-boot prompt. We need to access the U-boot prompt to load the Kernel image and boot it manually!

Set bootargs:

 setenv bootargs root=/dev/mmcblk0p2 rootwait panic=10

Kernel Image loading and Device Tree files:

ext4load mmc 0:1 ${kernel_addr_r} /Image 
ext4load mmc 0:1 ${fdt_addr_r} /sun50i-a64-dontbeevil.dtb 

Boot the kernel:

booti ${kernel_addr_r} - ${fdt_addr_r}

Automatic boot

Create a boot.cmd file:

echo Setting bootargs
setenv bootargs console=tty0 console=ttyS0,115200 root=/dev/mmcblk0p2 no_console_suspend rootwait 
earlycon=uart,mmio32,0x01c28000 panic=10 consoleblank=0 loglevel=1
printenv
echo Loading DTB
load mmc 0:1 ${fdt_addr_r} /sun50i-a64-dontbeevil.dtb
echo Loading kernel Image
load mmc 0:1 ${kernel_addr_r} /Image
echo Booting kernel NOW
booti ${kernel_addr_r} - ${fdt_addr_r}

Mount your boot partition and run the following command:

sudo mkimage -C none -A arm -T script -d /mnt/boot.cmd /mnt/boot.scr

This will translate the boot.cmd file into a U-boot script.

If you don't have the mkimage command available, you can install it from the uboot-tools package.

Kernel

The PinePhone runs a mainline kernel, device tree modifications are done by all the PinePhone OS developers on Gitlab (https://gitlab.com/pine64-org/linux).

Clone the kernel

git clone https://gitlab.com/pine64-org/linux
cd linux
git checkout pinephone-dontbeevil

Configure the kernel

  1. Copy our kernel config: https://gitlab.com/pinephone-sailfish-os/linux-kernel/raw/master/pinephone-config
  2. Enter the linux project: cd linux
  3. Copy the config file to .config in the main directory

Build the kernel

We cross compile the kernel for ARM64. The LOCALVERSION variable can be used to add a version to the build.

Cross compile the kernel:

export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
export LOCALVERSION=-nemo
make clean
make oldconfig
make Image modules dtbs

Install the kernel modules in a different path:

make modules_install INSTALL_MOD_PATH=../linux_modules/

Install kernel

Copy the following things:

  1. Image from arch/arm64/boot/Image to the root of the boot partition.
  2. Device tree files

For pinethone arch/arm64/boot/dts/allwinner/sun50i-a64-dontbeevil.dtb and arch/arm64/boot/dts/allwinner/sun50i-a64-dontbeevil.dts to the root of the boot partition.

For pinetab arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dtb and arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts to the root of the boot partition.

  1. Modules from ../linux_modules to /lib/modules on the boot partition.

Wlan Module

On PinePhone we have mainline kernel driver. But in PineTab we must use https://github.com/Icenowy/rtl8723cs driver.

Nemo Mobile

For build last release of nemo use this ks file https://gist.github.com/neochapay/8d40f9ee1e5fd621e0053aa126d39e81

Sailfish OS

Flash rootFS

You can download the latest rootFS from the Gitlab SailfishOS Porters CI: https://gitlab.com/sailfishos-porters-ci/dont_be_evil-ci (see the artifacts of the latest CI job).

This tar.gz archive should be burned to the data partition of the SD card. It's important to burn it as the root user (not with sudo) to preserve extended attributes and ACLs:

sudo su
bsdtar -xpf <SAILFISH OS ROOTFS>.tar.bz2 -C <MOUNTPOINT OF /DATA>

Device repos

To boot Lipstick, you need to add the device specific repos to the devkit. All the following commands are executed in a shell on the devkit.

Make sure you configure the ethernet interface first before you continue! You need to have access to the WWW to fetch the necessary repository data and packages.

Install zypper manually:

 curl -o augeas-lib.rpm http://repo.merproject.org/obs/mer:/core/latest_armv7hl/armv7hl/augeas-libs-1.6.0+git1-1.10.6.armv7hl.rpm
 curl -o zypper.rpm http://repo.merproject.org/obs/mer:/core/latest_armv7hl/armv7hl/zypper-1.14.6+git3-1.24.5.armv7hl.rpm
 rpm -Uvh *rpm

Use ssu to add the repo

 ssu ar common http://repo.merproject.org/obs/nemo:/devel:/hw:/common/sailfish_latest_armv7hl/
 ssu ar dontbeevil http://repo.merproject.org/obs/home:/piggz:/dontbeevil/sailfishos_3.0.3.9_latest_armv7hl/
 ssu ar jolla https://releases.jolla.com/releases/3.0.3.9/jolla/armv7hl/

Refresh the repo:

 zypper refresh

Install the device packages:

 zypper install dontbeevil:qt5-qtcore dontbeevil:qt5-qttest dontbeevil:lipstick-qt5
 zypper install droid-config-dontbeevil # Select 1 for vendor change
 zypper install droid-config-dontbeevil-sailfish
 zypper install qt5-plugin-platform-eglfs # EGLFS LIMA plugin
 zypper install qt5-plugin-generic-evdev # evdev input plugins

Other useful packages

 zypper install mce-tools #useful for mcetool (mcetool -U activates the screen)

Unknown password

The Sailfish OS rootFS sets a random password when booting for the first time. You can only log in through the telnet debug interface. Since the eth0 interface still requires manually setup, you can't access telnet.

To circumvent this issue, you can login through the UART TTY interface. However you don't know the password of the root nor nemo users! To disable the root and nemo passwords, we can modify the /etc/shadow file:

sudo chmod +w <SD card data partition>/etc/shadow
sudo vim <SD card data partition>/etc/shadow # Remove any characters where <HASHED PASSWORD> is written: user1:<HASHED PASSWORD>:16092:0:99999:7:::.
sudo chmod -w <SD card data partition>/etc/shadow

By removing the hashed password, we can login with the user without entering a password. You can set a new password afterwards by running as a logged in user:

passwd

Init eth0

Enabling the eth0 interface has to be done manually for now:

ifconfig eth0 <YOUR_IP>
route add default gw <DEFAULT_GATEWAY_IP>
echo "nameserver <DNS_SERVER_IP>" > /etc/resolv.conf

Test your configuration with ping:

ping jolla.com


Lipstick crashing

Install Lipstick from the dontbeevil repository:

 zypper install dontbeevil:lipstick-qt5

No setup wizard

Make sure the configuration package is installed:

 zypper install droid-config-dontbeevil-sailfish

Missing regulatory.db for RT8723BS WiFi/BT module

 git clone git://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git
 cd wireless-regdb
 cp regulatory* /lib/firmware
Personal tools