The Mer Wiki now uses your Mer user account and password (create account on https://bugs.merproject.org/)
Adaptations/PinePhone64
(→U-Boot) |
Dylanvanassc (Talk | contribs) (→Installation) |
||
Line 1: | Line 1: | ||
=Hardware Support= | =Hardware Support= | ||
− | = | + | =Installation= |
− | == | + | ==Prepare SD card== |
+ | |||
+ | Use GParted or any other tool to create the following <code>EXT4</code> partitions: | ||
+ | |||
+ | # <b>boot</b>: Holds the mainline kernel Image and Device Tree files | ||
+ | # <b>data</b>: 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== | ==U-Boot== | ||
− | === Clone | + | 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 | git clone github.com/u-boot/u-boot | ||
− | === Compile | + | === Compile U-boot === |
+ | |||
+ | You have to cross compile U-boot with the <code>arm64</code> arch: | ||
export CROSS_COMPILE=aarch64-linux-gnu- | export CROSS_COMPILE=aarch64-linux-gnu- | ||
Line 15: | Line 31: | ||
ARCH=arm64 make | ARCH=arm64 make | ||
− | + | The <code>sopine_baseboard_defconfig</code> is the same for the Don't Be Evil devkit. | |
− | Copy to first sector on SD card: | + | === 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 | sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=8k seek=1 | ||
− | |||
− | === | + | === Manually loading the kernel === |
− | Serial TTY Baudrate UART = 115200 for screen, example: screen /dev/ttyUSB0 115200 | + | Serial TTY Baudrate over UART = 115200 for screen, example: <code>screen /dev/ttyUSB0 115200</code> |
− | You have to start screen first, before turning on the | + | You have to start screen first, before turning on the devkit. |
− | Interrupt the U-boot autoboot process when you see | + | |
− | Kernel loading | + | 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! | ||
+ | |||
+ | Kernel Image loading and Device Tree files: | ||
ext4load mmc 0:1 ${kernel_addr_r} <IMAGE NAME> should be /Image | ext4load mmc 0:1 ${kernel_addr_r} <IMAGE NAME> should be /Image | ||
ext4load mmc 0:1 ${fdt_addr_r} /sun50i-a64-sopine-baseboard.dtb | ext4load mmc 0:1 ${fdt_addr_r} /sun50i-a64-sopine-baseboard.dtb | ||
− | Boot kernel | + | Boot the kernel: |
booti ${kernel_addr_r} - ${fdt_addr_r} | booti ${kernel_addr_r} - ${fdt_addr_r} | ||
Line 39: | Line 59: | ||
=== Automatic boot === | === Automatic boot === | ||
− | Create boot.cmd | + | Create a <code>boot.cmd</code> file: |
echo Setting bootargs | echo Setting bootargs | ||
Line 52: | Line 72: | ||
booti ${kernel_addr_r} - ${fdt_addr_r} | booti ${kernel_addr_r} - ${fdt_addr_r} | ||
− | Mount | + | Mount your <code>boot</code> partition and run the following command: |
sudo mkimage -C none -A arm -T script -d /mnt/boot.cmd /mnt/boot.scr | sudo mkimage -C none -A arm -T script -d /mnt/boot.cmd /mnt/boot.scr | ||
+ | |||
+ | This will translate the <code>boot.cmd</code> file into a U-boot script. | ||
==Kernel== | ==Kernel== | ||
− | === Clone 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 | git clone https://gitlab.com/pine64-org/linux | ||
Line 63: | Line 87: | ||
git checkout pinephone-dontbeevil | git checkout pinephone-dontbeevil | ||
− | === Configure kernel === | + | === Configure the kernel === |
− | + | # <b>Copy our kernel config</b>: https://gitlab.com/pinephone-sailfish-os/linux-kernel/raw/master/pinephone-config | |
+ | # <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 | ||
− | === Build kernel === | + | === Build the kernel === |
+ | We cross compile the kernel for ARM64. | ||
+ | The <code>LOCALVERSION</code> variable can be used to add a version to the build. | ||
+ | |||
+ | Cross compile the kernel: | ||
export ARCH=arm64 | export ARCH=arm64 | ||
export CROSS_COMPILE=aarch64-linux-gnu- | export CROSS_COMPILE=aarch64-linux-gnu- | ||
Line 75: | Line 105: | ||
make oldconfig | make oldconfig | ||
make Image modules dtbs | make Image modules dtbs | ||
+ | |||
+ | Install the kernel modules in a different path: | ||
+ | make modules_install INSTALL_MOD_PATH=../linux_modules/ | ||
=== Install kernel === | === Install kernel === | ||
− | |||
− | |||
− | + | Copy the following things: | |
− | + | ||
+ | # <b>Image</b> from <code>arch/arm64/boot/Image</code> to the root of the <code>boot</code> partition. | ||
+ | # <b>Device tree files</b> from <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. | ||
+ | # <b>Modules</b> from <code>../linux_modules</code> to <code>/lib/modules</code> on the <code>boot</code> partition. | ||
==Nemo Mobile== | ==Nemo Mobile== | ||
+ | |||
==Sailfish OS== | ==Sailfish OS== | ||
+ | |||
+ | The Sailfish OS rootFS sets a random password when booting for the first time. | ||
+ | You can only log in through the <code>telnet</code> debug interface. | ||
+ | Since the <code>eth0</code> interface still requires manually setup, you can access <code>telnet</code>. | ||
+ | |||
+ | To circumvent this issue, you can login through the UART TTY interface. | ||
+ | However you don't know the password of the <code>root</code> nor <code>nemo</code> users! | ||
+ | To disable the <code>root</code> and <code>nemo</code> passwords, we can modify the <code>/etc/shadow</code> 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 |
Revision as of 09:34, 9 May 2019
Contents |
Hardware Support
Installation
Prepare SD card
Use GParted or any other tool to create the following EXT4
partitions:
- boot: Holds the mainline kernel Image and Device Tree files
- 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!
Kernel Image loading and Device Tree files:
ext4load mmc 0:1 ${kernel_addr_r} <IMAGE NAME> should be /Image ext4load mmc 0:1 ${fdt_addr_r} /sun50i-a64-sopine-baseboard.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.
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
- Copy our kernel config: https://gitlab.com/pinephone-sailfish-os/linux-kernel/raw/master/pinephone-config
- Enter the
linux
project:cd linux
- 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:
- Image from
arch/arm64/boot/Image
to the root of theboot
partition. - Device tree files from
arch/arm64/boot/dts/allwinner/sun50i-a64-dontbeevil.dtb
andarch/arm64/boot/dts/allwinner/sun50i-a64-dontbeevil.dts
to the root of theboot
partition. - Modules from
../linux_modules
to/lib/modules
on theboot
partition.
Nemo Mobile
Sailfish OS
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 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