--- wikisrc/ports/evbarm/raspberry_pi.mdwn 2018/10/30 01:40:39 1.72 +++ wikisrc/ports/evbarm/raspberry_pi.mdwn 2018/10/30 23:09:40 1.78 @@ -14,40 +14,40 @@ Initial, limited, Raspberry Pi support w ## NetBSD 7 and NetBSD 8 - - RaspberryPi 1, and 2 (including SMP) - - Raspberry Pi 3 (excluding WiFi and bluetooth) - - multi-user boot with root on SD card + - RaspberryPi 1, 2, 3 (except Pi 3 builtin WiFi and bluetooth) + - multiple processors on 2/3 + - boots normally to multiuser, with FAT32 boot partition on uSD + - root filesystem can be uSD or USB-attached mass storage - serial or graphics console (with EDID query / parsing) + - X11 via HDMI + - GPU (VCHIQ) - 3D and video decode. man page missing. + - USB host controller - dwctwo(4) and most devices work + - USB Ethernet - usmsc(4) - DMA controller driver and sdhc(4) support + - RNG - Audio: works. man page missing. - - I²C: works, could use enhancements, man page - GPIO - - RNG + - I²C: works, could use enhancements, man page - SPI: could use enhancements, man page - - GPU (VCHIQ) - 3D and video decode. man page missing. - - USB (host) - dwctwo(4) - - USB Ethernet - usmsc(4) - - X windows. ## NetBSD current - - Raspberry Pi 3 bluetooth + - Raspberry Pi 3 builtin bluetooth - Raspberry Pi 3 new SD host controller driver ## What needs work - USB (host); isochronous transfers. - - WiFi + - Raspberry Pi 3 builtin WiFi # CPU types -Note that one can also use code for earlier models on later models. - - Raspberry Pi 1 uses "earmv6hf". - Raspberry Pi 2 uses "earmv7hf". - Raspberry Pi 3 uses "earmv7hf". -See also [[NetBSD/aarch64|aarch64]] for running the Pi 2/3 in 64-bit mode. +Note that one can run earmv6hf code on the 2 and 3. See also +[[NetBSD/aarch64|aarch64]] for running the Pi 2/3 in 64-bit mode. # Installation @@ -132,6 +132,13 @@ every few weeks. - [https://github.com/ebijun/NetBSD/blob/master/RPI/RPIimage/Image/README](https://github.com/ebijun/NetBSD/blob/master/RPI/RPIimage/Image/README) +# Maintaining a system + +## vcgencmd + +The program vcgencmd can be found in pkgsrc/misc/raspberrypi-userland. + + ## Updating the kernel - Build a new kernel, e.g. using build.sh. It will tell you where the ELF version of the kernel is, e.g. @@ -145,9 +152,30 @@ every few weeks. - Depending on your hardware version, copy this either to /boot/kernel.img (First generation Pi, Pi Zero hardware) or to /boot/kernel7.img (Pi 2, Pi 3 hardware) - reboot +## Updating the firmware + +A section below describes the process of updating NetBSD's copy of the firmware from upstream, with testing, by NetBSD developers. This section is about updating a system's firmware from the firmware in a version of NetBSD. + +TODO: Explain where the firmware is in the source tree, and if it is in the installed system image (such as /usr/mdec). Explain any particular cautions. + +## Booting + +The device boots by finding a file "bootcode.bin". The primary location is a FAT32 partition on the uSD card, and an additional location is on a USB drive. See the [[upstream documentation on booting]](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/) and read all the subpages. + +The standard approach is to use a uSD card, with a fdisk partition table containing a FAT32 partition marked active, and a NetBSD partition. The NetBSD partition will then contain a disklabel, pointing to an FFS partition (a), a swap paritiion (b) and the FAT32 boot partition mounted as /boot (e). The file /boot/cmdline.txt has a line to set the root partition. + +One wrinkle in the standard approach is that the disk layout is "boot swap /", but the NetBSD fdisk partition starts at the location of /. The / partition can hold a disklabel, while swap cannot. It is normal to have swap after / (and thus within the fdisk partition), but the arrangement used permits growing / on first boot, for the typical case where a larger uSD is used, compared to the minimum image size. + +An alternate approach is to have the boot FAT32 partition as above, but to have the entire system including root on an external disk. This is configured by changing root=ld0a to root=sd0a or root=dk0 (depending on disklabel/GPT). Besides greater space, part of the point is to avoid writing to the uSD card. + +A third approach, workable on the Pi 3 only, is to configure USB host booting (already enableed on the 3+; see the upstream documentation) and have the boot partition also on the external device. In this case the external device must have an MBR because the hardware's first-stage boot does not have GPT support. \todo Explain if this has been observed to work. +\todo In theory the [[procedure to program USB host boot mode]](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md) will function on a NetBSD system because the programming is done by bootcode.bin. + +\todo Explain USB enumeration and how to ensure that the correct boot and root devices are found if one has e.g. a small SSD for the system and a big disk. + # Wireless Networking - Note that the built-in WiFi in the RPI3 is not yet supported. +Note that the built-in WiFi in the RPI3 is not yet supported. USB WiFi interfaces (that work on NetBSD in general) should all work. - A Realtek 802.11n USB adaptor configures as urtwn(4). - Configure with wpa_supplicant in /etc/rc.conf -