123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- # Instructions for creating a PureOS Image for PinePhone by mozzwald
- ########################################################################
- # You will need u-boot-tools package for your distro and it helps
- # to have binfmt and qemu packages for chrooting to the image.
- # Paths and devices may be different on your system. Always verify
- # before blindly copying and pasting commands.
- # Make a new working directory
- mkdir ~/purepp
- cd ~/purepp
- # Download and extract PinePhone phosh image (check for newer releases if you like)
- wget https://images.postmarketos.org/pinephone/pine-pinephone-20200218-phosh.img.xz
- unxz -d pine-pinephone-20200218-phosh.img.xz
- # Download and extract PureOS Librem 5 image (check for newer releases if you like)
- wget http://downloads.pureos.net/amber/phone/gnome/librem5/2020-02-25/librem5.img.xz
- unxz -d librem5.img.xz
- # Make temporary dirs for mounting images
- mkdir pmos-boot pmos-root pureos-boot pureos-root
- # List used loop devices
- losetup -a
- # List all loop devices
- ls /dev/loop*
- # The remaining commands should be run with sudo or as root user (sudo su)
- # Pick an unused loop device (5 in my case) and mount pmOS image with partitions
- losetup -P /dev/loop5 pine-pinephone-20200218-phosh.img
- # Pick an unused loop device (6 in my case) and mount PureOS image with partitions
- losetup -P /dev/loop6 librem5.img
- # Get pmOS PinePhone bootloader
- dd if=/dev/loop5 of=uboot-pmos.bin count=2048
- # Put pmOS PinePhone bootloader on PureOS image
- dd if=uboot-pmos.bin of=/dev/loop6 bs=1024 skip=8 seek=8
- # Mount partitions
- mount /dev/loop5p1 pmos-boot
- mount /dev/loop5p2 pmos-root
- mount /dev/loop6p1 pureos-boot
- mount /dev/loop6p2 pureos-root
- # Copy PinePhone kernel & dtb to PureOS image
- cp pmos-boot/vmlinuz-postmarketos-allwinner pureos-boot/
- cp pmos-boot/sun50i-a64-pinephone.dtb pureos-boot/
- # Copy PinePhone modules to PureOS image
- cp -pRv pmos-root/lib/modules/5.5.0 pureos-root/lib/modules/
- # Copy PinePhone firmware to PureOS image
- cp -pRv pmos-root/lib/firmware pureos-root/lib/
- # Make u-boot initramfs from PureOS initramfs
- mkimage -A arm -O linux -T ramdisk -C gzip -d pureos-boot/initrd.img pureos-boot/uInitrd.img
- # Get uboot-script
- wget https://mozzwald.com/pp/pureos-uboot-script.cmd -O pureos-boot/boot.cmd
- # Compile uboot script
- mkimage -A arm64 -T script -C none -d pureos-boot/boot.cmd pureos-boot/boot.scr
- # Put helper files into rootfs
- wget https://mozzwald.com/pp/pureos-pp-helpers.tar.gz
- cd pureos-root
- tar -pxvf ../pureos-pp-helpers.tar.gz
- # If you have binfmt setup for arm64/aarch64 then you can chroot and enable modem service
- # and do whatever else you want. Otherwise this needs done after bootup
- cp /usr/bin/qemu-aarch64-static usr/bin/
- chroot ./
- systemctl enable pinephone.service # enable modem service
- exit
- cd ..
- # Unmount disk images
- umount pmos-boot pmos-root pureos-boot pureos-root
- losetup -d /dev/loop5
- losetup -d /dev/loop6
- # Copy the new image to SD card
- dd if=librem5.img of=/dev/your-sd-card-device bs=1M
- # Optionally resize PureOS Root partition on SD card
- # Put in PinePhone and boot. WIN!
- Default username: purism
- Default password: 123456
|