%

Faire fonctionner OpenBSD sur le Raspberry Pi 3

Article publié, le et modifié le
10 minutes de lecture

Cet article contient 2036 mots.
Source brute de l'article :
Commit version : 36e3c52

Description

Retrouvez ci-dessous la traduction EN → FR de l’article “Running OpenBSD on Raspberry Pi 3”, écrit par Joel Carnat.


Faire fonctionner OpenBSD sur le Raspberry Pi 3

  • OS concerné : OpenBSD 6.3 et >

  • Étape 1 : avoir dans les mains un Raspbian
  • Étape 2 : exécuté OpenBSD sur le modèle B du Raspberry Pi 3. J’ai eu pas mal d’essais et d’échecs, mais il a démarré, a été installé et à la fin, il fonctionne correctement. Voici l’histoire complète.

Le matériel

Raspberry Pi 3
Raspberry Pi 3

Pour installer OpenBSD 6.3 sur le Raspberry Pi 3 v1.2, j’ai utilisé une microSD de 128 Mo (pour héberger l’installateur), un adaptateur USB pour la microSD, une clé USB sans marque de 30 Go, un convertisseur USB-TTL et un câble RJ45.

Tout a été fait depuis un Macbook Pro utilisant MacOS 10.13.5. Les commandes de préparation ne devraient pas différer beaucoup si vous utilisez un des *BSD ou Linux.

J’ai démarré les deux versions d’OpenBSD 6.3, la stable et la current mais le support matériel était le même. Pas d’interface Wifi…

Procédure Étape par Étape

Récupérez votre fichier d’installation d’OpenBSD favori. J’ai utilisé miniroot63.fs.

Formatez votre microSD et votre clé USB. Cela n’est absolument pas requis mais je préfère démarrer vraiment vide.

# diskutil list

# diskutil unmountDisk /dev/disk2
# dd if=/dev/zero of=/dev/disk2 count=4096
()
# diskutil eject /dev/disk2
Disk /dev/disk2 ejected

# diskutil unmountDisk /dev/disk3
# dd if=/dev/zero of=/dev/disk3 count=4096
()
# diskutil eject /dev/disk3
Disk /dev/disk3 ejected

Insérez la microSD au dos du MacBook, ignorez les messages d’initialisation de MacOS et copiez le fichier miniroot.fs sur la carte.

# diskutil list
()
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: *126.0 MB disk2

# dd if=miniroot63.fs of=/dev/disk2 bs=1m
21+0 records in
21+0 records out
22020096 bytes transferred in 7.937130 secs (2774315 bytes/sec)

# diskutil list
()
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *126.0 MB disk2
1: Windows_FAT_32 BOOT 4.2 MB disk2s1
2: OpenBSD 13.6 MB disk2s4

# diskutil eject /dev/disk2
Disk /dev/disk2 ejected

Pour être capable de démarrer depuis la clé USB, le Raspberry a été “patché”. Cela a été fait en ajoutant un drapeau dans le OTP. Vous devrez insérer la microSD dans le Mac, et éditer le fichier BOOT/config.txt en ajoutant une simple ligne de code.

|# echo “program_usb_boot_mode=1” » /Volumes/BOOT/config.txt|

Insérez la microSD dans le slot microSD du RPI3, la clé USB dans un des connecteurs USB du RPI3. Connectez le câble Ethernet au RPI3. Connectez le RPI3 et le MacBook en utilisant l’adaptateur USB TTL.

Depuis mon terminal, j’ai utilisé les commandes suivantes pour accéder à la console :

# cu -l /dev/cu.usbserial -s 115200 | tee cu.log

Branchez le câble électrique microUSB au RPI3. J’ai utilisé un câble microUSB-USB et l’ai connecté au port USB3 de mon Synology. Cela a fonctionné. Bien que la console émette parfois des messages d’avertissements relatifs à la tension.

Vérifiez dans la console que tout démarre :

U-Boot 2018.03 (Mar 20 2018 - 04:28:27 -0600)

DRAM: 948 MiB
RPI 3 Model B (0xa02082)

U-Boot 2018.03 (Mar 20 2018 - 04:28:27 -0600)

DRAM: 948 MiB
RPI 3 Model B (0xa02082)
MMC: mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT… *** Warning - bad CRC, using default environment

Failed (-5)
In: serial
Out: vidconsole
Err: vidconsole
Net: No ethernet found.
starting USB…
USB0: Core Release: 2.80a
scanning bus 0 for devices… 4 USB Device(s) found
scanning usb for storage devices… 1 Storage Device(s) found
Hit any key to stop autoboot: 0

U-Boot> usb storage
Device 0: Vendor: USB Rev: 1100 Prod: Flash Disk
Type: Removable Hard Disk
Capacity: 30720.0 MB = 30.0 GB (62914560 x 512)

U-Boot> boot
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1…
Found EFI removable media binary efi/boot/bootaa64.efi
Scanning disk mmc@7e202000.blk…
Card did not respond to voltage select!
Scanning disk sdhci@7e300000.blk…
Disk sdhci@7e300000.blk not ready
Scanning disk usb_mass_storage.lun0…
Found 4 disks
82780 bytes read in 12 ms (6.6 MiB/s)
## Starting EFI application at 01000000 …
>> OpenBSD/arm64 BOOTAA64 0.11
boot>
cannot open sd0a:/etc/random.seed: No such file or directory
booting sd0a:/bsd: 2417208+377168+8373432-
+732352 [179732+96+291264+160768]=0xf498
f0
type 0x0 pa 0x0 va 0x0 pages 0x1 attr 0x8
type 0x7 pa 0x1000 va 0x0 pages 0x1ff attr 0x8
type 0x2 pa 0x200000 va 0x200000 pages 0x4000 attr 0x8
type 0x7 pa 0x4200000 va 0x0 pages 0x3e00 attr 0x8
type 0x6 pa 0x8000000 va 0xe0250b000 pages 0x8 attr 0x8000000000000008
type 0x7 pa 0x8009000 va 0x0 pages 0x312c0 attr 0x8
type 0x2 pa 0x392c9000 va 0x392c9000 pages 0x4 attr 0x8
()
type 0x2 pa 0x39f41000 va 0x39f41000 pages 0x146a attr 0x8
type 0x5 pa 0x3b3ab000 va 0xe358b6000 pages 0x1 attr 0x8000000000000008
type 0x2 pa 0x3b3ac000 va 0x39f41000 pages 0x54 attr 0x8
type 0xb pa 0x3f100000 va 0xe358b7000 pages 0x1 attr 0x8000000000000000
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
Copyright (c) 1995-2018 OpenBSD. All rights reserved. https://www.OpenBSD.org

OpenBSD 6.3 (RAMDISK) #212: Sat Mar 24 20:24:43 MDT 2018
deraadt@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/RAMDISK
real mem = 959180800 (914MB)
avail mem = 892710912 (851MB)
mainbus0 at root: Raspberry Pi 3 Model B Rev 1.2
cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
efi0 at mainbus0: UEFI 2.7
efi0: Das U-Boot rev 0x0
simplefb0 at mainbus0: 656x416
wsdisplay0 at simplefb0
wsdisplay0: screen 0 added (std, vt100 emulation)
simplebus0 at mainbus0: "soc"
bcmintc0 at simplebus0
bcmdog0 at simplebus0
bcmrng0 at simplebus0
pluart0 at simplebus0
bcmaux0 at simplebus0
com0 at sim����: ns16550, no workingcom0: console
dwctwo0 at simplebus0
simplebus1 at mainbus0: "clocks"
agtimer0 at mainbus0: tick rate 19200 KHz
usb0 at dwctwo0: USB revision 2.0
uhub0 at usb0 configuration 1 interface 0 "Broadcom DWC2 root hub" rev 2.00/1.00 addr 1
uhub1 at uhub0 port 1 configuration 1 interface 0 "Standard Microsystems product 0x9514" rev 2.00/2.00 addr 2
smsc0 at uhub1 port 1 configuration 1 interface 0 "Standard Microsystems SMSC9512/14" rev 2.00/2.00 addr 3
smsc0: address xx:xx:xx:xx:xx:xx
ukphy0 at smsc0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 0x0001f0, model 0x000c
umass0 at uhub1 port 3 configuration 1 interface 0 "USB Flash Disk" rev 2.00/11.00 addr 4
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <USB, Flash Disk, 1100> SCSI2 0/direct removable serial.090c1000000000014806
sd0: 30720MB, 512 bytes/sector, 62914560 sectors
bootfile: sd0a:/bsd
boot device: sd0
root on rd0a swap on rd0b dump on rd0b
WARNING: CHECK AND RESET THE DATE!
erase ^?, werase ^W, kill ^U, intr ^C, status ^T

Welcome to the OpenBSD/arm64 6.3 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? i

Procédez à l’installation d’OpenBSD. Ici, rien de spécial. La carte réseau sera une smsc0 et peut utiliser DHCP. En utilisant - “Whole disk” - cela créera automatiquement et remplira une partition MSDOS pour activer le démarrage depuis la clé USB. Au moment d’écrire cela, il n’est pas possible d’installer OpenBSD sur une microSD ; il n’y a pas de pilote pour cela. Je ne suis pas sûr, mais il semble qu’eMMC n’est pas non plus supporté, pas encore. La seule manière d’installer OpenBSD est d’utiliser un disque USB compatible pour démarrer.

Choisissez - “Halt” - à la fin de l’installation. Déconnectez l’alimentation USB. Enlevez la microSD d’installation.

Reconnectez l’alimention microUSB et regardez OpenBSD démarrer.

U-Boot 2018.03 (Mar 20 2018 - 04:28:27 -0600)

DRAM:  948 MiB
RPI 3 Model B (0xa02082)
MMC:   mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT… WARNING at /usr/obj/ports/u-boot-aarch64-2018.03-aarch64/u-boot-2018.03/drivers/mmc/bcm2835_sdhost.c:438/bcm2835_send_command()!
WARNING at /usr/obj/ports/u-boot-aarch64-2018.03-aarch64/u-boot-2018.03/drivers/mmc/bcm2835_sdhost.c:438/bcm2835_send_command()!
Card did not respond to voltage select!
** Bad device mmc 0 **
Failed (-5)
In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB…
USB0:   Core Release: 2.80a
scanning bus 0 for devices… 4 USB Device(s) found
       scanning usb for storage devices… 1 Storage Device(s) found
Hit any key to stop autoboot:  0
WARNING at /usr/obj/ports/u-boot-aarch64-2018.03-aarch64/u-boot-2018.03/drivers/mmc/bcm2835_sdhost.c:438/bcm2835_send_command()!
WARNING at /usr/obj/ports/u-boot-aarch64-2018.03-aarch64/u-boot-2018.03/drivers/mmc/bcm2835_sdhost.c:438/bcm2835_send_command()!
WARNING at /usr/obj/ports/u-boot-aarch64-2018.03-aarch64/u-boot-2018.03/drivers/mmc/bcm2835_sdhost.c:438/bcm2835_send_command()!
Card did not respond to voltage select!

Device 0: Vendor: USB      Rev: 1100 Prod: Flash Disk
            Type: Removable Hard Disk
            Capacity: 30720.0 MB = 30.0 GB (62914560 x 512)
… is now current device
Scanning usb 0:1…
Found EFI removable media binary efi/boot/bootaa64.efi
WARNING at /usr/obj/ports/u-boot-aarch64-2018.03-aarch64/u-boot-2018.03/drivers/mmc/bcm2835_sdhost.c:438/bcm2835_send_command()!
WARNING at /usr/obj/ports/u-boot-aarch64-2018.03-aarch64/u-boot-2018.03/drivers/mmc/bcm2835_sdhost.c:438/bcm2835_send_command()!
WARNING at /usr/obj/ports/u-boot-aarch64-2018.03-aarch64/u-boot-2018.03/drivers/mmc/bcm2835_sdhost.c:438/bcm2835_send_command()!
Card did not respond to voltage select!
Scanning disk mmc@7e202000.blk…
Disk mmc@7e202000.blk not ready
Card did not respond to voltage select!
Scanning disk sdhci@7e300000.blk…
Disk sdhci@7e300000.blk not ready
Scanning disk usb_mass_storage.lun0…
Found 3 disks
82780 bytes read in 88 ms (918 KiB/s)
## Starting EFI application at 01000000 …

3996244+595624+583064+805616 [281462+96+464664/

type 0x0 pa 0x0 va 0x0 pages 0x1 attr 0x8
type 0x7 pa 0x1000 va 0x0 pages 0x1ff attr 0x8
type 0x2 pa 0x200000 va 0x200000 pages 0x4000 attr 0x8
type 0x7 pa 0x4200000 va 0x0 pages 0x3e00 attr 0x8
type 0x6 pa 0x8000000 va 0x20987be000 pages 0x8 attr 0x8000000000000008
type 0x7 pa 0x8009000 va 0x0 pages 0x317f6 attr 0x8
type 0x2 pa 0x397ff000 va 0x397ff000 pages 0x4 attr 0x8
()
type 0x5 pa 0x3b3ab000 va 0x20cbb69000 pages 0x1 attr 0x8000000000000008
type 0x2 pa 0x3b3ac000 va 0x39f41000 pages 0x54 attr 0x8
type 0xb pa 0x3f100000 va 0x20cbb6a000 pages 0x1 attr 0x8000000000000000
[ using 994392 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2018 OpenBSD. All rights reserved.  https://www.OpenBSD.org

OpenBSD 6.3 (GENERIC.MP) #41: Sat Mar 24 20:06:13 MDT 2018
    deraadt@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/GENERIC.MP
real mem  = 964644864 (919MB)
avail mem = 905125888 (863MB)
mainbus0 at root: Raspberry Pi 3 Model B Rev 1.2
cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
efi0 at mainbus0: UEFI 2.7
efi0: Das U-Boot rev 0x0
simplefb0 at mainbus0: 656x416
wsdisplay0 at simplefb0 mux 1
wsdisplay0: screen 0-5 added (std, vt100 emulation)
simplebus0 at mainbus0: "soc"
bcmintc0 at simplebus0
bcmdog0 at simplebus0
bcmrng0 at simplebus0
pluart0 at simplebus0
bcmtemp0 at simplebus0
bcmaux0 at simplebus0
com0 at sim����: ns16550, no workingcom0: console
dwctwo0 at simplebus0
simplebus1 at mainbus0: "clocks"
agtimer0 at mainbus0: tick rate 19200 KHz
cpu1 at mainbus0 mpidr 1: ARM Cortex-A53 r0p4
cpu2 at mainbus0 mpidr 2: ARM Cortex-A53 r0p4
cpu3 at mainbus0 mpidr 3: ARM Cortex-A53 r0p4
usb0 at dwctwo0: USB revision 2.0
uhub0 at usb0 configuration 1 interface 0 "Broadcom DWC2 root hub" rev 2.00/1.00 addr 1
uhub1 at uhub0 port 1 configuration 1 interface 0 "Standard Microsystems product 0x9514" rev 2.00/2.00 addr 2
smsc0 at uhub1 port 1 configuration 1 interface 0 "Standard Microsystems SMSC9512/14" rev 2.00/2.00 addr 3
smsc0: address xx:xx:xx:xx:xx:xx
ukphy0 at smsc0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 0x0001f0, model 0x000c
umass0 at uhub1 port 3 configuration 1 interface 0 "USB Flash Disk" rev 2.00/11.00 addr 4
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <USB, Flash Disk, 1100> SCSI2 0/direct removable serial.090c1000000000014806
sd0: 30720MB, 512 bytes/sector, 62914560 sectors
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
bootfile: sd0a:/bsd
boot device: sd0
root on sd0a (01654b77d1056385.a) swap on sd0b dump on sd0b
WARNING: CHECK AND RESET THE DATE!
Automatic boot in progress: starting file system checks.
/dev/sd0a (01654b77d1056385.a): file system is clean; not checking
setting tty flags
pf enabled
starting network
smsc0: bound to 10.0.0.23 from 10.0.0.1 (xx:xx:xx:xx:xx:xx)
reordering libraries: done.
openssl: generating isakmpd/iked RSA keys… done.
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
starting early daemons: syslogd pflogd ntpd.
starting RPC daemons:.
savecore: no core dump
checking quotas: done.
clearing /tmp
kern.securelevel: 0 -> 1
creating runtime link editor directory cache.
preserving editor files.
starting network daemons: sshd smtpd sndiod.
running rc.firsttime
Path to firmware: http://firmware.openbsd.org/firmware/6.3/
No devices found which need firmware files to be downloaded.
Checking for available binary patches… done.
Run syspatch(8) to install:
001_perl
002_libtls
003_arp
004_gif
005_httpd
006_ipseclen
007_libcrypto
008_ipsecout
009_libcrypto
011_perl
starting local daemons: cron.
Sun Mar 25 07:56:40 CEST 2018

OpenBSD/arm64 (bagheera.tumfatig.net) (console)

login: root
Password:
OpenBSD 6.3 (GENERIC.MP) #41: Sat Mar 24 20:06:13 MDT 2018

Welcome to OpenBSD: The proactively secure Unix-like operating system.

Et voilà ! Rien de bien difficile.


Remerciements

Avec l’aimable autorisation de Joel Carnat !

Cette page est la traduction de la page Running OpenBSD on Raspberry Pi 3 du site TUM’FATIG. - licence de type BSD.


Historique

J’ai écrit historiquement cette traduction sur le wiki de la communauté “OpenBSD Pour Tous”.