LoginSignup
12

More than 5 years have passed since last update.

Raspberry Pi に ArchARM をインストールする

Last updated at Posted at 2015-02-07

概要

Raspberry Pi 2 も出たことですし Raspberry Pi に ArchARM を入れてみようと思いました(ぇ

作業環境

MacOS 10.10.2 (Yosemite)
Raspberry Pi typeB (memory 512MB)

作業内容

sd カードに img を焼く

Mac 上でまずは SD カードを認識させます。
そして umount しておきます。
このへんは環境毎に異なると思いますので df コマンド等で確認してもらえれば大丈夫です。

  • umount する
$ diskutil unmount /dev/disk2s1
  • dd でイメージを焼きます

(ちなみに img は http://downloads.raspberrypi.org/arch/images/arch-2014-06-22/ ここから取得。)

disk2s1 であれば rdisk2。

$ sudo dd bs=1m if=ArchLinuxARM-2014.06-rpi.img of=/dev/rdisk2

これで SD カードの準備は完了です。
raspberry pi に挿しましょう。

初期セットアップ

  • まずはおもむろに起動します

ssh ログインは ユーザ:root, password:root が初期設定です。
IP は dhcp で付与されていると思いますので探してください。

  • mirrorサーバの設定

場所が遠いと途中で失敗することがあるので台湾にでもしておきましょう。

/etc/pacman.d/mirrorlist
- Server = http://mirror.archlinuxarm.org/$arch/$repo
+ # Server = http://mirror.archlinuxarm.org/$arch/$repo

- # Server = http://tw.mirror.archlinuxarm.org/$arch/$repo
+ Server = http://tw.mirror.archlinuxarm.org/$arch/$repo

こんな感じで。

  • pacman でアップデートします
# pacman -Syu

ここまでで一旦 reboot します。
そして reboot 後、ファイルシステムが ro な事象が発生しました。。
pacman -Syu とか出来ない悲しい事態。

  • ファイルシステムが ro な問題をなおす

ここが ro なので

# mount -l
/dev/mmcblk0p5 on / type ext4 (ro,relatime,data=ordered)

下記ファイルを編集します。(root= に rw を追加)

/boot/cmdline.txt
- ipv6.disable=1 avoid_safe_mode=1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p5 rootfstype=ext4 elevator=noop rootwait

+ ipv6.disable=1 avoid_safe_mode=1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p5 rw rootfstype=ext4 elevator=noop rootwait

ここで reboot します。

mount -l で確認します。

/dev/mmcblk0p5 on / type ext4 (rw,relatime,data=ordered)

rw が付いていれば OK です。

  • pacman DB を update しておきます
# pacman-db-upgrade
  • 必要なパッケージを入れてみましょう とりあえず vim でも。
# pacman -S vim

wifi で通信できるようにする

USB の無線ドングルがあることが前提になります。
まずは Raspberry Pi にドングルを挿しましょう。

  • wireless_tools をインストールする
# pacman -S wireless_tools
  • wifi-menu で設定していく

wifi-menu コマンドで wlan0 は up になります。

# wifi-menu

接続したい AP 名を選びパスフレーズを入力すれば接続できます。
もし接続が出来ない場合は wlan0 を down して wifi-menu で再接続を試しましょう。
コマンドは下記です。

  • wlan0 を up/down してみる
# ip link set wlan0 up
# ip link set wlan0 down

ifconfig, ip addr show 等で認識されていることを確認しましょう。
再起動しても wlan0 が起動してくるように下記を設定しておきます。

netctl enable wlan0-SSID

今回は _ という SSID のため

[root@alarmpi ~]# netctl enable wlan0-_
ln -s '/etc/systemd/system/netctl@wlan0\x2d_.service' '/etc/systemd/system/multi-user.target.wants/netctl@wlan0\x2d_.service'

となります。

最後に wlan0 に付与されている IP で ssh 接続ができれば OK です。

/ の容量を拡張する

ArchARM では容量の大きい SD カードを挿していても 2GB で認識されてしまいます。これを実際の容量に拡張したいと思います。

拡張前は下記。

[root@alarmpi ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.7G  790M  751M  52% /
devtmpfs        213M     0  213M   0% /dev
tmpfs           217M     0  217M   0% /dev/shm
tmpfs           217M  300K  217M   1% /run
tmpfs           217M     0  217M   0% /sys/fs/cgroup
tmpfs           217M     0  217M   0% /tmp
/dev/mmcblk0p1   90M   23M   68M  25% /boot
tmpfs            44M     0   44M   0% /run/user/0
  • 拡張のための作業をする
[root@alarmpi ~]# fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x417ee54b

Device         Boot  Start     End Sectors  Size Id Type
/dev/mmcblk0p1        2048  186367  184320   90M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      186368 3667967 3481600  1.7G  5 Extended
/dev/mmcblk0p5      188416 3667967 3479552  1.7G 83 Linux

Command (m for help): d
Partition number (1,2,5, default 5): 2

Partition 2 has been deleted.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): e
Partition number (2-4, default 2):
First sector (186368-62333951, default 186368):
Last sector, +sectors or +size{K,M,G,T,P} (186368-62333951, default 62333951):

Created a new partition 2 of type 'Extended' and of size 29.6 GiB.

Command (m for help): d
Partition number (1,2,5, default 5): 5

Partition 5 has been deleted.

Command (m for help): n
Partition type
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): l

Adding logical partition 5
First sector (188416-62333951, default 188416):
Last sector, +sectors or +size{K,M,G,T,P} (188416-62333951, default 62333951):

Created a new partition 5 of type 'Linux' and of size 29.6 GiB.

Command (m for help): p
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x417ee54b

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        2048   186367   184320   90M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      186368 62333951 62147584 29.6G  5 Extended
/dev/mmcblk0p5      188416 62333951 62145536 29.6G 83 Linux

Command (m for help): w

ここまで行い、reboot します。

  • resize2fs をします
[root@alarmpi ~]# resize2fs /dev/mmcblk0p5
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/mmcblk0p5 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/mmcblk0p5 is now 7768192 (4k) blocks long.
[root@alarmpi ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        30G  792M   28G   3% /
devtmpfs        213M     0  213M   0% /dev
tmpfs           217M     0  217M   0% /dev/shm
tmpfs           217M  300K  217M   1% /run
tmpfs           217M     0  217M   0% /sys/fs/cgroup
tmpfs           217M     0  217M   0% /tmp
/dev/mmcblk0p1   90M   23M   68M  25% /boot
tmpfs            44M     0   44M   0% /run/user/0

認識されましたね。よさそうです。

時刻の設定

  • ntp をインストールします
# pacman -S ntp
# systemctl enable ntpd.service
  • timezone を JST へ
# timedatectl set-timezone Asia/Tokyo

ここまででとりあえず使える状態になったと思うので、初期セットアップ完了です。

さて、何しようかな。

-完-

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12