元記事

https://wiki.ubuntu.com/ARM/RaspberryPi

Installation

Installation is the same as other Raspberry Pi images; a generic installation guide from raspberrypi.org is available here.

For example:
今回は、DD for windowsでイメージをコピー
xzcat ubuntu.img.xz | sudo dd bs=4M of=/dev/mmcblk0
Or using ddrescue (must decompress the image first):

unxz ubuntu.img.xz
sudo ddrescue -D -d --force ubuntu.img /dev/mmcblk0
Optional PPAs
While the official image includes compatible firmware, bootloader and kernel, there are a few packages available in an unofficial PPA (ppa:ubuntu-raspi2/ppa) which are useful on the Raspberry Pi, including:

Tips

ホスト名 ubuntuを正引きする際にタイムアウト(時間がかかるにで)まで待ってしまうので、
/etc/hostsに以下を追加する。
127.0.0.1 ubuntu

重要(これをやらないと、apt-get upgradeを実行したあとに起動しなくなる。)

*However, the Raspberry Pi has its own built in bootloader. This can be used with a few changes to the config.txt file on the system-boot partition: *
u-bootは使わずvmlinuzを使う
sudo vi /boot/firmware/config.txt
kernel=vmlinuz
initramfs initrd.img followkernel
#device_tree_address=0x02000000

Note
the change to the kernel line, the addition of the initramfs line, and the commenting out (#) of the device_tree_address line.

All that remains is to copy bcm2710-rpi-3-b.dtb (plus the overlay folder if needed) from /lib/firmware/4.4.0-1065-raspi2/device-tree to the system-boot partition.

この後、rebootで再起動することを確認する。
次に
sudo apt-get update
sudo apt-get upgrade
E: Could not get lock /var/lib/dpkg/lock - open (11:
Resource temporarily unavailable)
E: Unable to lock the administration directory
(/var/lib/dpkg/), is another process using it?
/var/lib/dpkg/lockを開いているプロセスを確認する。

sudo lsof /var/lib/dpkg/lock
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF  NODE NAME
unattende 1153 root    5uW  REG  179,2        0 41402 
/var/lib/dpkg/lock
unattemde<--自動更新用のプロセスが/var/lib/dpkg/lockを開いていた
これをuninstall 
sudo apt-get remove update-manager
E: dpkg was interrupted, you must manually run 'sudo 
dpkg --configure -a' to correct the problem.
`sudo dpkg --configure -a`

apt-get upgrade後にreboot
無事成功

ROS Kineticnをインストール

http://wiki.ros.org/kinetic/Installation/Ubuntu

Desktop

デスクトップをインストールする。
sudo apt install ubuntu-desktop gnome-session-flashback xserver-xorg-video-fbturbo dphys-swapfile

Then add this to /etc/X11/xorg.conf (create if it doesn't already exist):
以下の内容でxorg.confを作成する。

Section "Device"
    Identifier "Raspberry Pi FBDEV"
    Driver "fbturbo"
    Option "fbdev" "/dev/fb0"
    Option "SwapbuffersWait" "true"
EndSection

Install libraspberrypi-bin libraspberrypi-dev

sudo add-apt-repository ppa:ubuntu-raspi2/ppa
https://wiki.ubuntu.com/ARM/RaspberryPi

Optional PPA for Raspberry Pi 2/3 installations.
More info: https://launchpad.net/~ubuntu-raspi2/+archive/ubuntu/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmpe3iizixs/secring.gpg' created
gpg: keyring `/tmp/tmpe3iizixs/pubring.gpg' created
gpg: requesting key 8CBCF2F2 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpe3iizixs/trustdb.gpg: trustdb created
gpg: key 8CBCF2F2: public key "Launchpad PPA for Raspberry Pi 2 Ubuntu" 
imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
sudo apt-get update

sudo apt-get install libraspberrypi-bin libraspberrypi-dev
sudo ln -s /usr /opt/vc

However, since these packages are compiled from source during build, the files are installed in their "proper" locations in /usr. Some third-party scripts may expect e.g. /opt/vc/bin/vcgencmd; if so, this hack should do it:

Wifi wlan0が認識されない

ここを参照させてもらったが、URLが変わっていたので以下の通り。
uname -a
Linux ubuntu 4.4.0-1086-raspi2 #94-Ubuntu SMP Wed Mar 14 09:29:41 UTC 2018 armv7l armv7l armv7l GNU/Linux

cd /lib/firmware/brcm/
sudo wget https://github.com/RPi-Distro/firmware-nonfree/blob/master/brcm/brcmfmac43430- sdio.bin
sudo wget https://github.com/RPi-Distro/firmware-nonfree/blob/master/brcm/brcmfmac43430- sdio.bin
sudo reboot
ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:4c:44:e2
          inet addr:192.168.11.13  Bcast:192.168.11.255  Mask:255.255.255.0
          inet6 addr: fe80::e47b:2c82:3bc1:4755/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22 errors:0 dropped:0 overruns:0 frame:0
          TX packets:41 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4123 (4.1 KB)  TX bytes:5843 (5.8 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:165 errors:0 dropped:0 overruns:0 frame:0
          TX packets:165 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:12085 (12.0 KB)  TX bytes:12085 (12.0 KB)

認識されない??
ここからリンクをたどって
ここへhttps://www.raspberrypi.org/forums/viewtopic.php?f=28&t=141834#p1152584
でもってここからhttps://github.com/DougieLawson/RaspberryPi/tree/master/brcm
brcm.7zをダウンロードして解凍して

このディレクトリにあるファイルを
https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm 
sudo cp brcm*.* /lib/firmware/brcm/
sudo reboot

eth0 Link encap:Ethernet HWaddr b8:27:eb:4c:44:e2
inet addr:192.168.11.13 Bcast:192.168.11.255 Mask:255.255.255.0
inet6 addr: fe80::e47b:2c82:3bc1:4755/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:161 errors:0 dropped:0 overruns:0 frame:0
TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24125 (24.1 KB) TX bytes:7037 (7.0 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:165 errors:0 dropped:0 overruns:0 frame:0
          TX packets:165 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:12085 (12.0 KB)  TX bytes:12085 (12.0 KB)

wlan0     Link encap:Ethernet  HWaddr b8:27:eb:19:11:b7
          inet addr:192.168.11.11  Bcast:192.168.11.255  Mask:255.255.255.0
          inet6 addr: fe80::ba27:ebff:fe19:11b7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:527 errors:0 dropped:7 overruns:0 frame:0
          TX packets:445 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
         RX bytes:163766 (163.7 KB)  TX bytes:106717 (106.7 KB)

wlan0が認識された。
https://wiki.debian.org/WiFi/HowToUse#GNOME
とりあえず、ここまでで。

これらは後でインストールする

libraspberrypi-bin

libraspberrypi-bin - VideoCore utilities from https://github.com/raspberrypi/userland such as vcgencmd, raspistill, etc.

libraspberrypi-bin-nonfree

libraspberrypi-bin-nonfree - Binary VideoCore utilities not provided in the open source userland repository, currently vcdbg and edidparser.

xserver-xorg-video-fbturbo

xserver-xorg-video-fbturbo - An accelerated x.org video driver, though this is limited to hardware accelerated window moving/scrolling on the Raspberry Pi.

xserver-xorg-video-fbturbo

hello-dkms - Not strictly to do with the Raspberry Pi, but a small example DKMS project to test building kernel DKMS modules.

To install:

$ sudo apt-get install libraspberrypi-bin-nonfree
Booting the official Pi 2 image on the Pi 3
The official Ubuntu images use u-boot as the bootloader. The u-boot binary built for the Pi 2 does not work on the Pi 3. This is why there are separate images for the Pi 2 and Pi 3.

Once booted, you'll need to either uninstall the flash-kernel package, or upgrade the flash-kernel and u-boot packages from ppa:ubuntu-raspi2/ppa-rpi3.

If you've chosen to uninstall the flash-kernel package then you'll need to manually copy across the kernel and initrd files when you install a new kernel or update the initramfs. For example (note, the system-boot partition is mounted at /boot/firmware):

sudo cp /boot/vmlinuz /boot/firmware/
sudo cp /boot/initrd.img /boot/firmware/
The latest Pi 3 wifi firmware can be found here.~~

~~USB booting
The Raspberry Pi 3 (and Pi 2 v1.2 with the same BCM2837 SoC as the Pi3) is capable of booting from a USB drive. To do this you'll first need to program USB boot mode.

You must have bootloader files (confusingly referred to as the firmware on the Raspberry Pi) from after April 2017. So grab the latest bootcode.bin, fixup.dat and start.elf files from the GitHub repository and copy them to your system-boot partition.

Edit the cmdline.txt file

sudo nano /boot/firmware/cmdline.txt
and change root=/dev/mmcblk0p2 to root=LABEL=cloudimg-rootf

If you are using a lot of drives then you may wish to switch to using the UUID of the partition.~~

Cross-upgrading 14.04 to 16.04
You can upgrade an old unofficial 14.04 installation to the official 16.04 installation, though it takes a number of additional steps.

Note that Ubuntu's setup uses u-boot as an intermediary bootloader, which is different from the previous system of the RPI2 booting the kernel directly. This will be reflected in the upgrade procedure.

Warning /!\ Once you begin this procedure, if you reboot the installation without completing the entire upgrade procedure, you will be left with an unbootable system. Warning /!\

First, remove a number of PPA packages which are obsoleted / incompatible with the 16.04.

apt-get --purge remove rpi2-ubuntu-errata raspberrypi-bootloader-nokernel \
linux-image-rpi2 flash-kernel
Back up and remove the apt PPA configuration and module blacklists (the latter will be provided directly by the 4.4.0 kernel package).

mkdir -p /root/xenial-upgrade
tar zcvf /root/xenial-upgrade/etc.tar.gz \
/etc/modprobe.d/rpi2.conf \
/lib/modules-load.d/rpi2.conf \
/etc/apt/preferences.d/rpi2-ppa \
/etc/apt/sources.list.d/fo0bar-rpi2* \
/etc/apt/trusted.gpg.d/fo0bar-rpi2*
rm -f \
/etc/modprobe.d/rpi2.conf \
/lib/modules-load.d/rpi2.conf \
/etc/apt/preferences.d/rpi2-ppa \
/etc/apt/sources.list.d/fo0bar-rpi2* \
/etc/apt/trusted.gpg.d/fo0bar-rpi2*
Back up and remove the contents of /boot/firmware, which will be recreated.

tar zcvf /root/xenial-upgrade/firmware.tar.gz /boot/firmware/*
rm -rf /boot/firmware/*
Update apt sources without the old PPA configuration.

apt-get update
Run do-release-upgrade as normal. When asked to reboot at the end, do not, and select "n" instead.

do-release-upgrade -d

-d will be unneeded once 16.04.1 is released

Install new firmware, u-boot and 4.4.0 kernel metapackages.

apt-get install u-boot-rpi u-boot-tools linux-raspi2 linux-firmware-raspi2 \
linux-firmware flash-kernel
Install the RPI2 DT-compatible u-boot image.

apt-get install binutils # for "strings"
wget -O /tmp/mkknlimg https://raw.githubusercontent.com/raspberrypi/linux/rpi-4.4.y/scripts/mkknlimg
chmod 0755 /tmp/mkknlimg
/tmp/mkknlimg --dtok /usr/lib/u-boot/rpi_2/u-boot.bin /boot/firmware/uboot.bin
Install basic config.txt and cmdline.txt configurations. If your root device is not on the second SD partition (uncommon) or you have a more advanced configuration, recreate them here.

cat <<"EOM" >/boot/firmware/config.txt
kernel=uboot.bin
dtparam=i2c_arm=on
dtparam=spi=on
EOM

cat <<"EOM" >/boot/firmware/cmdline.txt
net.ifnames=0 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
EOM
Update the initrd and re-flash the kernel configuration.

update-initramfs -u
flash-kernel
Reboot!

reboot
Optionally add ppa:ubuntu-raspi2/ppa as described above.

Ubuntu 14.04 LTS
An Ubuntu 14.04 LTS (Trusty Tahr) image is available for the Raspberry Pi 2, which combines the released 14.04 distribution with a PPA containing kernels and firmware which work on the Raspberry Pi 2.

Warning /!\ This image, along with the one-off kernel it installs, is no longer maintained. Please use the 16.04 Xenial image instead. Warning /!\

Download
Download 2015-04-06-ubuntu-trusty.zip (GPG signature)

152MiB ZIP, 1.75GiB uncompressed image
Login username is "ubuntu", password is "ubuntu"
Raspberry Pi 3 images are not available.
Usage
ROOT RESIZE
There are no Raspbian-specific utilities included, specifically no automatic root resizer. However, it's not hard to do manually. Once booted:

$ sudo fdisk /dev/mmcblk0
Delete the second partition (d, 2), then re-create it using the defaults (n, p, 2, enter, enter), then write and exit (w). Reboot the system, then:

$ sudo resize2fs /dev/mmcblk0p2
SWAP
There is no swap partition/file included. If you want swap, it's recommended you do:

$ sudo apt-get install dphys-swapfile
You should have a (resized) SD card at least 4GB, because by default it will want to create a ~2GB swapfile.

WIFI FIRMWARE
If you are using a wifi dongle, you will likely need to get the linux-firmware package:

$ sudo apt-get install linux-firmware
SSH SERVER
If you would like to install an SSH server for remote access:

$ sudo apt-get install openssh-server
SERIAL CONSOLE
To enable the serial console, change the /boot/cmdline.txt as follows:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootwait
and add a new file /etc/init/ttyAMA0.conf:

start on stopped rc or RUNLEVEL=[12345]
stop on runlevel [!12345]

respawn
exec /sbin/getty -L 115200 ttyAMA0 vt102
Kernel
The kernel used by the Raspberry Pi 2 port is an Ubuntu-style kernel package of an "rpi2" flavor, e.g. linux-image-3.18.0-20-rpi2. Currently it is comprised of the following functionality:

Mainline 3.18.x
Fork of Ubuntu-3.18.0-14.15 from the ubuntu-vivid git tree

Provides extra functionality such as aufs
Also includes additional stability fixes, many of which have been rolled into mainline post-3.18.7
Raspberry Pi-specific patches from the rpi-3.18.y branch of Raspberry Pi's linux git tree

Ubuntu's 3.18 development is no longer active, as they moved on to 3.19 to be released with 15.04 vivid. However, mainline 3.18 was designated an LTS kernel release, and is still getting active security/stability updates. Because of this, 3.18 will likely remain the "supported" kernel of this port. (Again, this is an unofficial port and no support guarantee is implied.)

Building
The script used to build the images is available here.

If you want to build an image on your x86 Ubuntu host, install qemu-user-static package and edit the script to use "qemu-debootstrap --arch armhf" instead of "debootstrap":

qemu-debootstrap --arch armhf $RELEASE $R http://ports.ubuntu.com/
Links
raspberrypi.org forums thread

Reddit thread

Ryan Finnie original blog announcement

PPAs:
ppa:fo0bar/rpi2 - Stable packages (enabled in the default image)

ppa:fo0bar/rpi2-staging - Staging builds

ppa:fo0bar/rpi2-nightly - Nightly automatic builds of some packages

Ubuntu arm64/AArch64
'arm64' is the Debian port name for the 64-bit ARMv8 architecture, referred to as 'aarch64' in upstream toolchains (GNU triplet aarch64-linux-gnu), and some other distros.

BCM2837 is the chip used in the Raspberry Pi 3 and in later models of the Raspberry Pi 2. It packages a 64-bit quad-core ARM Cortex A53 (ARMv8) CPU with VideoCore IV GPU.

There is a config.txt entry to make the ARM start in 64-mode (otherwise 32-bit mode is used):

arm_control=0x200
(This will fail to boot unless you provide a kernel compiled for 64-bit mode)

64 bit versions of the linux-raspi2 kernels were introduced in Ubuntu 16.10 (Yakkety Yak).

The generic arm64 linux kernels can also be used with a suitable bootloader. For example, the Zesty mini.iso can be booted with a u-boot-UEFI-grub2 combination.

For those curious about what arm64 looks like (spoiler: it looks the same), a community built Lubuntu Live/Desktop iso for the Raspberry Pi 3 can be found online.

ARM/RaspberryPi (last edited 2017-10-10 17:42:40 by adamsmith

Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.