最新 追記

ここに日記はありません


Friday 02 December, 2016 [長年日記] この日を編集

_ [BSD][RasPi] RaspberryPiでFreeBSDを動かす。(4)

前回から2年以上経ってしまい、Raspberry Piも新しいモデルに切り替わった。ただ上手くいかないままでもすっきりしないのでとりあえずやり直してみた。まずは手元にあるもので一番初期型のRaspberry Pi Type BでFreeBSDを動かしてみる。Raspberry Pi向けのFreeBSDについてはRaspBSDというプロジェクトが動いている。そのサイトからFreeBSD-armv6-12.0-RPI-B-307523.img.gzをダウンロードして8GBのSDメモリに書き込んだ。前回はディスプレイに映らなかったの今回はシリアルコンソールを使えるようにした。電源を入れると特に問題もなく起動したようで
FreeBSD/arm (raspberry-pi) (ttyu0)
 
login:
とpromptが出てきた。rootでloginできてpasswordはかかっていない。 起動時のdmesgは
Copyright (c) 1992-2016 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.0-CURRENT #0 r307523: Mon Oct 17 09:41:23 MDT 2016
    brd@hive.raspbsd.org:/usr/local/raspbsd/obj/RPI-B/obj/arm.armv6/usr/local/raspbsd/src/common/sys/RPI-B arm
FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0)
WARNING: WITNESS option enabled, expect reduced performance.
VT: init without driver.
sema_sysinit
CPU: ARM ARM1176 r0p7 (ECO: 0x00000000)
CPU Features:
  Thumb, Security, VMSAv7
Optional instructions:
  UMULL, SMULL, MLA, SIMD(ext)
  16KB/32B 4-way instruction cache
  16KB/32B 4-way WB data cache
real memory  = 503312384 (479 MB)
avail memory = 477282304 (455 MB)
random: entropy device external interface
kbd0 at kbdmux0
ofwbus0: <Open Firmware Device Tree>
simplebus0: <Flattened device tree simple bus> mem 0x20000000-0x20ffffff on ofwbus0
intc0: <BCM2835 Interrupt Controller> mem 0xb200-0xb3ff on simplebus0
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
bcm2835_cpufreq0: <CPU Frequency Control> on cpu0
systimer0: <BCM2835 System Timer> mem 0x3000-0x3fff irq 0,1,2,3 on simplebus0
Event timer "BCM2835-3" frequency 1000000 Hz quality 1000
Timecounter "BCM2835-3" frequency 1000000 Hz quality 1000
bcmwd0: <BCM2708/2835 Watchdog> mem 0x10001c-0x100027 on simplebus0
gpio0: <BCM2708/2835 GPIO controller> mem 0x200000-0x2000af irq 5,6,7,8 on simplebus0
gpio0: read-only pins: 46-53.
gpio0: reserved pins: 48-53.
gpiobus0: <OFW GPIO bus> on gpio0
gpioled0: <GPIO led> at pin 16 on gpiobus0
gpioc0: <GPIO controller> on gpio0
bcmrng0: <Broadcom BCM2835 RNG> mem 0x104000-0x10401f irq 9 on simplebus0
iichb0: <BCM2708/2835 BSC controller> mem 0x205000-0x20501f irq 10 on simplebus0iicbus0: <OFW I2C bus> on iichb0
iicbus0: <OFW I2C bus> on iichb0
iic0: <I2C generic I/O> on iicbus0
iichb1: <BCM2708/2835 BSC controller> mem 0x804000-0x80401f irq 11 on simplebus0iicbus1: <OFW I2C bus> on iichb1
iic1: <I2C generic I/O> on iicbus1
spi0: <BCM2708/2835 SPI controller> mem 0x204000-0x20401f irq 12 on simplebus0
spibus0: <OFW SPI bus> on spi0
bcm_dma0: <BCM2835 DMA Controller> mem 0x7000-0x7fff,0xe05000-0xe05fff irq 13,14,15,16,17,18,19,20,21,22,23,24,25 on simplebus0
mbox0: <BCM2835 VideoCore Mailbox> mem 0xb880-0xb8bf irq 26 on simplebus0
sdhci_bcm0: <Broadcom 2708 SDHCI controller> mem 0x300000-0x3000ff irq 27 on simplebus0-(33%)
mmc0: <MMC/SD bus> on sdhci_bcm0
uart0: <PrimeCell UART (PL011)> mem 0x201000-0x201fff irq 28 on simplebus0
uart0: console (115200,n,8,1)
vchiq0: <BCM2835 VCHIQ> mem 0xb800-0xb84f irq 29 on simplebus0
vchiq: local ver 8 (min 3), remote ver 8.
pcm0: <VCHIQ audio> on vchiq0
bcm283x_dwcotg0: <DWC OTG 2.0 integrated USB controller (bcm283x)> mem 0x980000-0x99ffff irq 30 on simplebus0
usbus0 on bcm283x_dwcotg0
fb0: <BCM2835 VT framebuffer driver> on ofwbus0
fbd0 on fb0%)
VT: initialize with new VT driver "fb".
fb0: 656x416(656x416@0,0) 24bpp
fb0: fbswap: 1, pitch 1968, base 0x1eaac000, screen_size 818688
cryptosoft0: <software crypto>
Timecounters tick every 1.000 msec
usbus0: 480Mbps High Speed USB v2.0
bcm2835_cpufreq0: ARM 700MHz, Core 250MHz, SDRAM 400MHz, Turbo OFF
ugen0.1: <DWCOTG> at usbus0
uhub0: <DWCOTG OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
mmcsd0: 8GB <SDHC SU08G 1.3 SN 7C94C6A4 MFG 12/2013 by 1 PA> at mmc0 41.6MHz/4bit/65535-block
lock order reversal: (sleepable after non-sleepable)
 1st 0xc2c52c50 bcm2835_audio (vchi_lock) @ /usr/local/raspbsd/src/common/sys/arm/broadcom/bcm2835/bcm2835_audio.c:310
 2nd 0xc08b9300 &state->slot_mutex (&state->slot_mutex) @ /usr/local/raspbsd/src/common/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.c:785
stack backtrace:
WARNING: WITNESS option enabled, expect reduced performance.
Trying to mount root from ufs:/dev/mmcsd0s2a [rw,noatime]...
uhub0: 1 port with 1 removable, self powered
warning: no time-of-day clock registered, system time will not be set accuratelyugen0.2: <vendor 0x0424> at usbus0
uhub1: <vendor 0x0424 product 0x9514, class 9/0, rev 2.00/2.00, addr 2> on usbus0
uhub1: MTT enabled
uhub1: 5 ports with 4 removable, self powered
Growing root partition to fill device
ugen0.3: <vendor 0x0424> at usbus0
smsc0 on uhub1
smsc0: <vendor 0x0424 product 0xec00, rev 2.00/2.00, addr 3> on usbus0
smsc0: chip 0xec00, rev. 0002
miibus0: <MII bus> on smsc0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ue0: <USB Ethernet> on smsc0
ue0: Ethernet address: b8:27:eb:34:da:9f
GEOM_PART: mmcsd0s2 was automatically resized.
  Use `gpart commit mmcsd0s2` to save changes or `gpart undo mmcsd0s2` to revert them.
mmcsd0s2 resized
mmcsd0s2a resized
super-block backups (for fsck_ffs -b #) at:
 1918400, 2397952, 2877504, 3357056, 3836608, 4316160, 4795712, 5275264,
 5754816, 6234368, 6713920, 7193472, 7673024, 8152576, 8632128, 9111680,
 9591232, 10070784, 10550336, 11029888, 11509440, 11988992, 12468544, 12948096,
 13427648, 13907200, 14386752, 14866304, 15345856
/etc/rc: WARNING: hostid: unable to figure out a UUID from DMI data, generating a new one
Setting hostuuid: 6a27b93d-9481-11e6-a203-b827eb34da9f.
Setting hostid: 0x990ad030.
No suitable dump device was found.
Starting file system checks:
/dev/mmcsd0s2a: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/mmcsd0s2a: clean, 1669497 free (185 frags, 208664 blocks, 0.0% fragmentation)
Mounting local filesystems:
random: unblocking device.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
Soft Float compatibility ldconfig path:
Setting hostname: raspberry-pi.
Setting up harvesting: [UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
Feeding entropy: .
smsc0: chip 0xec00, rev. 0002
ue0: link state changed to DOWN
Starting Network: lo0 ue0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
        inet 127.0.0.1 netmask 0xff000000
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80009<RXCSUM,VLAN_MTU,LINKSTATE>
        ether b8:27:eb:34:da:9f
        media: Ethernet autoselect (none)
        status: no carrier
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Starting devd.
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
Generating host.conf.
Waiting 30s for the default route interface: .....(no carrier)
Creating and/or trimming log files.
Clearing /tmp (X related).
Updating motd:.
Mounting late filesystems:.
Configuring vt: blanktime.
Generating RSA host key.
2048 SHA256:vWf3ifDEpNT7QH+Rh3NG+OW1g9x+sTLniAnqaLgFDAs root@raspberry-pi (RSA)
Generating ECDSA host key.
256 SHA256:sh9owtxAmy5Xvah5z0mP/oXCCG3ttxf3tOynPg3RA8Y root@raspberry-pi (ECDSA)Generating ED25519 host key.
256 SHA256:0A9SUQaq0e5NfAF3MgWZrPxPqspwmDbKB2tJRDHxypA root@raspberry-pi (ED25519)
Performing sanity check on sshd configuration.
Starting sshd.
Starting background file system checks in 60 seconds.
[: =: unexpected operator
[: =: unexpected operator
lock order reversal:
 1st 0xc2efc934 ufs (ufs) @ /usr/local/raspbsd/src/common/sys/kern/vfs_subr.c:2592
 2nd 0xcc716710 bufwait (bufwait) @ /usr/local/raspbsd/src/common/sys/ufs/ffs/ffs_vnops.c:276
 3rd 0xc318d034 ufs (ufs) @ /usr/local/raspbsd/src/common/sys/kern/vfs_subr.c:2592
stack backtrace:
mount: /dev/mmcsd0s2a: Device busy
 
Mon Oct 17 15:52:17 UTC 2016
となった。 /etc/rc.conf
# cat /etc/rc.conf
hostname="raspberry-pi"
ifconfig_ue0="DHCP"
sshd_enable="YES"
 
# Nice if you have a network, else annoying.
#ntpd_enable="YES"
ntpd_sync_on_start="YES"
 
#devd is necessary for proper DHCP operation;
# don't disable unless you know how to run DHCP manually.
#devd_enable="NO"
 
# Turn off a lot of standard stuff
# for more free memory.
cron_enable="NO"
syslogd_enable="NO"
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
# On first boot, enlarge the root filesystem to fill the SD card
growfs_enable="YES"
となっており、defaultではsshdが起動してEthernetはDHCPでアドレスを取得するだけの最低限の設定でcronやsyslogdでさえ動かしていない。最後の行ではfilesystemをSDカードの容量いっぱいまで広げるように設定されており、起動後はコメントアウトしても構わない。

Saturday 03 December, 2016 [長年日記] この日を編集

_ [BSD][RasPi] RaspberryPiでFreeBSDを動かす。(5) - Wi-Fiの設定 -

とりあえずRaspberry Pi Type BでFreeBSDが動きそうなのが確認できたので次にネットワークの接続をした。有線LANならケーブルを差し込むだけでDHCPでアドレスを取得してくれるが、取り回しが面倒なので無線LANを設定する。Raspberry Pi向けの公式のLinux distributionであるRasbianで使えるということでPLANEXのGW-USNANO2Aを用意してあったのでUSBポートに挿して起動してみた。とりあえず/dev/urtwn0と認識されたがそのままでは使えない。調べてみるとこの無線LANアダプタに使われているrealtekのチップのドライバについてそのLicenseを承認しないといけないようだ。 Licenseに問題がないようであればまずは/boot/loader.conf
legal.realtek.license_ack=1
if_urtwn_load="YES"
を追記する。再起動した後に
ifconfig wlan0 create wlandev urtwn0
と打ち込んで問題なければ通常の無線LANと同じように/etc/rc.conf
wlans_urtwn0="wlan0"
ifconfig_wlan0="WPA DHCP"
/etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
eapol_version=2
ap_scan=1
fast_reauth=1
#
network={
        ssid="YourSSID"
        psk="YourPASSPHRASE"
        priority=5
}
を追加することで無線LANで接続してDHCPでアドレスを取得することができる。 このあたりのことは以下のサイトを参考にした。 https://www.amazon.co.jp/dp/B00ESA34GA

ENOTECA Online(ワイン通販 エノテカ・オンライン) 29980円パソコン工房
リンクシェア アフィリエイト紹介プログラム