Diff for /wikisrc/ports/evbarm/raspberry_pi.mdwn between versions 1.10 and 1.103

version 1.10, 2013/03/23 13:37:48 version 1.103, 2018/11/06 22:29:26
Line 1 Line 1
   This page attempts to document and coordinate efforts towards NetBSD/evbarm on [Raspberry Pi](http://www.raspberrypi.org).  All [board variants](https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications) are supported.  We use e.g. "RPI2" to refer to "Raspberry Pi 2" to save precious bytes on this page.
   Initial, limited, Raspberry Pi support was introduced in NetBSD 6.0. NetBSD 7.0 adds complete support for the board, along with introducing support for the quad-core Raspberry Pi 2 board.  Raspberry Pi 3 support was added for NetBSD 8, and backported to NetBSD 7 in July of 2017.  (This page assumes those using NetBSD 7 are using 7.2, or the netbsd-7 branch after mid 2018.)
 (Raspberry Pi [image](http://www.flickr.com/photos/42325803@N07/8118758647/) by Christopher Lee used under CC-By-2.0 license)  <small>([Raspberry Pi image](http://www.flickr.com/photos/42325803@N07/8118758647/) by Christopher Lee used under CC-By-2.0 license)</small>
 # Installation  # What works (and what doesn't yet)
    - An example can be found in the '/evbarm/binary/gzimg/' directory under releng.netbsd.org  ## NetBSD 7 and NetBSD 8
  - Growing the root file-system  
    - Copy /boot/cmdline.txt to /boot/cmdline.txt.orig  
            return for the default (/bin/sh).  
    - At the # prompt, type  
         "disklabel -i ld0" and press return.  
    - At the partition> prompt, type "A" and press return. You will see  
      a message like:  
            Adjust disklabel sector from 4194304 to 62333952 [n]?  
            Type "y" and press return.  
    - At the partition> prompt, type "a" and press return.  
    - At the Filesystem type prompt, press return to use the current value (4.2BSD).  
    - At the Start offset prompt, press return to use the current value.  
    - At the Partition size prompt, type "$" and press return to grow the  
            partition to use all available free space.  
    - At the partition> prompt, type "W" to save the changes to the  
            disklabel. Confirm this choice by typing "y" at the Label disk  
    - Type "Q" and press return to quit disklabel.  
    - At the # prompt, type "fsck -fy /dev/rld0a" and press return.  
    - At the # prompt, type "resize_ffs -y /dev/rld0a" and press return.  
            This may take a few minutes, be patient!  
    - At the # prompt, type "mount /dev/ld0e /boot" and press return.  
    - At the # prompt, type "mv /boot/cmdline.txt.orig /boot/cmdline.txt"  
            and press return.  
    - At the # prompt, type "reboot" and press return. When the system  
            fill the SD card.  
 # Updating the firmware  
 # Additional links  
  - [Additional kernel drivers for VCHIQ](https://github.com/jaredmcneill/vchiq-netbsd)  
 # What works   - RPI1, RPI2, RPI2-1.2, RPI3, RPI3+ (except RPI3 builtin WiFi and bluetooth)
    - multiple processors on RPI2/RPI3
    - boots normally to multiuser, with FAT32 boot partition on uSD
    - root filesystem can be uSD or USB-attached mass storage
  - X windows.   - X11 via HDMI
  - RNG: works   - USB Ethernet - usmsc(4)
    - DMA controller driver and sdhc(4) support
    - RNG
    - Audio: works. man page missing.
    - GPIO
  - I²C: works, could use enhancements, man page   - I²C: works, could use enhancements, man page
  - SPI: works, could use enhancements, man page   - SPI: could use enhancements, man page
 # What needs work  ## NetBSD current
  - VCHIQ; work in progress - will provide audio.  
  - USB (host); isochronous transfers. DMA support.   - RPI3B+ 
  - DMA controller driver / dmover(9) backend   - RPI3 builtin bluetooth
  - Teach sdhc(4) about dmover; not Raspberry Pi specific   - RPI3 new SD host controller driver
  - hardfloat; not Raspberry Pi specific  
  - earm ABI; not Raspberry Pi specific  ## What needs documenting if it works
  - GPIO  
    - CM1
    - CM3
    - CM3lite
   ## What needs work
    - USB (host); isochronous transfers.
    - RPI3 builtin WiFi
   # CPU types
    - RPI1 uses "earmv6hf".
    - RPI0 uses "\todo".
    - RPI2 uses "earmv7hf".
    - RPI3 uses "earmv7hf".
    - RPI0W uses "\todo".
   While the evbarm port has "eb" variants (for big-endian mode), the RPI systems do not support eb and these variants will not work.  Systems built with older CPU architectures (earm, earmv4, earmv5) are not expected to work on RPI.
   See also [[NetBSD/aarch64|aarch64]] for running the RPI2-1.2 and RPI3/RPI3+ in 64-bit mode.
   # Installation
   ## SD card structure
   A 2 GB card is the smallest workable size, and the installation image will fit.  After the first boot, the system resizes the NetBSD root partition to fill the card.  Note that swap is after /boot and before /, and not contained in the NetBSD fdisk partition.  However, if you don't try to change the partition structure, this should not cause you any trouble.
   ## Choosing a version
   First, decide if you want to install a formal release (7.2 or 8.0), a stable branch build (netbsd-7, netbsd-8), or NetBSD-current.  For people who don't know how to choose among those, a recent build of netbsd-8 is probably best, with 8.0 the choice for those who value being at exactly a formal release.
   ## Getting bits to install
   ### Building yourself
    - ./build.sh -m evbearmv7hf-el -u release
   ### NetBSD autobuild HTTPS/FTP servers
   An example URL, arguably the standard approach for first-time NetBSD/RPI users, is https://nyftp.netbsd.org/pub/NetBSD-daily/netbsd-8/latest/evbarm-earmv7hf/binary/gzimg/
   ### release layout
   \todo Explain why there is no armv7_inst.gz.
   ## Preparing a uSD card
   Once you have rpi.img.gz (or rpi_inst), put it on a uSD card using gunzip and dd, for example:
    - gunzip rpi.img.gz
    - dd if=rpi.img of=/dev/disk1
   ## Console approaches
   ### Serial Console
    - Most (all?) USB-to-TTL serial adapters have wires for Tx, Rx and ground, and not RTS/CTS or other flow control lines.   Thus, your terminal program (or terminal) must be configured to not require flow control; a symptom of misconfiguration is that you see console output, but cannot type anything.  If so, adjust your serial console application's flow control settings to "none".
      - In Kermit, the command is "set flow none".
   ### Enabling ssh for installation without any console
   ### Installation with sshramdisk image
    - Use ssh to login to the address you found with user "sysinst", and password "netbsd".
   \todo Verify that the above is accurate and sufficient.
   ## Installation via ebijun's image
   As an alternative to the standard installation images, Jun Ebihara
   provides an install image for Raspberry Pi that includes packages.  It
   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)
   ## Configuring 802.11
   ## Links
    - https://www.cambus.net/netbsd-on-the-raspberry-pi/
   # Maintaining a system
   ## vcgencmd
   ## 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.
            Kernels built from RPI2:
    - Besides the "netbsd" kernel in ELF format, there is also a "netbsd.img" (for current) or "netbsd.bin" (for 7 and 8) kernel that is in a format that the Raspberry can boot.
    - reboot
   ## Updating the firmware
   \todo Explain where the firmware is in the source tree, and if it is in the installed system image (such as /usr/mdec).  Explain how to update a system (presumably /boot) from either an installed system's new firmware files, or the source tree.  Explain any particular cautions.
   Probably, for the RPI3B+, one needs to use -current, or use -8 with firmware from -current.  \todo Defuzz.
   ## Booting
   # X11 and GPU
   ## Video playback
   ## OpenGL ES
   ## Quake 3
    - pak0.pk3 from Quake 3 CD
   ## RetroArch / Libretro
    - Create a config file for your gamepad using *retroarch-joyconfig*.
   [[!template  id=programlisting text="""
   $ retroarch-joyconfig -o gamepad.cfg
    - Launch the emulator from the command-line (no X required):
   [[!template  id=programlisting text="""
   $ retroarch --appendconfig gamepad.cfg -L /usr/pkg/lib/libretro/gambatte_libretro.so game.gbc
   # Developer notes
   ## Updating the firmware version in the NetBSD sources
   be prepared to recover the bootable media with another system.)
   Upstream firmware releases are
   - Audio
   - Serial/framebuffer console
   - CPU frequency scaling
   ## Testing with anita and qemu
   anita has support for evbarm.  Install qemu and dtb-arm-vexpress from pkgsrc.  Note that the release subdirectory should be evbarm-earmv6hf or evbarm-earmv7hf.
   \todo Explain how to select various RPI models to emulate.
   \todo Explain about how DTB works.
   \todo Give a command line example to run qemu (without anita).

Removed from v.1.10  
changed lines
  Added in v.1.103
