「FreeBSDをRaspberry Piにインストールする」の版間の差分

提供: 自作パソコン入門
移動: 案内検索
(ページの作成:「「FreeBSDをRaspberry Piにインストールする方法」をまとめました。 '''読み方''' ;FreeBSD:ふりーびーえすでぃー __TOC__ == 概要 ==...」)
 
 
行164: 行164:
 
ifconfig_ue0="inet 192.168.0.100/24"
 
ifconfig_ue0="inet 192.168.0.100/24"
 
defaultrouter="192.168.0.1"
 
defaultrouter="192.168.0.1"
 +
</syntaxhighlight>
 +
==== タイムゾーンの設定 ====
 +
'''タイムゾーン'''を UTC から '''JST''' に変更します。
 +
<syntaxhighlight lang="bash">
 +
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
 
</syntaxhighlight>
 
</syntaxhighlight>
 
== 関連項目 ==
 
== 関連項目 ==

2015年12月3日 (木) 00:36時点における最新版

「FreeBSDをRaspberry Piにインストールする方法」をまとめました。

読み方

FreeBSD
ふりーびーえすでぃー

概要

小型のコンピュータ Raspberry Piに FreeBSDをインストールしました。

環境

今回、対象としている環境は、

Raspberry Pi Type B 512MB

です。 Pi2 じゃありません。

用意した道具

FreeBSDの動作環境として、下記の機器を用意しました。

イメージのインストール

FreeBSDのOSイメージをダウンロードしました。イメージファイルは、Unix でお馴染みの dd コマンド(でぃーでぃー)でSDメモリーカードに書き込みます。

書き込みに必要なハードウェア

SDメモリーカードにイメージを書き込むために、SDメモリーカードライター(USB カードリーダー)が必要です。

ノートパソコンには、よく カードリーダーが搭載されているので、それを利用することもできます。 Mac mini などにも SDXCカードスロットがついているモデルがあります。

xzファイルのイメージを解凍する方法

FreeBSDのサイトからダウンロードしたファイルは、 zx のファイルです。 もし、Windows で扱うなら 7-Zip などを利用して、解凍します。

イメージをSDメモリーカードに書き込む方法

書き込む方法は、いろいろありますが、 Windows の環境であれば、 DD for Windows などを利用します。 http://www.si-linux.co.jp/techinfo/index.php?DD%20for%20Windows

書き込み先の SDメモリーカードを指定し、イメージ(img)ファイルを指定し、書き込みをクリックするだけで、FreeBSDのイメージを書き込むことができます。

動いたBSD、動かないBSD

FreeBSD-10.2-RELEASE-arm-armv6-RPI-B.imgは動かなかった

FreeBSD 10.2-RELEASE-arm-armv6-RPI-B のイメージは、動作しませんでした。

こんな画面が表示されて、為す術もなく。まさに、「ただの屍のようだ。。。」という感じでした。

In: setrial
Out: lcd
Err: lcd
mbox: Timeout waiting for response
bcm2835: could not set usb power state
Net: Net Initialization Skipped
No thernet found.
** Unrecognized filesystem type **
Hit any key to stop aubotoot: 0
Booting from: mmc 0 ubldr
** Unrecognized filesystem type **
U-Boot>

FreeBSD-11.0-CURRENT-arm-armv6-RPI-B-2015....

10.2-RELEASEが動作しなかったため、 FreeBSD-11.0-CURRENTのイメージを下記サイトからダウンロードしました。 ftp://ftp.freebsd.org/pub/FreeBSD/snapshots/arm/armv6/ISO-IMAGES/11.0

freebsd@rpi-b:~ % uname -a
FreeBSD rpi-b 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r291085: Fri Nov 20
06:51:51 UTC 2015
root@releng2.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/RPI-B  arm

はじめから用意されているアカウント

はじめから用意されているアカウントは、ジョーアカウントです。

  • ユーザ名: root, パスワード: root
  • ユーザ名: freebsd, パスワード: freebsd

sshd ははじめから動作している

リモートログイン用のセキュアシェルのデーモン sshd は最初から動作しています。

ログインした画面

FreeBSD 11.0-CURRENT (RPI-B) #0 r291085: Fri Nov 20 06:51:51 UTC 2015
 
Welcome to FreeBSD!
 
Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
FreeBSD Forums:        https://forums.FreeBSD.org/
 
Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.
 
Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier
 
Edit /etc/motd to change this login announcement.
"man hier" will explain the way FreeBSD filesystems are normally laid out.
                -- David Scheidt <dscheidt@tumbolia.com>
freebsd@rpi-b:~ %

動作しているプロセス

last pid:   700;  load averages:  0.05,  0.06,  0.08    up 0+00:14:56  07:15:52
15 processes:  1 running, 14 sleeping
CPU:  0.0% user,  0.0% nice,  0.8% system,  0.8% interrupt, 98.4% idle
Mem: 15M Active, 9820K Inact, 19M Wired, 4216K Buf, 417M Free
Swap:
 
  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
  700 freebsd       1  40    0  7544K  3104K RUN      0:00   0.65% top
  684 freebsd       1  40    0 15100K  6828K select   0:00   0.07% sshd
  418 root          1  40    0  6212K  2300K select   0:00   0.01% syslogd
  681 root          1  41    0 15100K  6824K select   0:01   0.00% sshd
  669 root          1   8    0  7196K  2880K wait     0:01   0.00% login
  685 freebsd       1  16    0  7204K  3948K pause    0:00   0.00% csh
  670 freebsd       1  40    0  7204K  3816K ttyin    0:00   0.00% csh
  608 root          1   8    0  6284K  2368K nanslp   0:00   0.00% cron
  655 root          1  40    0  6200K  1952K ttyin    0:00   0.00% getty
  604 root          1  40    0 11884K  6200K select   0:00   0.00% sshd
  347 root          1  40    0  7256K  4028K select   0:00   0.00% devd
  517 root          1  55    0  6452K  2092K select   0:00   0.00% casperd
  301 root          1  60    0  6328K  2436K select   0:00   0.00% dhclient
  516 root          1  54    0  6452K  1948K select   0:00   0.00% casperd
  346 _dhcp         1  45    0  6328K  2580K select   0:00   0.00% dhclient

セットアップ

pkg のインストール

pkg コマンドが入っていないので、インストールします。

root@rpi-b:/home/freebsd # pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:11:armv6/latest, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
Installing pkg-1.6.2...
Extracting pkg-1.6.2: 100%
Message from pkg-1.6.2:
If you are upgrading from the old package format, first run:
 
  # pkg2ng
pkg: not enough arguments
Usage: pkg [-v] [-d] [-l] [-N] [-j <jail name or id>|-c <chroot path>|-r <rootdir>] [-C <configuration file>] [-R <repo config dir>] [-o var=value] [-4|-6] <command> [<args>]
 
For more information on available commands and options see 'pkg help'.

パッケージのインストール

pkg install sudo tmux vim wget curl zsh

ネットワーク設定

デフォルトの設定 rc.conf

hostname="rpi-b"
sshd_enable="YES"
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
growfs_enable="YES"

rc.conf

IPアドレスを固定にしたいので、下記の設定を追加します。

# ifconfig_DEFAULT="DHCP" は消す
ifconfig_ue0="inet 192.168.0.100/24"
defaultrouter="192.168.0.1"

タイムゾーンの設定

タイムゾーンを UTC から JST に変更します。

cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

関連項目