Difference between revisions of "PinePhone Pro/Create a multi-distribution image using rk2aw"
(Add example to setup eMMC with multi-distro, consistently use rk2aw as per megi & multi-distro) |
|||
Line 1: | Line 1: | ||
= Flash | = How to flash rk2aw and setup multi-distro disks on PinePhonePro = | ||
== Flash rk2aw BootLoader to SPI & multi-distro SDcard == | |||
''References: https://xff.cz/kernels/rk2aw/rk2aw-rk3399-pinephone-pro/INSTALL and https://xnux.eu/rk2aw | ''References: https://xff.cz/kernels/rk2aw/rk2aw-rk3399-pinephone-pro/INSTALL and https://xnux.eu/rk2aw/'' | ||
''Requirements: SSH connection from linux machine to PinePhonePro, internet connection.'' | ''Requirements: SSH connection from linux machine to PinePhonePro, internet connection.'' | ||
''Preloader and userspace utility to flash it are non-free.'' | ''Note: Preloader and userspace utility to flash it are non-free.'' | ||
''Thanks: Megi at https://xnux.eu/log/ '' | |||
== Download and Run | === Download and Run rk2aw SPI Flasher === | ||
# ''Connect PinePhonePro to linux machine and start a ssh connection'' | # ''Connect PinePhonePro to linux machine and start a ssh connection'' | ||
# <code>ssh <user>@<phoneip></code> ''# set a connection'' | # <code>ssh <user>@<phoneip></code> ''# set a connection'' | ||
Line 17: | Line 19: | ||
# <code>sudo ./spinor-flash-initial-setup.sh</code> ''# flash SPI'' | # <code>sudo ./spinor-flash-initial-setup.sh</code> ''# flash SPI'' | ||
== | === Build multi-distro SD Card === | ||
# ''Get distro | # ''Get distro compressed images and decompress them. (i.e. Manjaro.phosh.beta34, Mobian.6.1, ArchLinux)'' | ||
# ''Mount distro images both partitions "/boot", "/root" for each distro'' | # ''Mount distro images both partitions "/boot", "/root" for each distro'' | ||
# <code>lsblk</code> ''# find /loop, /sd references. Use <code>blkid</code> to see the UUID for the partition'' | # <code>lsblk</code> ''# find /loop, /sd references. Use <code>blkid</code> to see the UUID for the partition'' | ||
Line 86: | Line 88: | ||
>fdtdir '''/boot'''/dtb-6.1-rockchip/ | >fdtdir '''/boot'''/dtb-6.1-rockchip/ | ||
APPEND root=PARTLABEL=MOBIAN console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait fbcon=rotate:0 pinephone_keyboard.disable_input | APPEND root=PARTLABEL=MOBIAN console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait fbcon=rotate:0 pinephone_keyboard.disable_input | ||
== Flash rk2aw BootLoader to SPI & multi-distro eMMC == | |||
Make sure your boot from the SDcard in your PPP as we are going to be building the eMMC. Note that below arch is booted from the SDcard and the SDcard shows as /dev/mmcblk1 | |||
=== Download and Run rk2aw SPI Flasher === | |||
Same as above | |||
=== Build multi-distro eMMC === | |||
In this example we are going to build 2 partitions on the eMMC, the first with Arch/phosh and the second with Arch/sxmo. We have already downloaded the images from [https://github.com/dreemurrs-embedded/Pine64-Arch/releases Danct12] and decompressed them. | |||
==== Mount the images ==== | |||
<code> [me@PPP Downloads]$ sudo su | |||
[sudo] password for me: | |||
[root@PPP Downloads]# losetup -P /dev/loop0 archlinux-pinephone-pro-phosh-20230203.img | |||
[root@PPP Downloads]# losetup -P /dev/loop1 archlinux-pinephone-pro-sxmo-20230203.img | |||
[root@PPP Downloads]# ls -l /mnt/ | |||
total 0 | |||
[root@PPP Downloads]# mkdir /mnt/phosh | |||
[root@PPP Downloads]# mkdir /mnt/sxmo | |||
[root@PPP Downloads]# mkdir /mnt/phosh/boot | |||
[root@PPP Downloads]# mkdir /mnt/phosh/root | |||
[root@PPP Downloads]# mkdir /mnt/sxmo/boot | |||
[root@PPP Downloads]# mkdir /mnt/sxmo/root | |||
[root@PPP Downloads]# mount /dev/loop0p1 /mnt/phosh/boot/ | |||
[root@PPP Downloads]# mount /dev/loop0p2 /mnt/phosh/root/ | |||
[root@PPP Downloads]# mount /dev/loop1p1 /mnt/sxmo/boot/ | |||
[root@PPP Downloads]# mount /dev/loop1p2 /mnt/sxmo/root/ | |||
[root@PPP Downloads]# lsblk | |||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS | |||
loop0 7:0 0 5G 0 loop | |||
├─loop0p1 259:0 0 122M 0 part /mnt/phosh/boot | |||
└─loop0p2 259:1 0 4.9G 0 part /mnt/phosh/root | |||
loop1 7:1 0 3.5G 0 loop | |||
├─loop1p1 259:2 0 122M 0 part /mnt/sxmo/boot | |||
└─loop1p2 259:3 0 3.4G 0 part /mnt/sxmo/root | |||
mmcblk2 179:0 0 115.2G 0 disk | |||
├─mmcblk2p1 179:1 0 122M 0 part | |||
└─mmcblk2p2 179:2 0 115.1G 0 part | |||
mmcblk2boot0 179:32 0 4M 1 disk | |||
mmcblk2boot1 179:64 0 4M 1 disk | |||
mmcblk1 179:96 0 59.6G 0 disk | |||
├─mmcblk1p1 179:97 0 122M 0 part /boot | |||
└─mmcblk1p2 179:98 0 59.5G 0 part / | |||
zram0 254:0 0 1.5G 0 disk [SWAP]</code> | |||
==== Prepare eMMC ==== | |||
<code> [root@PPP Downloads]# dd if=/dev/zero of=/dev/mmcblk2 count=32768 bs=32768 status=progress # overwrite the front to clear any bootloaders | |||
985759744 bytes (986 MB, 940 MiB) copied, 3 s, 329 MB/s | |||
32768+0 records in | |||
32768+0 records out | |||
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 8.14441 s, 132 MB/s | |||
[root@PPP Downloads]# sfdisk /dev/mmcblk2 << EOF | |||
> label: gpt | |||
> first-lba: 64 | |||
> table-length: 8 | |||
> size=32G, name="PHOSH", attrs="RequiredPartition,LegacyBIOSBootable" | |||
> size=+, name="SXMO", attrs="RequiredPartition,LegacyBIOSBootable" | |||
> EOF | |||
Checking that no-one is using this disk right now ... OK | |||
Disk /dev/mmcblk2: 115.23 GiB, 123731968000 bytes, 241664000 sectors | |||
Units: sectors of 1 * 512 = 512 bytes | |||
Sector size (logical/physical): 512 bytes / 512 bytes | |||
I/O size (minimum/optimal): 512 bytes / 512 bytes | |||
>>> Script header accepted. | |||
>>> Script header accepted. | |||
>>> Script header accepted. | |||
>>> Created a new GPT disklabel (GUID: 7EB4B1E0-5F49-4F30-9F1E-E9E1F305D461). | |||
The maximal number of partitions is 8 (default is 128). | |||
/dev/mmcblk2p1: Created a new partition 1 of type 'Linux filesystem' and of size 32 GiB. | |||
/dev/mmcblk2p2: Created a new partition 2 of type 'Linux filesystem' and of size 83.2 GiB. | |||
/dev/mmcblk2p3: Done. | |||
New situation: | |||
Disklabel type: gpt | |||
Disk identifier: 7EB4B1E0-5F49-4F30-9F1E-E9E1F305D461 | |||
Device Start End Sectors Size Type | |||
/dev/mmcblk2p1 2048 67110911 67108864 32G Linux filesystem | |||
/dev/mmcblk2p2 67110912 241661951 174551040 83.2G Linux filesystem | |||
The partition table has been altered. | |||
Calling ioctl() to re-read partition table. | |||
Syncing disks. | |||
[root@PPP Downloads]# lsblk | |||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS | |||
loop0 7:0 0 5G 0 loop | |||
├─loop0p1 259:0 0 122M 0 part /mnt/phosh/boot | |||
└─loop0p2 259:1 0 4.9G 0 part /mnt/phosh/root | |||
loop1 7:1 0 3.5G 0 loop | |||
├─loop1p1 259:2 0 122M 0 part /mnt/sxmo/boot | |||
└─loop1p2 259:3 0 3.4G 0 part /mnt/sxmo/root | |||
mmcblk2 179:0 0 115.2G 0 disk | |||
├─mmcblk2p1 179:1 0 32G 0 part | |||
└─mmcblk2p2 179:2 0 83.2G 0 part | |||
mmcblk2boot0 179:32 0 4M 1 disk | |||
mmcblk2boot1 179:64 0 4M 1 disk | |||
mmcblk1 179:96 0 59.6G 0 disk | |||
├─mmcblk1p1 179:97 0 122M 0 part /boot | |||
└─mmcblk1p2 179:98 0 59.5G 0 part / | |||
zram0 254:0 0 1.5G 0 disk [SWAP]</code> | |||
==== Build phosh partition ==== | |||
<code> | |||
[root@PPP Downloads]# dd if=/dev/loop0p2 of=/dev/mmcblk2p1 bs=1M status=progress conv=fsync | |||
5225054208 bytes (5.2 GB, 4.9 GiB) copied, 215 s, 24.3 MB/s5238685696 bytes (5.2 GB, 4.9 GiB) copied, 215.606 s, 24.3 MB/s | |||
4996+0 records in | |||
4996+0 records out | |||
5238685696 bytes (5.2 GB, 4.9 GiB) copied, 218.565 s, 24.0 MB/s | |||
[root@PPP Downloads]# mkdir /mnt/ephosh # e for the eMMC! | |||
[root@PPP Downloads]# mount /dev/mmcblk2p1 /mnt/ephosh/ | |||
[root@PPP Downloads]# scp -r /mnt/phosh/boot/* /mnt/ephosh/boot | |||
[root@PPP Downloads]# mv /mnt/ephosh/boot/boot.scr /mnt/ephosh/boot/boot.scrORIG | |||
[root@PPP Downloads]# nano /mnt/ephosh/etc/fstab # set PARTLABEL for / and remove /boot | |||
[root@PPP Downloads]# mkdir /mnt/ephosh/boot/extlinux | |||
[root@PPP Downloads]# nano /mnt/ephosh/boot/extlinux/extlinux.conf</code> | |||
==== Build sxmo partition ==== | |||
We have unmounted all the phosh devices, so | |||
<code> | |||
[root@PPP Downloads]# lsblk | |||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS | |||
loop0 7:0 0 5G 0 loop | |||
├─loop0p1 259:0 0 122M 0 part | |||
└─loop0p2 259:1 0 4.9G 0 part | |||
loop1 7:1 0 3.5G 0 loop | |||
├─loop1p1 259:2 0 122M 0 part /mnt/sxmo/boot | |||
└─loop1p2 259:3 0 3.4G 0 part /mnt/sxmo/root | |||
mmcblk2 179:0 0 115.2G 0 disk | |||
├─mmcblk2p1 179:1 0 32G 0 part | |||
└─mmcblk2p2 179:2 0 83.2G 0 part | |||
mmcblk2boot0 179:32 0 4M 1 disk | |||
mmcblk2boot1 179:64 0 4M 1 disk | |||
mmcblk1 179:96 0 59.6G 0 disk | |||
├─mmcblk1p1 179:97 0 122M 0 part /boot | |||
└─mmcblk1p2 179:98 0 59.5G 0 part / | |||
zram0 254:0 0 1.5G 0 disk [SWAP] | |||
[root@PPP Downloads]# dd if=/dev/loop1p2 of=/dev/mmcblk2p2 bs=1M status=progress conv=fsync | |||
3613392896 bytes (3.6 GB, 3.4 GiB) copied, 153 s, 23.6 MB/s3628072960 bytes (3.6 GB, 3.4 GiB) copied, 153.543 s, 23.6 MB/s | |||
3460+0 records in | |||
3460+0 records out | |||
3628072960 bytes (3.6 GB, 3.4 GiB) copied, 156.292 s, 23.2 MB/s | |||
[root@PPP Downloads]# mount /dev/mmcblk2p2 /mnt/esxmo/ | |||
[root@PPP Downloads]# scp -r /mnt/sxmo/boot/* /mnt/esxmo/boot | |||
[root@PPP Downloads]# mv /mnt/esxmo/boot/boot.scr /mnt/esxmo/boot/boot.scrORIG | |||
[root@PPP Downloads]# nano /mnt/esxmo/etc/fstab # set PARTLABEL for / and comment /boot | |||
[root@PPP Downloads]# cat /mnt/esxmo/etc/fstab | |||
# Static information about the filesystems. | |||
# See fstab(5) for details. | |||
# <file system> <dir> <type> <options> <dump> <pass> | |||
PARTLABEL=SXMO / ext4 rw,relatime 0 1 | |||
# UUID=841C-F9DD /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2 | |||
[root@PPP Downloads]# mkdir /mnt/esxmo/boot/extlinux | |||
[root@PPP Downloads]# nano /mnt/esxmo/boot/extlinux/extlinux.conf | |||
[root@PPP Downloads]# cat /mnt/esxmo/boot/extlinux/extlinux.conf | |||
#/boot/extlinux/extlinux.conf | |||
MENU TITLE Pinephone Pro Boot Menu | |||
LABEL l0 | |||
MENU LABEL sxmo | |||
FDT /boot/dtbs/rockchip/rk3399-pinephone-pro.dtb | |||
KERNEL /boot/Image | |||
INITRD /boot/initramfs-linux.img | |||
APPEND root=PARTLABEL=SXMO console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait fbcon=rotate:0 pinephone_keyboard.disable_input</code> | |||
=== Follow-up comments === | |||
# On first boot neither phosh nor sxmo resized their partition - sudo resize2fs sorted that. | |||
# Any time an update rebuilds the initramfs it is necessary to delete /boot/boot.scr again to keep the rk2aw menu clean. |
Revision as of 22:49, 9 August 2023
How to flash rk2aw and setup multi-distro disks on PinePhonePro
Flash rk2aw BootLoader to SPI & multi-distro SDcard
References: https://xff.cz/kernels/rk2aw/rk2aw-rk3399-pinephone-pro/INSTALL and https://xnux.eu/rk2aw/
Requirements: SSH connection from linux machine to PinePhonePro, internet connection.
Note: Preloader and userspace utility to flash it are non-free.
Thanks: Megi at https://xnux.eu/log/
Download and Run rk2aw SPI Flasher
- Connect PinePhonePro to linux machine and start a ssh connection
ssh <user>@<phoneip>
# set a connectioncd ~/Downloads
# enter to directorycurl -O https://xff.cz/kernels/bootloaders/ppp.tar.gz
# download installertar -xvzf ppp.tar.gz -C ~/Downloads
# extract# scp -r ~/Downloads/ppp <user>@<phoneip>:~/Downloads
# copy to phone, non neededsudo ./spinor-flash-initial-setup.sh
# flash SPI
Build multi-distro SD Card
- Get distro compressed images and decompress them. (i.e. Manjaro.phosh.beta34, Mobian.6.1, ArchLinux)
- Mount distro images both partitions "/boot", "/root" for each distro
lsblk
# find /loop, /sd references. Useblkid
to see the UUID for the partition- ├─loop0p1 /media/xxx/BOOT_MNJRO
- └─loop0p2 /media/xxx/ROOT_MNJRO
- ├─loop1p1 /media/xxx/boot
- └─loop1p2 /media/xxx/rootfs
- ├─loop2p1 /media/xxx/52CA-6165
- └─loop2p2 /media/xxx/3d99072c-9fd6-4316-8526-9192e192c441
- └─sdb disk (after each dd command you'll see the partition id name to adjust into scripts.)
sudo dd if=/dev/zero of=/dev/sdb count=945728 bs=32768 status=progress
# quick erase sd card. i.e. # 32GB SDcard (30989615104bytes/32768dim=945728volte)- or
sudo dd if=/dev/zero of=/dev/sdb count=1 bs=32768 status=progress
# slow erase sd card. i.e. # 32GB SDcard (30989615104bytes/32768dim=1volta) ) - Partition sd card (min
6432GB)
sudo sfdisk /dev/sdb <<EOF label: gpt first-lba: 64 table-length: 8 start=64, size=32704, type=D7B1F817-AA75-2F4F-830D-84818A145370, name="loader", attrs=RequiredPartition size=10G, name="ALARM", attrs="RequiredPartition,LegacyBIOSBootable" size=10G, name="MANJARO", attrs="RequiredPartition,LegacyBIOSBootable" size=+, name="MOBIAN", attrs="RequiredPartition,LegacyBIOSBootable" EOF
lsblk
# list partitions on sd and mounted distro images- Device Start End Sectors Size Type
- /dev/sdb1 64 32767 32704 16M unknown
- /dev/sdb2 32768 16809983 16777216 8G Linux filesystem
- /dev/sdb3 16809984 33587199 16777216 8G Linux filesystem
- /dev/sdb4 33587200 60524543 26937344 12.8G Linux filesystem
- Copy files for Arch Linux ARM
sudo dd if=/dev/loop2p2 of=/dev/sdb2 bs=1M status=progress conv=fsync
# copy rootfs to sd part2sudo scp -r /media/xxx/52CA-6165/* /media/xxx/3d99072c-9fd6-4316-8526-9192e192c441
# copy bootfs to to part2/boot1/bootsudo mv /media/xxx/3d99072c-9fd6-4316-8526-9192e192c441
# hide auto-menu item1/boot/boot.scr /media/xxx/3d99072c-9fd6-4316-8526-9192e192c4411/boot/boot.scrORIGsudo nano /media/xxx/3d99072c-9fd6-4316-8526-9192e192c441
# add PARTLABEL=ALARM and delete UUID=xxx from second line1/etc/fstabsudo mkdir /media/xxx/3d99072c-9fd6-4316-8526-9192e192c441
# add directory1/boot/extlinuxsudo nano /media/xxx/3d99072c-9fd6-4316-8526-9192e192c441
# add file1/boot/extlinux/extlinux.conf
#/boot/extlinux/extlinux.conf MENU TITLE Pinephone Pro Boot Menu LABEL l0 MENU LABEL ALarm FDT /boot/dtbs/rockchip/rk3399-pinephone-pro.dtb KERNEL /boot/Image INITRD /boot/initramfs-linux.img APPEND root=PARTLABEL=ALARM console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait fbcon=rotate:0 pinephone_keyboard.disable_input
- Copy files for ManJaro
sudo dd if=/dev/loop0p2 of=/dev/sdb3 bs=1M status=progress conv=fsync
# copy rootfs to sd part3sudo scp -r /media/xxx/BOOT_MNJRO/* /media/xxx/ROOT_MNJRO1/boot
# copy bootfs to to part3/bootsudo nano /media/xxx/ROOT_MNJRO1/etc/fstab
# change UUID=xxx to PARTLABEL=MANJAROsudo mv /media/xxx/ROOT_MNJRO1/boot/boot.scr /media/xxx/ROOT_MNJRO1/boot/boot.scrORIG
# hide auto-menu itemsudo mkdir /media/xxx/ROOT_MNJRO1/boot/extlinux
# add directorysudo nano /media/xxx/ROOT_MNJRO1/boot/extlinux/extlinux.conf
#add file
#/boot/extlinux/extlinux.conf MENU TITLE Pinephone Pro Boot Menu LABEL l0 MENU LABEL ManJaro FDT /boot/dtbs/rockchip/rk3399-pinephone-pro.dtb KERNEL /boot/Image INITRD /boot/initramfs-linux.img APPEND root=PARTLABEL=MANJARO console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait fbcon=rotate:0 pinephone_keyboard.disable_input
- Copy files for MObian
sudo dd if=/dev/loop1p2 of=/dev/sdb4 bs=1M status=progress conv=fsync
# copy rootfs to sd part4sudo scp -r /media/xxx/boot/* /media/xxx/rootfs1/boot
# copy bootfs to to part4/bootsudo nano /media/xxx/rootfs1/etc/fstab
# replace UUID=xxx with PARTLABEL=MOBIAN and delete UUID=xxx from second line.sudo nano /media/xxx/rootfs1/boot/extlinux/extlinux.conf
# edit path from /bootfs to /part4/boot
>linux /boot/vmlinuz-6.1-rockchip >initrd /boot/initrd.img-6.1-rockchip >fdtdir /boot/dtb-6.1-rockchip/ APPEND root=PARTLABEL=MOBIAN console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait fbcon=rotate:0 pinephone_keyboard.disable_input
Flash rk2aw BootLoader to SPI & multi-distro eMMC
Make sure your boot from the SDcard in your PPP as we are going to be building the eMMC. Note that below arch is booted from the SDcard and the SDcard shows as /dev/mmcblk1
Download and Run rk2aw SPI Flasher
Same as above
Build multi-distro eMMC
In this example we are going to build 2 partitions on the eMMC, the first with Arch/phosh and the second with Arch/sxmo. We have already downloaded the images from Danct12 and decompressed them.
Mount the images
[me@PPP Downloads]$ sudo su
[sudo] password for me:
[root@PPP Downloads]# losetup -P /dev/loop0 archlinux-pinephone-pro-phosh-20230203.img
[root@PPP Downloads]# losetup -P /dev/loop1 archlinux-pinephone-pro-sxmo-20230203.img
[root@PPP Downloads]# ls -l /mnt/
total 0
[root@PPP Downloads]# mkdir /mnt/phosh
[root@PPP Downloads]# mkdir /mnt/sxmo
[root@PPP Downloads]# mkdir /mnt/phosh/boot
[root@PPP Downloads]# mkdir /mnt/phosh/root
[root@PPP Downloads]# mkdir /mnt/sxmo/boot
[root@PPP Downloads]# mkdir /mnt/sxmo/root
[root@PPP Downloads]# mount /dev/loop0p1 /mnt/phosh/boot/
[root@PPP Downloads]# mount /dev/loop0p2 /mnt/phosh/root/
[root@PPP Downloads]# mount /dev/loop1p1 /mnt/sxmo/boot/
[root@PPP Downloads]# mount /dev/loop1p2 /mnt/sxmo/root/
[root@PPP Downloads]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 5G 0 loop
├─loop0p1 259:0 0 122M 0 part /mnt/phosh/boot
└─loop0p2 259:1 0 4.9G 0 part /mnt/phosh/root
loop1 7:1 0 3.5G 0 loop
├─loop1p1 259:2 0 122M 0 part /mnt/sxmo/boot
└─loop1p2 259:3 0 3.4G 0 part /mnt/sxmo/root
mmcblk2 179:0 0 115.2G 0 disk
├─mmcblk2p1 179:1 0 122M 0 part
└─mmcblk2p2 179:2 0 115.1G 0 part
mmcblk2boot0 179:32 0 4M 1 disk
mmcblk2boot1 179:64 0 4M 1 disk
mmcblk1 179:96 0 59.6G 0 disk
├─mmcblk1p1 179:97 0 122M 0 part /boot
└─mmcblk1p2 179:98 0 59.5G 0 part /
zram0 254:0 0 1.5G 0 disk [SWAP]
Prepare eMMC
[root@PPP Downloads]# dd if=/dev/zero of=/dev/mmcblk2 count=32768 bs=32768 status=progress # overwrite the front to clear any bootloaders
985759744 bytes (986 MB, 940 MiB) copied, 3 s, 329 MB/s
32768+0 records in
32768+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 8.14441 s, 132 MB/s
[root@PPP Downloads]# sfdisk /dev/mmcblk2 << EOF
> label: gpt
> first-lba: 64
> table-length: 8
> size=32G, name="PHOSH", attrs="RequiredPartition,LegacyBIOSBootable"
> size=+, name="SXMO", attrs="RequiredPartition,LegacyBIOSBootable"
> EOF
Checking that no-one is using this disk right now ... OK
Disk /dev/mmcblk2: 115.23 GiB, 123731968000 bytes, 241664000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new GPT disklabel (GUID: 7EB4B1E0-5F49-4F30-9F1E-E9E1F305D461).
The maximal number of partitions is 8 (default is 128).
/dev/mmcblk2p1: Created a new partition 1 of type 'Linux filesystem' and of size 32 GiB.
/dev/mmcblk2p2: Created a new partition 2 of type 'Linux filesystem' and of size 83.2 GiB.
/dev/mmcblk2p3: Done.
New situation:
Disklabel type: gpt
Disk identifier: 7EB4B1E0-5F49-4F30-9F1E-E9E1F305D461
Device Start End Sectors Size Type
/dev/mmcblk2p1 2048 67110911 67108864 32G Linux filesystem
/dev/mmcblk2p2 67110912 241661951 174551040 83.2G Linux filesystem
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@PPP Downloads]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 5G 0 loop
├─loop0p1 259:0 0 122M 0 part /mnt/phosh/boot
└─loop0p2 259:1 0 4.9G 0 part /mnt/phosh/root
loop1 7:1 0 3.5G 0 loop
├─loop1p1 259:2 0 122M 0 part /mnt/sxmo/boot
└─loop1p2 259:3 0 3.4G 0 part /mnt/sxmo/root
mmcblk2 179:0 0 115.2G 0 disk
├─mmcblk2p1 179:1 0 32G 0 part
└─mmcblk2p2 179:2 0 83.2G 0 part
mmcblk2boot0 179:32 0 4M 1 disk
mmcblk2boot1 179:64 0 4M 1 disk
mmcblk1 179:96 0 59.6G 0 disk
├─mmcblk1p1 179:97 0 122M 0 part /boot
└─mmcblk1p2 179:98 0 59.5G 0 part /
zram0 254:0 0 1.5G 0 disk [SWAP]
Build phosh partition
[root@PPP Downloads]# dd if=/dev/loop0p2 of=/dev/mmcblk2p1 bs=1M status=progress conv=fsync
5225054208 bytes (5.2 GB, 4.9 GiB) copied, 215 s, 24.3 MB/s5238685696 bytes (5.2 GB, 4.9 GiB) copied, 215.606 s, 24.3 MB/s
4996+0 records in
4996+0 records out
5238685696 bytes (5.2 GB, 4.9 GiB) copied, 218.565 s, 24.0 MB/s
[root@PPP Downloads]# mkdir /mnt/ephosh # e for the eMMC!
[root@PPP Downloads]# mount /dev/mmcblk2p1 /mnt/ephosh/
[root@PPP Downloads]# scp -r /mnt/phosh/boot/* /mnt/ephosh/boot
[root@PPP Downloads]# mv /mnt/ephosh/boot/boot.scr /mnt/ephosh/boot/boot.scrORIG
[root@PPP Downloads]# nano /mnt/ephosh/etc/fstab # set PARTLABEL for / and remove /boot
[root@PPP Downloads]# mkdir /mnt/ephosh/boot/extlinux
[root@PPP Downloads]# nano /mnt/ephosh/boot/extlinux/extlinux.conf
Build sxmo partition
We have unmounted all the phosh devices, so
[root@PPP Downloads]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 5G 0 loop
├─loop0p1 259:0 0 122M 0 part
└─loop0p2 259:1 0 4.9G 0 part
loop1 7:1 0 3.5G 0 loop
├─loop1p1 259:2 0 122M 0 part /mnt/sxmo/boot
└─loop1p2 259:3 0 3.4G 0 part /mnt/sxmo/root
mmcblk2 179:0 0 115.2G 0 disk
├─mmcblk2p1 179:1 0 32G 0 part
└─mmcblk2p2 179:2 0 83.2G 0 part
mmcblk2boot0 179:32 0 4M 1 disk
mmcblk2boot1 179:64 0 4M 1 disk
mmcblk1 179:96 0 59.6G 0 disk
├─mmcblk1p1 179:97 0 122M 0 part /boot
└─mmcblk1p2 179:98 0 59.5G 0 part /
zram0 254:0 0 1.5G 0 disk [SWAP]
[root@PPP Downloads]# dd if=/dev/loop1p2 of=/dev/mmcblk2p2 bs=1M status=progress conv=fsync
3613392896 bytes (3.6 GB, 3.4 GiB) copied, 153 s, 23.6 MB/s3628072960 bytes (3.6 GB, 3.4 GiB) copied, 153.543 s, 23.6 MB/s
3460+0 records in
3460+0 records out
3628072960 bytes (3.6 GB, 3.4 GiB) copied, 156.292 s, 23.2 MB/s
[root@PPP Downloads]# mount /dev/mmcblk2p2 /mnt/esxmo/
[root@PPP Downloads]# scp -r /mnt/sxmo/boot/* /mnt/esxmo/boot
[root@PPP Downloads]# mv /mnt/esxmo/boot/boot.scr /mnt/esxmo/boot/boot.scrORIG
[root@PPP Downloads]# nano /mnt/esxmo/etc/fstab # set PARTLABEL for / and comment /boot
[root@PPP Downloads]# cat /mnt/esxmo/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
PARTLABEL=SXMO / ext4 rw,relatime 0 1
# UUID=841C-F9DD /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
[root@PPP Downloads]# mkdir /mnt/esxmo/boot/extlinux
[root@PPP Downloads]# nano /mnt/esxmo/boot/extlinux/extlinux.conf
[root@PPP Downloads]# cat /mnt/esxmo/boot/extlinux/extlinux.conf
#/boot/extlinux/extlinux.conf
MENU TITLE Pinephone Pro Boot Menu
LABEL l0
MENU LABEL sxmo
FDT /boot/dtbs/rockchip/rk3399-pinephone-pro.dtb
KERNEL /boot/Image
INITRD /boot/initramfs-linux.img
APPEND root=PARTLABEL=SXMO console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait fbcon=rotate:0 pinephone_keyboard.disable_input
Follow-up comments
- On first boot neither phosh nor sxmo resized their partition - sudo resize2fs sorted that.
- Any time an update rebuilds the initramfs it is necessary to delete /boot/boot.scr again to keep the rk2aw menu clean.