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
(Audio)
(Setup)
 
(32 intermediate revisions by 3 users not shown)
Line 4: Line 4:
  
 
PostMarket OS hardware information [https://wiki.postmarketos.org/wiki/Pine_Don%27t_be_evil_devkit_(pine-dontbeevil) PostMarketOS Wiki]
 
PostMarket OS hardware information [https://wiki.postmarketos.org/wiki/Pine_Don%27t_be_evil_devkit_(pine-dontbeevil) PostMarketOS Wiki]
 +
 +
==WiFi/BT RTL8723CS==
 +
 +
=== WiFi ===
 +
The WiFi driver isn't available in the Linux kernel yet. However, we can compile it as an out-of-tree driver for now.
 +
See kernel building for more instruction
 +
 +
=== Bluetooth ===
 +
The production version of the PineTab and PinePhone are both using the Realtek 8723CS WiFi/BT module.
 +
BT is natively supported after adding the necessary firmware from [https://github.com/anarsoul/rtl8723bt-firmware/tree/master/rtl_bt https://github.com/anarsoul/rtl8723bt-firmware/tree/master/rtl_bt]
 +
Download all the <code>*.bin</code> files and copy them to the <code>/lib/firmware/rtl_bt</code> directory in the rootFS.
  
 
==Modem EC25==
 
==Modem EC25==
Line 16: Line 27:
 
   systemctl restart ofono
 
   systemctl restart ofono
  
4. Check if the QMI modem is properly detected:
+
4. Install ofono-tests
 +
  zypper in ofono-tests
 +
 
 +
5. Check if the QMI modem is properly detected:
 
   /usr/lib/ofono/test/list-modems
 
   /usr/lib/ofono/test/list-modems
  
5. Unlock you SIM card (if needed):
+
6. Unlock you SIM card (if needed):
 
   /usr/lib/ofono/test/enter-pin /quectelqmi_0 pin <PIN CODE>
 
   /usr/lib/ofono/test/enter-pin /quectelqmi_0 pin <PIN CODE>
  
Line 56: Line 70:
 
== Audio ==
 
== Audio ==
  
1. Unmuting the <code>AIF1 Slot 0 Digital DAC</code> channel using <code>alsamixer</code>. Use <code>m</code> to unmute.
+
1. Unmute the <code>AIF1 Slot 0 Digital DAC</code> channel using <code>alsamixer</code>. Use <code>m</code> to unmute.
 +
 
 +
2. Same for <code>Line Out</code> and increase the volume to 100 (default is 0).
  
 
2. Copy the default PulseAudio config:  
 
2. Copy the default PulseAudio config:  
Line 64: Line 80:
 
   load-module module-alsa-sink
 
   load-module module-alsa-sink
 
   load-module module-alsa-source device=hw:1,0
 
   load-module module-alsa-source device=hw:1,0
They are commented out by default
+
They are commented out by default.
  
4. Configure PulseAudio by changing <code>arm_droid_config.pa</code> to <code>/arm_native_config.pa</code> in <code>/etc/sysconfig/pulseaudio</code>
+
4. Configure PulseAudio by changing <code>arm_droid_config.pa</code> to <code>/arm_native_config.pa</code> in <code>/etc/sysconfig/pulseaudio</code>.
  
5. Restart PulseAudio or reboot
+
5. Restart PulseAudio or reboot.
  
 
6. Go to the Settings app and test the sound output by playing a ringtone under Sounds and Feedback.
 
6. Go to the Settings app and test the sound output by playing a ringtone under Sounds and Feedback.
 +
 +
== Video ==
 +
WIP GStreamer support. Doesn't start the sink properly yet.
 +
 +
Pine devices should support hardware video codecs using https://github.com/bootlin/libva-v4l2-request
 +
 +
Install gstreamer1.0-vaapi. libva and libva-v4l2-request from the hwcommon repository
 +
 +
Pipeline to try to play an MPEG-2 video, which is most mature codec in v4l2-request so far:
 +
 +
GST_DEBUG=4 gst-launch-1.0 filesrc location=~/lion-sample.mov ! qtdemux ! h264parse ! vaapidecodebin ! vaapisink
 +
 +
You need to export some env variables:
 +
 +
LIBVA_V4L2_REQUEST_VIDEO_PATH=/dev/videoX
 +
LIBVA_DRIVER_NAME=v4l2_request
 +
GST_VAAPI_ALL_DRIVERS=1
 +
 +
then remove .cache/gstreamer1.0/.cache/gstreamer-1.0/registry.armv7l.bin
 +
 +
run gst-inspect-1.0 vaapi to see the detected elements.
  
 
==PineTab==
 
==PineTab==
Line 99: Line 136:
  
 
The LED can be controlled in Mer by MCE. You need the <code>mce-plugin-libhybris-nondroid</code> for this.
 
The LED can be controlled in Mer by MCE. You need the <code>mce-plugin-libhybris-nondroid</code> for this.
 +
 +
In the latest kernel, the control paths of the LED aren't the default ones that the MCE is expecting.
 +
This requires a config file to enable MCE to control the LED on the PinePhone devphone:
 +
 +
  [LEDConfigHybris]
 +
 
 +
  # Choose Vanilla backend
 +
  BackEnd=vanilla
 +
 
 +
  # Configure base directories for red/green/blue channels
 +
  RedDirectory=/sys/class/leds/pinephone:red:user
 +
  GreenDirectory=/sys/class/leds/pinephone:green:user
 +
  BlueDirectory=/sys/class/leds/pinephone:blue:user
 +
 +
This config file must be saved in the following file: <code>/etc/mce/99-pinephone.ini</code>
  
 
=Installation=
 
=Installation=
Line 110: Line 162:
 
GParted will ask you to leave the first MB free of the SD card when creating the first partition, this is correct.
 
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.
 
This 1 MB will be used to store the U-boot boot loader.
 +
 +
<b>Note</b>: Make sure you have a <code>msdos</code> partition table! If not, the U-boot flashing will make partition table unusable (in case of GPT for example)!
  
 
==U-Boot==
 
==U-Boot==
  
 
We will now build the mainline U-boot boot loader from Git.
 
We will now build the mainline U-boot boot loader from Git.
 +
 +
=== Clone ARM Trusted Firmware (master branch) ===
 +
 +
git clone https://github.com/ARM-software/arm-trusted-firmware.git
 +
 +
=== Build the BL31.bin ===
 +
 +
Follow the instructions here: https://github.com/u-boot/u-boot/blob/master/board/sunxi/README.sunxi64
 +
 +
Quick start:
 +
 
 +
  export CROSS_COMPILE=aarch64-linux-gnu-
 +
  ARCH=arm64 make PLAT=sun50i_a64 DEBUG=1 bl31
 +
  export BL31=/path/to/bl31.bin # Probably: ~/arm-trusted-firmware/build/sun50i_a64/debug/bl31.bin
  
 
=== Clone U-boot (master branch): ===
 
=== Clone U-boot (master branch): ===
Line 119: Line 187:
 
You can find the U-boot mirror repository on Github:
 
You can find the U-boot mirror repository on Github:
  
  git clone github.com/u-boot/u-boot
+
  git clone https://github.com/u-boot/u-boot.git
  
 
=== Compile U-boot ===
 
=== Compile U-boot ===
Line 127: Line 195:
 
  export CROSS_COMPILE=aarch64-linux-gnu-
 
  export CROSS_COMPILE=aarch64-linux-gnu-
 
  ARCH=arm64 make clean
 
  ARCH=arm64 make clean
  ARCH=arm64 make sopine_baseboard_defconfig
+
  ARCH=arm64 make sopine_baseboard_defconfig # U-boot upstream, use pinephone_defconfig when using pine64-org's U-boot with enhanced PinePhone support
 
  ARCH=arm64 make
 
  ARCH=arm64 make
  
Line 154: Line 222:
  
 
  ext4load mmc 0:1 ${kernel_addr_r} /Image  
 
  ext4load mmc 0:1 ${kernel_addr_r} /Image  
  ext4load mmc 0:1 ${fdt_addr_r} /sun50i-a64-dontbeevil.dtb  
+
  ext4load mmc 0:1 ${fdt_addr_r} /sun50i-a64-pinephone.dtb  
  
 
Boot the kernel:
 
Boot the kernel:
Line 162: Line 230:
 
=== Automatic boot ===
 
=== Automatic boot ===
  
Create a <code>boot.cmd</code> file:
+
Create a <code>boot.cmd</code> file for the '''PinePhone''':
  
 
  echo Setting bootargs
 
  echo Setting bootargs
  setenv bootargs console=tty0 console=ttyS0,115200 root=/dev/mmcblk0p2 no_console_suspend rootwait  
+
  setenv bootargs console=tty0 console=ttyS0,115200 root=/dev/mmcblk0p2 no_console_suspend rootwait quiet
  earlycon=uart,mmio32,0x01c28000 panic=10 consoleblank=0 loglevel=1
+
  earlycon=uart,mmio32,0x01c28000 panic=10 consoleblank=0 loglevel=0
 
  printenv
 
  printenv
 
  echo Loading DTB
 
  echo Loading DTB
  load mmc 0:1 ${fdt_addr_r} /sun50i-a64-dontbeevil.dtb
+
  load mmc 0:1 ${fdt_addr_r} /sun50i-a64-pinephone.dtb
 +
echo Loading kernel Image
 +
load mmc 0:1 ${kernel_addr_r} /Image
 +
echo Booting kernel NOW
 +
booti ${kernel_addr_r} - ${fdt_addr_r}
 +
 
 +
Create a <code>boot.cmd</code> file for the '''PineTab''':
 +
 
 +
echo Setting bootargs
 +
setenv bootargs console=tty0 console=ttyS0,115200 root=/dev/mmcblk0p2 no_console_suspend rootwait quiet
 +
earlycon=uart,mmio32,0x01c28000 panic=10 consoleblank=0 loglevel=0
 +
printenv
 +
echo Loading DTB
 +
load mmc 0:1 ${fdt_addr_r} /sun50i-a64-pinetab.dtb
 
  echo Loading kernel Image
 
  echo Loading kernel Image
 
  load mmc 0:1 ${kernel_addr_r} /Image
 
  load mmc 0:1 ${kernel_addr_r} /Image
Line 190: Line 271:
 
  git clone https://gitlab.com/pine64-org/linux
 
  git clone https://gitlab.com/pine64-org/linux
 
  cd linux
 
  cd linux
  git checkout pinephone-dontbeevil
+
  git checkout pine64-kernel
  
 
=== Configure the kernel ===
 
=== Configure the kernel ===
Line 197: Line 278:
 
# <b>Enter the <code>linux</code> project</b>: <code>cd linux</code>
 
# <b>Enter the <code>linux</code> project</b>: <code>cd linux</code>
 
# <b>Copy the config file</b> to <code>.config</code> in the main directory
 
# <b>Copy the config file</b> to <code>.config</code> in the main directory
 +
 +
=== Enable WiFi out-of-tree driver ===
 +
 +
Add the driver to the kernel:
 +
  cd drivers/staging
 +
  git clone https://github.com/Icenowy/rtl8723cs.git
 +
 +
Configure the kernel build system now:
 +
 +
# <b>Add this line to <code>drivers/staging/Kconfig</code></b>: <code>source "drivers/staging/rtl8723cs/Kconfig"</code>
 +
# <b>Add this line to <code>drivers/staging/Makefile</code></b>: <code>obj-$(CONFIG_RTL8723CS) += rtl8723cs/</code>
 +
# <b>Enable the driver in the kernel config:</b> <code>CONFIG_RTL8723CS=m</code>
 +
 +
See: [https://gitlab.com/postmarketOS/pmaports/blob/master/main/linux-postmarketos-allwinner/rtl8723cs.patch https://gitlab.com/postmarketOS/pmaports/blob/master/main/linux-postmarketos-allwinner/rtl8723cs.patch]
  
 
=== Build the kernel ===
 
=== Build the kernel ===
Line 208: Line 303:
 
  export LOCALVERSION=-nemo
 
  export LOCALVERSION=-nemo
 
  make clean
 
  make clean
  make oldconfig
+
  make defconfig KBUILD_DEFCONFIG=config-sailfishos-allwinner.aarch64
  make Image modules dtbs
+
  make -j4 Image modules dtbs
  
 
Install the kernel modules in a different path:  
 
Install the kernel modules in a different path:  
Line 220: Line 315:
 
# <b>Image</b> from <code>arch/arm64/boot/Image</code> to the root of the <code>boot</code> partition.
 
# <b>Image</b> from <code>arch/arm64/boot/Image</code> to the root of the <code>boot</code> partition.
 
# <b>Device tree files</b>  
 
# <b>Device tree files</b>  
For pinethone <code>arch/arm64/boot/dts/allwinner/sun50i-a64-dontbeevil.dtb</code> and <code>arch/arm64/boot/dts/allwinner/sun50i-a64-dontbeevil.dts</code> to the root of the <code>boot</code> partition.
+
For pinethone <code>arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtb</code> and <code>arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dts</code> to the root of the <code>boot</code> partition.
  
 
For pinetab <code>arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dtb</code> and <code>arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts</code> to the root of the <code>boot</code> partition.
 
For pinetab <code>arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dtb</code> and <code>arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts</code> to the root of the <code>boot</code> partition.
# <b>Modules</b> from <code>../linux_modules</code> to <code>/lib/modules</code> on the <code>boot</code> partition.
+
# <b>Modules</b> from <code>../linux_modules</code> to <code>/lib/modules</code> on the <code>data</code> partition.
  
=== Wlan Module ===
+
==Nemo Mobile==
  
On PinePhone we have mainline kernel driver. But in PineTab we must use https://github.com/Icenowy/rtl8723cs driver.
+
Nemo Mobile have same MW with SFOS but use gcc8 have aarch64 support and use newset version of packages.
  
==Nemo Mobile==
+
git of device config: https://github.com/neochapay/nemo-device-dont_be_evil
  
 
For build last release of nemo use this ks file https://gist.github.com/neochapay/8d40f9ee1e5fd621e0053aa126d39e81
 
For build last release of nemo use this ks file https://gist.github.com/neochapay/8d40f9ee1e5fd621e0053aa126d39e81
Line 315: Line 410:
  
 
   zypper install dontbeevil:lipstick-qt5
 
   zypper install dontbeevil:lipstick-qt5
 +
 +
As from 3.1.0.12, this fix is obsolete.
  
 
===No setup wizard===
 
===No setup wizard===

Latest revision as of 10:17, 28 October 2020

Contents

[edit] Hardware Support

Full information of hardware spec Here

PostMarket OS hardware information PostMarketOS Wiki

[edit] WiFi/BT RTL8723CS

[edit] WiFi

The WiFi driver isn't available in the Linux kernel yet. However, we can compile it as an out-of-tree driver for now. See kernel building for more instruction

[edit] Bluetooth

The production version of the PineTab and PinePhone are both using the Realtek 8723CS WiFi/BT module. BT is natively supported after adding the necessary firmware from https://github.com/anarsoul/rtl8723bt-firmware/tree/master/rtl_bt Download all the *.bin files and copy them to the /lib/firmware/rtl_bt directory in the rootFS.

[edit] Modem EC25

[edit] Setup

1. Make sure that the qmimodem plugin is enabled in the .spec of ofono.

2. Remove the noplugin.conf file under /lib/environment/ofono/noplugin.conf.

3. Restart ofono

 systemctl restart ofono

4. Install ofono-tests

 zypper in ofono-tests

5. Check if the QMI modem is properly detected:

 /usr/lib/ofono/test/list-modems

6. Unlock you SIM card (if needed):

 /usr/lib/ofono/test/enter-pin /quectelqmi_0 pin <PIN CODE>

The EC25 Quectel modem is now ready :) Thanks to SuperPrower for the hard work!

[edit] Sending SMS

 /usr/lib/ofono/test/send-sms <PHONE NUMBER RECEIVER> <MESSAGE> <DELIVERY REPORT>

To skip the delivery report, use 0 as argument.

[edit] Cameras

Thanks to: https://wiki.postmarketos.org/wiki/Pine_Don't_be_evil_devkit_(pine-dontbeevil)#Cameras Only the back camera is supported by the mainline kernel. To use it, you need to configure it first:

 media-ctl --set-v4l2 '"ov5640 2-003c":0[fmt:UYVY8_2X8/1280x7200]' -d /dev/media1

Afterwards, you can take a picture with:

 ffmpeg -s 1280x720 -f video4linux2 -i /dev/video1 -vframes 1 selfie.jpg

- /dev/media1 is the controller interface of the back camera

- /dev/video1 is the back camera stream interface

If that works, you can try gstreamer to make the camera available for system wide usage:]

 gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1 ! 'video/x-raw,format=UYVY,width=1280,height=720' ! jpegenc ! filesink location=selfie.jpg
 cp selfie.jpg /home/nemo/Pictures

This command generates a selfie.jpg file and by copying it to /home/nemo/Pictures you can view it with the Gallery app.

[edit] Audio

1. Unmute the AIF1 Slot 0 Digital DAC channel using alsamixer. Use m to unmute.

2. Same for Line Out and increase the volume to 100 (default is 0).

2. Copy the default PulseAudio config:

 cp /etc/pulse/default.pa /etc/pulse/arm_native_config.pa

3. Enable ALSA modules in the new config:

 load-module module-alsa-sink
 load-module module-alsa-source device=hw:1,0

They are commented out by default.

4. Configure PulseAudio by changing arm_droid_config.pa to /arm_native_config.pa in /etc/sysconfig/pulseaudio.

5. Restart PulseAudio or reboot.

6. Go to the Settings app and test the sound output by playing a ringtone under Sounds and Feedback.

[edit] Video

WIP GStreamer support. Doesn't start the sink properly yet.

Pine devices should support hardware video codecs using https://github.com/bootlin/libva-v4l2-request

Install gstreamer1.0-vaapi. libva and libva-v4l2-request from the hwcommon repository

Pipeline to try to play an MPEG-2 video, which is most mature codec in v4l2-request so far:

GST_DEBUG=4 gst-launch-1.0 filesrc location=~/lion-sample.mov ! qtdemux ! h264parse ! vaapidecodebin ! vaapisink

You need to export some env variables:

LIBVA_V4L2_REQUEST_VIDEO_PATH=/dev/videoX
LIBVA_DRIVER_NAME=v4l2_request
GST_VAAPI_ALL_DRIVERS=1

then remove .cache/gstreamer1.0/.cache/gstreamer-1.0/registry.armv7l.bin

run gst-inspect-1.0 vaapi to see the detected elements.

[edit] 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.

[edit] 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

[edit] Notification LED

 export COLOR=red # or green, blue is broken due to a hardware fault
 # Activate LED
 echo 1 > /sys/class/leds/$COLOR/brightness
 # Deactivate LED
 echo 0 > /sys/class/leds/$COLOR/brightness

The LED can be controlled in Mer by MCE. You need the mce-plugin-libhybris-nondroid for this.

In the latest kernel, the control paths of the LED aren't the default ones that the MCE is expecting. This requires a config file to enable MCE to control the LED on the PinePhone devphone:

 [LEDConfigHybris]
 
 # Choose Vanilla backend
 BackEnd=vanilla
 
 # Configure base directories for red/green/blue channels
 RedDirectory=/sys/class/leds/pinephone:red:user
 GreenDirectory=/sys/class/leds/pinephone:green:user
 BlueDirectory=/sys/class/leds/pinephone:blue:user

This config file must be saved in the following file: /etc/mce/99-pinephone.ini

[edit] Installation

[edit] 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.

Note: Make sure you have a msdos partition table! If not, the U-boot flashing will make partition table unusable (in case of GPT for example)!

[edit] U-Boot

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

[edit] Clone ARM Trusted Firmware (master branch)

git clone https://github.com/ARM-software/arm-trusted-firmware.git

[edit] Build the BL31.bin

Follow the instructions here: https://github.com/u-boot/u-boot/blob/master/board/sunxi/README.sunxi64

Quick start:

 export CROSS_COMPILE=aarch64-linux-gnu-
 ARCH=arm64 make PLAT=sun50i_a64 DEBUG=1 bl31
 export BL31=/path/to/bl31.bin # Probably: ~/arm-trusted-firmware/build/sun50i_a64/debug/bl31.bin

[edit] Clone U-boot (master branch):

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

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

[edit] 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 # U-boot upstream, use pinephone_defconfig when using pine64-org's U-boot with enhanced PinePhone support
ARCH=arm64 make

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

[edit] 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


[edit] 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-pinephone.dtb 

Boot the kernel:

booti ${kernel_addr_r} - ${fdt_addr_r}

[edit] Automatic boot

Create a boot.cmd file for the PinePhone:

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

Create a boot.cmd file for the PineTab:

echo Setting bootargs
setenv bootargs console=tty0 console=ttyS0,115200 root=/dev/mmcblk0p2 no_console_suspend rootwait quiet
earlycon=uart,mmio32,0x01c28000 panic=10 consoleblank=0 loglevel=0
printenv
echo Loading DTB
load mmc 0:1 ${fdt_addr_r} /sun50i-a64-pinetab.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.

[edit] 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).

[edit] Clone the kernel

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

[edit] 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

[edit] Enable WiFi out-of-tree driver

Add the driver to the kernel:

 cd drivers/staging
 git clone https://github.com/Icenowy/rtl8723cs.git

Configure the kernel build system now:

  1. Add this line to drivers/staging/Kconfig: source "drivers/staging/rtl8723cs/Kconfig"
  2. Add this line to drivers/staging/Makefile: obj-$(CONFIG_RTL8723CS) += rtl8723cs/
  3. Enable the driver in the kernel config: CONFIG_RTL8723CS=m

See: https://gitlab.com/postmarketOS/pmaports/blob/master/main/linux-postmarketos-allwinner/rtl8723cs.patch

[edit] 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 defconfig KBUILD_DEFCONFIG=config-sailfishos-allwinner.aarch64
make -j4 Image modules dtbs

Install the kernel modules in a different path:

make modules_install INSTALL_MOD_PATH=../linux_modules/

[edit] 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-pinephone.dtb and arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.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 data partition.

[edit] Nemo Mobile

Nemo Mobile have same MW with SFOS but use gcc8 have aarch64 support and use newset version of packages.

git of device config: https://github.com/neochapay/nemo-device-dont_be_evil

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

[edit] Sailfish OS

[edit] Github & OBS project

- https://github.com/sailfish-on-dontbeevil

- https://build.merproject.org/project/show/nemo:devel:hw:pine:dontbeevil

[edit] 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>

[edit] 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)

[edit] 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

[edit] 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


[edit] Lipstick crashing

Install Lipstick from the dontbeevil repository:

 zypper install dontbeevil:lipstick-qt5

As from 3.1.0.12, this fix is obsolete.

[edit] No setup wizard

Make sure the configuration package is installed:

 zypper install droid-config-dontbeevil-sailfish

[edit] 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