Installing OpenBSD on the Pinephone

... with Crystal Kolipe ...

WARNING

The information presented on these pages is NOT intended to be followed as a guide to installing OpenBSD on your own Pinephone device, and must not be used for this purpose.

Unlike most SBCs, the Pinephone contains a rechargeable battery intended to power the device. Correct configuration of the charging circuits, including various safety features such as thermal protection will not be enabled by the current OpenBSD kernel as of the time of writing.

Article navigation

THIS IS PART ONE OF SEVEN (1/7)

=> Series index

Serial console access

Connecting to the serial console on the Pinephone is quite straightforward.

Flipping dip-switch 6 to the down position repurposes the headphone socket as a 3.3V TTL serial port, albeit with no hardware handshaking. Soldering a standard 3.5 mm stereo jack plug, (TRS connector), to a USB serial adaptor was all that was needed to interface to the port from my workstation.

For reference, the tip of the plug is RXD, the ring is TXD, and the sleeve is ground. We'll be using a line speed of 115200 bps, with a fairly standard 8 data bits, 1 stop bit and no partity, (8N1).

Installation method

Overview of the installation procedure

To install OpenBSD on the internal eMMC of the Pinephone, I first flashed a modified miniroot image containing the installer, base packages, source code, and bootloader code to it. I then booted the Pinephone from the newly written image, and overwrote part of the installation media with the actual installation.

Originally, I had hoped to use the USB dock that was supplied with this Pinephone handset to obtain a working ethernet port. As well as using it for ssh access to the installed system, I could have also used it to connect to a local server during the installation to fetch the base packages. However when I tried this, the USB connectivity between the handset and the dock didn't seem to be working at all. This wasn't just an issue with the ramdisk installation kernel, either, as the USB dock still wasn't recognised once the system was fully installed.

For installation on most arm-based boards, the only modification necessary to the miniroot image is to add the appropriate boot code. This is a quick and easy process described in the INSTALL.arm64 file that is part of the OpenBSD distribution. However in this case, due to lack of specific support for the Pinephone hardware, we need to go through some additional steps.

First, we need to compile U-boot from source. This is necessary because the binary package available for OpenBSD 7.0 does not include the boot code for the Pinephone. We first modify /usr/ports/sysutils/u-boot/Makefile and add `pinephone' to the list of aarch64 targets. Since we are modifying the makefile, we should bump the REVISION to 1 as well. Next, we modify /usr/ports/sysutils/u-boot/pkg/PFRAG.aarch64 and add seven lines indicating the files to be installed, namely those that will end up in /usr/local/share/u-boot/pinephone/.

With those changes made to the makefile and plist, we can invoke dpb to compile U-boot, and sysutils/dtb as well:

 # dpb sysutils/u-boot,aarch64 sysutils/dtb

45 minutes or so later, we can install the compiled packages:

 # pkg_add u-boot-aarch64
 # pkg_add dtb

Now we can start modifying our miniroot image. The original miniroot image is 43 Mb, and usually this can be simply be written to the beginning of a much larger device without bothering to resize it in any way. However, we want to write an additional partition to the end of the Pinephone's internal eMMC, so we'll first re-size the image file to match the total size of the eMMC, which on this particular Pinephone handset is 61071360 sectors, or 29820 Mb.

Resizing the image file can be done with a trivially short C program to invoke the truncate system call:

 #include 
 int main()
 {
 truncate ("custom.img", (long long) 61071360*512);
 return (0);
 }

Note that this will create a sparse file, so we don't actually need 29 Gb of free space on the partition that holds custom.img.

With the above code saved as resize.c, we'll compile it, copy and resize the miniroot image, mount the new image file as a vnode virtual disk, and modify it as described in INSTALL.arm64 using our freshly compiled boot code:

 # cc -o resize resize.c
 # cp miniroot70.img custom.img
 # ./resize
 # vnconfig vnd0 custom.img
 # mount /dev/vnd0i /mnt
 # mkdir /mnt/allwinner
 # cp /usr/local/share/dtb/arm64/allwinner/sun50i-a64-pinephone-1.2.dtb /mnt/allwinner/
 # umount /mnt
 # dd if=/usr/local/share/u-boot/pinephone/u-boot-sunxi-with-spl.bin of=/dev/vnd0c bs=1024 seek=8

The next step is to add a partition containing the packages for the base system, which we'll need for the installation, and the source code, which will be useful once the system is up and running.

Since our installation media will be loaded from the internal eMMC, and we intend to install the system to the same device, we'll be overwriting the existing OpenBSD partition and disklabel. This means that we can't just add a regular OpenBSD disklabel partition within the OpenBSD fdisk partition that is already contained within the image. Instead, we create an additional non-OpenBSD fdisk partition and format it as FFS2. During the installation, this will automatically be added to the new disklabel as partition 'j', in much the same was as the EFI system partition is added as partition 'i'. Since it lies outside the area of the OpenBSD fdisk partition, we can create the regular disklabel partitions however we please during the installation without affecting it.

Invoking fdisk to look at the image file, we can see the two original MBR partitions as well as the new 29 Gb geometry:

 Disk: vnd0      geometry: 610713/1/100 [61071360 Sectors]
 Offset: 0       Signature: 0xAA55
             Starting         Ending         LBA Info:
  #: id      C   H   S -      C   H   S [       start:        size ]
 -------------------------------------------------------------------------------
 *0: 0C    327   0  69 -    491   0  52 [       32768:       16384 ] Win95 FAT32L
  1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
  2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
  3: A6    491   0  53 -    880   0  64 [       49152:       38912 ] OpenBSD     

We can now use the interactive mode of fdisk to add another partition of type E5:

 Disk: vnd0      geometry: 610713/1/100 [61071360 Sectors]
 Offset: 0       Signature: 0xAA55
             Starting         Ending         LBA Info:
  #: id      C   H   S -      C   H   S [       start:        size ]
 -------------------------------------------------------------------------------
 *0: 0C    327   0  69 -    491   0  52 [       32768:       16384 ] Win95 FAT32L
  1: E5 590000   0   1 - 610713   0  60 [    59000000:     2071360 ] 
  2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
  3: A6    491   0  53 -    880   0  64 [       49152:       38912 ] OpenBSD     

Then add a matching partition entry to the disklabel, having first changed the bounds of the OpenBSD area:

 # disklabel -E vnd0
 Label editor (enter '?' for help at any prompt)
 vnd0> b
 Starting sector: [49152]
 Size ('*' for entire disk): [38912] *
 vnd0*> a j
 offset: [88064] 59000000
 size: [2071360]
 FS type: [4.2BSD]
 vnd0*> w
 vnd0> p
 OpenBSD area: 49152-61071360; size: 61022208; free: 58911936
 #                size           offset  fstype [fsize bsize   cpg]
   a:            38912            49152  4.2BSD   2048 16384  1216 
   c:         61071360                0  unused                    
   i:            16384            32768   MSDOS                    
   j:          2071360         59000000  4.2BSD   2048 16384      1
 vnd0> q
 No label changes.

Now we can format the new partition and copy the required files to it:

 # newfs vnd0j
 # mount /dev/vnd0j /mnt
 # mkdir /mnt/src/
 # cp 7.0/arm64/* /mnt
 # cp 7.0/src.tar.gz /mnt/src/
 # cp 7.0/sys.tar.gz /mnt/src/
 # cp 7.0/ports.tar.gz /mnt/src/
 # cp 7.0/xenocara.tar.gz /mnt/src/
 # umount /mnt

Then unconfigure the vnode device:

 # vnconfig -u vnd0

Our image is now ready to be flashed to the Pinephone eMMC.

Although we could just flash the whole image to the handset, we would be re-writing the entire eMMC, mostly with 0x00 bytes. We can avoid this, speed up the process, and reduce wear on the eMMC by flashing just the sectors that we know contain useful data. Assuming that the Pinephone's eMMC is sd9, we might use something like:

 # dd if=custom.img of=/dev/rsd9c bs=1m count=43
 # dd if=custom.img of=/dev/rsd9c bs=1m skip=28808 seek=28808

Invoking the terminal emulator

OpenBSD includes the cu' terminal emulator in the base installation, so assuming that the serial adaptor is cuaU0, we can run cu' on the host workstation with:

 # cu -l cuaU0 -s 115200

Booting the installer

With our customised miniroot image written to the eMMC, we just need to switch the Pinephone on to start loading the OpenBSD installer.

First, we see output from U-boot:

 U-Boot SPL 2021.07 (Dec 25 2021 - 18:03:51 -0300)
 DRAM: 3072 MiB
 Trying to boot from MMC2
 NOTICE:  BL31: v2.5(debug):2.5
 NOTICE:  BL31: Built : 16:12:26, Dec 25 2021
 NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
 NOTICE:  BL31: Found U-Boot DTB at 0x408ddc0, model: Pine64 PinePhone (1.2)
 INFO:    ARM GICv2 driver initialized
 INFO:    Configuring SPC Controller
 INFO:    PMIC: Probing AXP803 on RSB
 INFO:    PMIC: dcdc1 voltage: 3.300V
 INFO:    PMIC: dcdc5 voltage: 1.200V
 INFO:    PMIC: dcdc6 voltage: 1.100V
 INFO:    PMIC: dldo1 voltage: 3.300V
 INFO:    PMIC: dldo2 voltage: 1.800V
 INFO:    PMIC: dldo3 voltage: 2.800V
 INFO:    PMIC: dldo4 voltage: 1.800V
 INFO:    PMIC: fldo1 voltage: 1.200V
 INFO:    PMIC: Enabling DC SW
 INFO:    BL31: Platform setup done
 INFO:    BL31: Initializing runtime services
 INFO:    BL31: cortex_a53: CPU workaround for 843419 was applied
 INFO:    BL31: cortex_a53: CPU workaround for 855873 was applied
 INFO:    BL31: cortex_a53: CPU workaround for 1530924 was applied
 INFO:    PSCI: Suspend is unavailable
 INFO:    BL31: Preparing for EL3 exit to normal world
 INFO:    Entry point address = 0x4a000000
 INFO:    SPSR = 0x3c9
 
 U-Boot 2021.07 (Dec 25 2021 - 18:03:51 -0300) Allwinner Technology
 
 CPU:   Allwinner A64 (SUN50I)
 Model: Pine64 PinePhone (1.2)
 DRAM:  3 GiB
 MMC:   mmc@1c0f000: 0, mmc@1c10000: 2, mmc@1c11000: 1
 Loading Environment from FAT... Unable to read "uboot.env" from mmc1:1... In:    serial
 Out:   serial
 Err:   serial
 Net:   No ethernet found.
 starting USB...
 No working controllers found
 Hit any key to stop autoboot:  2  1  0 
 switch to partitions #0, OK
 mmc1(part 0) is current device
 Scanning mmc 1:1...
 31164 bytes read in 14 ms (2.1 MiB/s)
 [ESC]7[ESC][r[ESC][999;999H[ESC][6n[ESC]8MMC: no card present
 Scanning disk mmc@1c0f000.blk...
 Disk mmc@1c0f000.blk not ready
 Card did not respond to voltage select! : -110
 Scanning disk mmc@1c10000.blk...
 Disk mmc@1c10000.blk not ready
 Scanning disk mmc@1c11000.blk...
 ** Unrecognized filesystem type **
 ** Unrecognized filesystem type **
 Found 4 disks
 No EFI system partition
 BootOrder not defined
 EFI boot manager: Cannot load any image
 Found EFI removable media binary efi/boot/bootaa64.efi
 170694 bytes read in 34 ms (4.8 MiB/s)
 Booting /efi\boot\bootaa64.efi
Note that in the gemtext version of these articles, the ESCAPE character 0x1B in console output is represented as [ESC]

Next, we see output from the OpenBSD bootloader, followed by the ramdisk kernel:

 disks: sd0*
 >> OpenBSD/arm64 BOOTAA64 1.6
 |/-\|/boot> 
 #-\|cannot open sd0a:/etc/random.seed: No such file or directory
 booting sd0a:/bsd: /-\|/2574016-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|+696612/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\+13009456|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-+631664\ [216000|/-\|/-\|/-\|/+109+596472-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/+233168-\|/-\|/-\|/-\]=0x1401e58
 type 0x2 pa 0x40000000 va 0x40000000 pages 0x4000 attr 0x8
 type 0x7 pa 0x44000000 va 0x44000000 pages 0x3ef5 attr 0x8
 type 0x9 pa 0x47ef5000 va 0x47ef5000 pages 0x16 attr 0x8
 type 0x7 pa 0x47f0b000 va 0x47f0b000 pages 0xb0eec attr 0x8
 type 0x2 pa 0xf8df7000 va 0xf8df7000 pages 0x100 attr 0x8
 type 0x1 pa 0xf8ef7000 va 0xf8ef7000 pages 0x2a attr 0x8
 type 0x0 pa 0xf8f21000 va 0xf8f21000 pages 0x7 attr 0x8
 type 0x4 pa 0xf8f28000 va 0xf8f28000 pages 0x1 attr 0x8
 type 0x6 pa 0xf8f29000 va 0xa3863000 pages 0x4 attr 0x8000000000000008
 type 0x4 pa 0xf8f2d000 va 0xf8f2d000 pages 0x1 attr 0x8
 type 0x6 pa 0xf8f2e000 va 0xa3868000 pages 0x4 attr 0x8000000000000008
 type 0x0 pa 0xf8f32000 va 0xf8f32000 pages 0x1 attr 0x8
 type 0x4 pa 0xf8f33000 va 0xf8f33000 pages 0x1 attr 0x8
 type 0x0 pa 0xf8f34000 va 0xf8f34000 pages 0x1 attr 0x8
 type 0x4 pa 0xf8f35000 va 0xf8f35000 pages 0x1 attr 0x8
 type 0x0 pa 0xf8f36000 va 0xf8f36000 pages 0x1 attr 0x8
 type 0x4 pa 0xf8f37000 va 0xf8f37000 pages 0x2 attr 0x8
 type 0x0 pa 0xf8f39000 va 0xf8f39000 pages 0x1 attr 0x8
 type 0x4 pa 0xf8f3a000 va 0xf8f3a000 pages 0x2 attr 0x8
 type 0x2 pa 0xf8f3c000 va 0xf8f3c000 pages 0x5024 attr 0x8
 type 0x5 pa 0xfdf60000 va 0xa889a000 pages 0x10 attr 0x8000000000000008
 type 0x2 pa 0xfdf70000 va 0xfdf70000 pages 0x2090 attr 0x8
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 	The Regents of the University of California.  All rights reserved.
 Copyright (c) 1995-2021 OpenBSD. All rights reserved.  https://www.OpenBSD.org
 
 OpenBSD 7.0 (RAMDISK) #1250: Thu Sep 30 17:13:12 MDT 2021
     deraadt@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/RAMDISK
 real mem  = 3101560832 (2957MB)
 avail mem = 2969333760 (2831MB)
 random: boothowto does not indicate good seed
 mainbus0 at root: Pine64 PinePhone (1.2)
 psci0 at mainbus0: PSCI 1.1, SMCCC 1.2
 cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
 cpu0: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
 cpu0: 512KB 64b/line 16-way L2 cache
 cpu0: CRC32,SHA2,SHA1,AES+PMULL,ASID16
 efi0 at mainbus0: UEFI 2.8
 efi0: Das U-Boot rev 0x20210700
 "display-engine" at mainbus0 not configured
 "osc24M_clk" at mainbus0 not configured
 "osc32k_clk" at mainbus0 not configured
 "pmu" at mainbus0 not configured
 "sound" at mainbus0 not configured
 agtimer0 at mainbus0: 24000 kHz
 simplebus0 at mainbus0: "soc"
 sxisyscon0 at simplebus0
 sxisid0 at simplebus0
 sxiccmu0 at simplebus0
 sxipio0 at simplebus0: 103 pins
 ampintc0 at simplebus0 nirq 224, ncpu 4: "interrupt-controller"
 sxirtc0 at simplebus0
 sxiccmu1 at simplebus0
 sxipio1 at simplebus0: 13 pins
 sxirsb0 at simplebus0
 "x-powers,axp803" at sxirsb0 addr 0x3a3 not configured
 "bus" at simplebus0 not configured
 "dma-controller" at simplebus0 not configured
 "lcd-controller" at simplebus0 not configured
 "lcd-controller" at simplebus0 not configured
 "video-codec" at simplebus0 not configured
 sximmc0 at simplebus0
 sdmmc0 at sximmc0: 4-bit, sd high-speed, mmc high-speed, dma
 sximmc1 at simplebus0
 sdmmc1 at sximmc1: 4-bit, sd high-speed, mmc high-speed, dma
 sximmc2 at simplebus0
 sdmmc2 at sximmc2: 8-bit, sd high-speed, mmc high-speed, dma
 "crypto" at simplebus0 not configured
 "mailbox" at simplebus0 not configured
 "usb" at simplebus0 not configured
 "phy" at simplebus0 not configured
 ehci0 at simplebus0
 usb0 at ehci0: USB revision 2.0
 uhub0 at usb0 configuration 1 interface 0 "Generic EHCI root hub" rev 2.00/1.00 addr 1
 ohci0 at simplebus0: version 1.0
 ehci1 at simplebus0
 usb1 at ehci1: USB revision 2.0
 uhub1 at usb1 configuration 1 interface 0 "Generic EHCI root hub" rev 2.00/1.00 addr 1
 ohci1 at simplebus0: version 1.0
 "lradc" at simplebus0 not configured
 "dai" at simplebus0 not configured
 "codec" at simplebus0 not configured
 "thermal-sensor" at simplebus0 not configured
 com0 at simplebus0: ns16550, no working fifo
 com0: console
 com1 at simplebus0: ns16550, no working fifo
 com2 at simplebus0: ns16550, no working fifo
 sxitwi0 at simplebus0
 iic0 at sxitwi0
 "goodix,gt917s" at iic0 addr 0x5d not configured
 sxitwi1 at simplebus0
 iic1 at sxitwi1
 "st,lis3mdl-magn" at iic1 addr 0x1e not configured
 "sensortek,stk3311" at iic1 addr 0x48 not configured
 "invensense,mpu6050" at iic1 addr 0x68 not configured
 sxitwi2 at simplebus0
 iic2 at sxitwi2
 "gpu" at simplebus0 not configured
 "dram-controller" at simplebus0 not configured
 "dsi" at simplebus0 not configured
 "d-phy" at simplebus0 not configured
 "deinterlace" at simplebus0 not configured
 "hdmi-phy" at simplebus0 not configured
 "interrupt-controller" at simplebus0 not configured
 "codec-analog" at simplebus0 not configured
 "pwm" at simplebus0 not configured
 sxidog0 at simplebus0
 gpio0 at sxipio0: 32 pins
 gpio1 at sxipio0: 32 pins
 gpio2 at sxipio0: 32 pins
 gpio3 at sxipio0: 32 pins
 gpio4 at sxipio0: 32 pins
 gpio5 at sxipio0: 32 pins
 gpio6 at sxipio0: 32 pins
 gpio7 at sxipio0: 32 pins
 gpio8 at sxipio1: 32 pins
 usb2 at ohci0: USB revision 1.0
 uhub2 at usb2 configuration 1 interface 0 "Generic OHCI root hub" rev 1.00/1.00 addr 1
 usb3 at ohci1: USB revision 1.0
 uhub3 at usb3 configuration 1 interface 0 "Generic OHCI root hub" rev 1.00/1.00 addr 1
 "opp_table0" at mainbus0 not configured
 "backlight" at mainbus0 not configured
 "leds" at mainbus0 not configured
 "ps-regulator" at mainbus0 not configured
 "vbat-wifi" at mainbus0 not configured
 "led-controller" at mainbus0 not configured
 "audio-amplifier" at mainbus0 not configured
 "vibrator" at mainbus0 not configured
 "wifi-pwrseq" at mainbus0 not configured
 scsibus0 at sdmmc2: 2 targets, initiator 0
 sd0 at scsibus0 targ 1 lun 0:  removable
 sd0: 29820MB, 512 bytes/sector, 61071360 sectors
 manufacturer 0x024c, product 0xb703 at sdmmc1 function 1 not configured
 softraid0 at root
 scsibus1 at softraid0: 256 targets
 root on rd0a swap on rd0b dump on rd0b
 WARNING: bad clock chip time
 WARNING: CHECK AND RESET THE DATE!
 cpu0: regulator not implemented
 erase ^?, werase ^W, kill ^U, intr ^C, status ^T
 
 Welcome to the OpenBSD/arm64 7.0 installation program.
 (I)nstall, (U)pgrade, (A)utoinstall or (S)hell? i
 At any prompt except password prompts you can escape to a shell by
 typing '!'. Default answers are shown in []'s and are selected by
 pressing RETURN.  You can exit this program at any time by pressing
 Control-C, but this can leave your system in an inconsistent state.

The first part of the installation is basically the same as for any other system:

 Terminal type? [vt220] 
 System hostname? (short form, e.g. 'foo') phone
 
 Available network interfaces are: vlan0.
 Which network interface do you wish to configure? (or 'done') [vlan0] done
 DNS domain name? (e.g. 'example.com') [my.domain] lan
 DNS nameservers? (IP address list or 'none') [none] 
 
 Password for root account? (will not echo) 
 Password for root account? (again) 
 Start sshd(8) by default? [yes] 
 Setup a user? (enter a lower-case loginname, or 'no') [no] 
 Since no user was setup, root logins via sshd(8) might be useful.
 WARNING: root is targeted by password guessing attacks, pubkeys are safer.
 Allow root ssh login? (yes, no, prohibit-password) [no] yes

Now we reach the point where we are asked about partitioning the disks:

 Available disks are: sd0.
 Which disk is the root disk? ('?' for details) [sd0] 
 Disk: sd0       geometry: 3801/255/63 [61071360 Sectors]
 Offset: 0       Signature: 0xAA55
             Starting         Ending         LBA Info:
  #: id      C   H   S -      C   H   S [       start:        size ]
 #-------------------------------------------------------------------------------
 *0: 0C      2  10   9 -      3  15  12 [       32768:       16384 ] Win95 FAT32L
  1: E5   3672 147  60 -   3801 131  42 [    59000000:     2071360 ] 
  2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
  3: A6      3  15  13 -      5 122  53 [       49152:       38912 ] OpenBSD     
 Use (W)hole disk or (E)dit the MBR? [whole] e

We choose to edit the MBR, and change the size of the OpenBSD MBR partition which we are about to overwrite anyway:

 You will now create one MBR partition to contain your OpenBSD data
 and one MBR partition on which the OpenBSD boot program is located.
 Neither partition will overlap any other partition.
 
 The OpenBSD MBR partition will have an id of 'A6' and the boot MBR
 partition will have an id of 'C' (msdos).
 The boot partition will be at least 16MB and be the first 'MSDOS'
 partition on the disk.
 
 Disk: sd0       geometry: 3801/255/63 [61071360 Sectors]
 Offset: 0       Signature: 0xAA55
             Starting         Ending         LBA Info:
  #: id      C   H   S -      C   H   S [       start:        size ]
 #-------------------------------------------------------------------------------
 *0: 0C      2  10   9 -      3  15  12 [       32768:       16384 ] Win95 FAT32L
  1: E5   3672 147  60 -   3801 131  42 [    59000000:     2071360 ] 
  2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
  3: A6      3  15  13 -      5 122  53 [       49152:       38912 ] OpenBSD     
 Enter 'help' for information
 sd0: 1> e 3
             Starting         Ending         LBA Info:
  #: id      C   H   S -      C   H   S [       start:        size ]
 #-------------------------------------------------------------------------------
  3: A6      3  15  13 -      5 122  53 [       49152:       38912 ] OpenBSD     
 Partition id ('0' to disable) [01 - FF]: [E5] (? for help) 
 Do you wish to edit in CHS mode? [n] 
 Partition offset [0 - 61071359]: [49152] 
 Partition size [1 - 61022208]: [38912] 58950848
 sd0*: 1> p g
 Disk: sd0       geometry: 3801/255/63 [61071360 Sectors]
 Offset: 0       Signature: 0xAA55
             Starting         Ending         LBA Info:
  #: id      C   H   S -      C   H   S [       start:        size ]
 #-------------------------------------------------------------------------------
 *0: 0C      2  10   9 -      3  15  12 [       32768:           0G] Win95 FAT32L
  1: E5   3672 147  60 -   3801 131  42 [    59000000:           1G] 
  2: 00      0   0   0 -      0   0   0 [           0:           0G] unused      
  3: A6      3  15  13 -   3672 147  59 [       49152:          28G] OpenBSD     
 sd0*: 1> w
 Writing MBR at offset 0.
 sd0: 1> q

Note that we calculate the value of 58950848 for the size of the OpenBSD partition by subtracting the starting sector, 49152, from the first sector of our additional partition, 59000000.

 The auto-allocated layout for sd0 is:
 #                size           offset  fstype [fsize bsize   cpg]
   a:          1024.0M            49152  4.2BSD   2048 16384     1 # /
   b:          1880.3M          2146304    swap                    
   c:         29820.0M                0  unused                    
   d:          1560.2M          5997088  4.2BSD   2048 16384     1 # /tmp
   e:          2420.3M          9192352  4.2BSD   2048 16384     1 # /var
   f:          3300.2M         14149184  4.2BSD   2048 16384     1 # /usr
   g:           924.1M         20908096  4.2BSD   2048 16384     1 # /usr/X11R6
   h:          3724.4M         22800576  4.2BSD   2048 16384     1 # /usr/local
   i:             8.0M            32768   MSDOS                    
   j:          1011.4M         59000000 unknown                    
   k:          1660.0M         30428096  4.2BSD   2048 16384     1 # /usr/src
   l:          5840.1M         33827872  4.2BSD   2048 16384     1 # /usr/obj
   m:          6451.0M         45788384  4.2BSD   2048 16384     1 # /home
 Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a]

Since this is only a test installation, we can just accept the default automatic layout.

 /dev/rsd0a: 1024.0MB in 2097152 sectors of 512 bytes
 6 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
 /dev/rsd0m: 6451.0MB in 13211616 sectors of 512 bytes
 32 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
 /dev/rsd0d: 1560.2MB in 3195264 sectors of 512 bytes
 8 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
 /dev/rsd0f: 3300.2MB in 6758912 sectors of 512 bytes
 17 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
 /dev/rsd0g: 924.1MB in 1892480 sectors of 512 bytes
 5 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
 /dev/rsd0h: 3724.4MB in 7627520 sectors of 512 bytes
 19 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
 /dev/rsd0l: 5840.1MB in 11960512 sectors of 512 bytes
 29 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
 /dev/rsd0k: 1660.0MB in 3399776 sectors of 512 bytes
 9 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
 /dev/rsd0e: 2420.3MB in 4956832 sectors of 512 bytes
 12 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
 /dev/sd0a (9b39e808bdc4da01.a) on /mnt type ffs (rw, asynchronous, local)
 /dev/sd0m (9b39e808bdc4da01.m) on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid)
 /dev/sd0d (9b39e808bdc4da01.d) on /mnt/tmp type ffs (rw, asynchronous, local, nodev, nosuid)
 /dev/sd0f (9b39e808bdc4da01.f) on /mnt/usr type ffs (rw, asynchronous, local, nodev)
 /dev/sd0g (9b39e808bdc4da01.g) on /mnt/usr/X11R6 type ffs (rw, asynchronous, local, nodev)
 /dev/sd0h (9b39e808bdc4da01.h) on /mnt/usr/local type ffs (rw, asynchronous, local, nodev)
 /dev/sd0l (9b39e808bdc4da01.l) on /mnt/usr/obj type ffs (rw, asynchronous, local, nodev, nosuid)
 /dev/sd0k (9b39e808bdc4da01.k) on /mnt/usr/src type ffs (rw, asynchronous, local, nodev, nosuid)
 /dev/sd0e (9b39e808bdc4da01.e) on /mnt/var type ffs (rw, asynchronous, local, nodev, nosuid)
 
 Let's install the sets!
 Location of sets? (disk http nfs or 'done') [http] disk
 Is the disk partition already mounted? [yes] no
 Available disks are: sd0.
 Which disk contains the install media? (or 'done') [sd0] sd0
   a:          2097152            49152  4.2BSD   2048 16384 12960 # /mnt
   d:          3195264          5997088  4.2BSD   2048 16384 12960 # /mnt/tmp
   e:          4956832          9192352  4.2BSD   2048 16384 12960 # /mnt/var
   f:          6758912         14149184  4.2BSD   2048 16384 12960 # /mnt/usr
   g:          1892480         20908096  4.2BSD   2048 16384 12960 # /mnt/usr/X11R6
   h:          7627520         22800576  4.2BSD   2048 16384 12960 # /mnt/usr/local
   i:            16384            32768   MSDOS                    
   j:          2071360         59000000 unknown                    
   k:          3399776         30428096  4.2BSD   2048 16384 12960 # /mnt/usr/src
   l:         11960512         33827872  4.2BSD   2048 16384 12960 # /mnt/usr/obj
   m:         13211616         45788384  4.2BSD   2048 16384 12960 # /mnt/home
 Available sd0 partitions are: a d e f g h i j k l m.
 Which sd0 partition has the install sets? (or 'done') [a] j
 Pathname to the sets? (or 'done') [7.0/arm64] /
 
 Select sets by entering a set name, a file name pattern or 'all'. De-select
 sets by prepending a '-', e.g.: '-game*'. Selected sets are labelled '[X]'.
     [X] bsd           [X] base70.tgz    [X] game70.tgz    [X] xfont70.tgz
     [X] bsd.mp        [X] comp70.tgz    [X] xbase70.tgz   [X] xserv70.tgz
     [X] bsd.rd        [X] man70.tgz     [X] xshare70.tgz
 Set name(s)? (or 'abort' or 'done') [done] 
 Verifying  SHA256.sig   100% |**************************|  1544       00:00    
 Signature Verified
 Verifying  bsd          100% |**************************| 13720 KB    00:01    
 Verifying  bsd.mp       100% |**************************| 13782 KB    00:01    
 Verifying  bsd.rd       100% |**************************| 17118 KB    00:01    
 Verifying  base70.tgz   100% |**************************|   227 MB    00:22    
 Verifying  comp70.tgz   100% |**************************| 67418 KB    00:06    
 Verifying  man70.tgz    100% |**************************|  7580 KB    00:00    
 Verifying  game70.tgz   100% |**************************|  2677 KB    00:00    
 Verifying  xbase70.tgz  100% |**************************| 49023 KB    00:04    
 Verifying  xshare70.tgz 100% |**************************|  4495 KB    00:00    
 Verifying  xfont70.tgz  100% |**************************| 22965 KB    00:02    
 Verifying  xserv70.tgz  100% |**************************| 12354 KB    00:01    
 Installing bsd          100% |**************************| 13720 KB    00:01    
 Installing bsd.mp       100% |**************************| 13782 KB    00:01    
 Installing bsd.rd       100% |**************************| 17118 KB    00:01    
 Installing base70.tgz   100% |**************************|   227 MB    01:08    
 Extracting etc.tgz      100% |**************************|   246 KB    00:00    
 Installing comp70.tgz   100% |**************************| 67418 KB    00:33    
 Installing man70.tgz    100% |**************************|  7580 KB    00:08    
 Installing game70.tgz   100% |**************************|  2677 KB    00:00    
 Installing xbase70.tgz  100% |**************************| 49023 KB    00:30    
 Extracting xetc.tgz     100% |**************************|  7080       00:00    
 Installing xshare70.tgz 100% |**************************|  4495 KB    00:04    
 Installing xfont70.tgz  100% |**************************| 22965 KB    00:05    
 Installing xserv70.tgz  100% |**************************| 12354 KB    00:05    
 Location of sets? (disk http nfs or 'done') [done] done
 
 What timezone are you in? ('?' for list) [Canada/Mountain] Factory
 Saving configuration files... done.
 Making all device nodes... done.
 Multiprocessor machine; using bsd.mp instead of bsd.
 Relinking to create unique kernel... done.
 
 CONGRATULATIONS! Your OpenBSD install has been successfully completed!
 
 When you login to your new system the first time, please read your mail
 using the 'mail' command.
 
 Exit to (S)hell, (H)alt or (R)eboot? [reboot] 
 syncing disks... done
 rebooting...

The initial kernel re-linking takes about 90 seconds, and then we are able to reboot into the newly installed system.

Article navigation

=> Part 2 - Booting the completed installation and initial information gathering. | Part 3 - Starting to debug USB issues. | Part 4 - Investigating errors from sxirsb. | Part 5 - Controlling the LEDs and vibration motor. | Part 6 - PMIC and battery charging. | Part 7 - External keyboard battery.

=> Home page of the Exotic Silicon gemini capsule. | Your use of this gemini capsule is subject to the terms and conditions of use.

Copyright 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Exotic Silicon. All rights reserved.

Proxy Information
Original URL
gemini://gemini.exoticsilicon.com/series/pinephone_openbsd/part_1
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
348.35766 milliseconds
Gemini-to-HTML Time
5.735972 milliseconds

This content has been proxied by September (ba2dc).