xref: /openbsd-src/distrib/notes/arm64/prep (revision b3a69e4eefa82ed6d33e84a8ee465bcffd0ca2dd)
1dnl	$OpenBSD: prep,v 1.22 2024/09/28 17:09:52 sthen Exp $
2To perform an installation you must be able to interact with the
3console of the machine.  In some cases this can be done by an attached
4monitor and keyboard.  In others a serial console is required.
5USB OTG ports such as the one found on the BeagleBone will not
6function as a console.  You need to be able to interact with the
7firmware on the console.  Often this requires a 3.3V TTL level
8adapter connected to pins or a header on the board.
9
10Firmware which provides an UEFI interface with a Device Tree Blob
11(DTB) file or ACPI support is required to boot.  In most cases this is
12provided by images of U-Boot 2016.07 or newer on SD/MMC devices or in
13SPI flash.  If the miniroot or install images are used, U-Boot and
14DTB files are distributed as part of the images.
15
16OpenBSD can be installed onto a disk by copying the miniroot or install
17image for your board ("miniroot{:--:}OSrev.img" or "install{:--:}OSrev.img")
18to an SD card.
19
20Booting from an SD card:
21
22  To use a miniroot/install image you will need another machine to plug the
23  SD card in to. Any machine type will do, as long as it supports SD card
24  storage devices.  Under OpenBSD, it will appear as a ``sd'' device, for
25  example sd1.
26
27  Use the dd(1) utility to copy the image to the SD card.
28  The command would likely be, under OpenBSD:
29	dd if=miniroot{:--:}OSrev.img of=/dev/rsd1c bs=1m
30
31  When you have connected the serial to your computer, a command such
32  as "cu -l cuaU0 -s 115200" (assuming cuaU0 is your serial port device)
33  should connect you to the board's console.
34
35Running EFI payloads with U-Boot:
36
37If the U-Boot target supports "distro_bootcmd" efiboot will automatically
38be loaded by placing bootaa64.efi into /efi/boot/bootaa64.efi on a FAT
39filesystem.  With dtb files placed in /vendor/, /dtbs/vendor/, or
40/dtb/current/vendor/.
41
42If the U-Boot target supports bootefi but not automatically finding it with
43"distro_bootcmd" then it must be loaded manually or by U-Boot commands or
44script.
45	=> run findfdt
46	=> load mmc 0:1 ${fdt_addr_r} ${fdtfile}
47	=> load mmc 0:1 ${kernel_addr_r} efi/boot/bootaa64.efi
48	=> bootefi ${kernel_addr_r} ${fdt_addr_r}
49The bootloader will then run and try to load sd0a:/bsd off an FFS
50filesystem after a timeout.
51
52Install on Apple Silicon:
53
54  These machines do not come with UEFI firmware by default.  In order
55  to install OpenBSD on these machine you need to run the Asahi Linux
56  installer first in macOS or the macOS recovery environment.
57
58  If "Erase All Content and Settings" has been run, the machine will
59  need to connect to Apple's servers to activate.  A user-linked
60  Activation Lock can be removed by turning off Find My for the machine
61  through iCloud.  An Apple account is otherwise not required for
62  activation or installation.
63
64  Instructions on how to download and run the Asahi Linux installer
65  can be found at https://asahilinux.org/.  Run it in macOS or the
66  macOS recovery environment.
67
68  Note that while running the suggested:
69  	curl https://alx.sh | sh
70  is probably safe, it is teaching a bad habit.  It is better to
71  download the installer:
72	curl -o alx.sh https://alx.sh
73  and inspect the alx.sh script before running it:
74	sh alx.sh
75
76  You will have to create some free space for your OpenBSD install by
77  choosing the
78	"Resize an existing partition to make space for a new OS"
79  option first.  Once that is done, pick the
80	"Install an OS into free space"
81  option, choose
82	"UEFI environment only (m1n1 + U-Boot + ESP)"
83  and follow the steps presented to you.
84
85  Now you can copy the miniroot or install image
86  ("miniroot{:--:}OSrev.img" or "install{:--:}OSrev.img") to a USB
87  drive, plug it into one of the ports on the machine and reset
88  the machine to boot into the OpenBSD installer.
89
90Install on Raspberry Pi:
91
92  The standard miniroot supports at least the Raspberry Pi 3 and 4 with
93  no additional firmware.  Some devices may not be functional with Pi 3+.
94  It is recommended that you install to a USB storage device.
95
96  The default system console is on the TTL serial interface on the
97  TXD/RXD/GND pins of the https://pinout.xyz/ header on the board.
98  It will be helpful to obtain an adapter (e.g. CP2102 USB-UART).
99  If you have one, attach it to the pins and a computer; a command
100  such as "cu -l cuaU0 -s 115200" (assuming cuaU0 is your serial
101  port device) should connect you to the board's console.
102
103  If not, note that once the kernel has started running, by default you
104  will only see output on the serial console.  To switch to displaying on
105  the monitor instead, watch for the OpenBSD BOOTAA64 "boot>" prompt,
106  and type "set tty fb0".
107
108  Alternatively the system can be booted using UEFI firmware found at
109  https://github.com/pftf/RPi4. Follow their instructions to install to an
110  SD card and run the OpenBSD installer from USB. v1.21 is known to work;
111  some newer versions may have problems.
112
113Install on systems without a supported miniroot:
114
115  If a miniroot is not available for your system you will have to modify
116  an existing image before booting it.
117
118  Write the provided miniroot image to an SD card:
119
120	dd if=miniroot{:--:}OSrev.img of=/dev/rsdXc bs=1m
121
122  For systems based on Allwinner Axx SoCs:
123
124	pkg_add u-boot-sun50i
125	ls /usr/local/share/u-boot/*/u-boot-sunxi-with-spl.bin
126	dd if=/usr/local/share/u-boot/board/u-boot-sunxi-with-spl.bin \
127	    of=/dev/sdXc bs=1024 seek=8
128
129  For systems based on Rockchip RK33xx SoCs:
130
131	pkg_add u-boot-aarch64
132	ls /usr/local/share/u-boot/*/u-boot.itb
133	dd if=/usr/local/share/u-boot/board/idbloader.img \
134	    of=/dev/sdXc seek=64
135	dd if=/usr/local/share/u-boot/board/u-boot.itb \
136	    of=/dev/sdXc seek=16384
137
138  For systems based on Rockchip RK356x SoCs:
139
140	pkg_add u-boot-rk356x
141	ls /usr/local/share/u-boot/*/u-boot-rockchip.bin
142	dd if=/usr/local/share/u-boot/board/u-boot-rockchip.bin \
143	    of=/dev/sdXc seek=64
144
145  For systems based on Rockchip RK3588 SoCs:
146
147	pkg_add u-boot-rk3588
148	ls /usr/local/share/u-boot/*/u-boot-rockchip.bin
149	dd if=/usr/local/share/u-boot/board/u-boot-rockchip.bin \
150	    of=/dev/sdXc seek=64
151