ここしばらくBeagleBone BlackにFreeBSDをインストールすべく、いろいろ試してきた。一応MicroSDのimg作成までたどり着けそうなので、まとめておこう。
crochet.shを使ったimg作成方法が良く作られているので、これを使う。ブラックボックス化されていて、何がされているのかは分かりにくいところはあるが、logも出力されて残るので、詳しく見てみることもできる。make xdev, make buildworld, make installworldとか何やってるのか良く分からないうちは、一連の作業を連続で行えるので、便利ではある。いろいろカスタマイズもできるようになっているみたいだ。
URLは https://github.com/kientzle/crochet-freebsd.git
1.コンパイル環境としてFreeBSD(i386)を用意する。
FreeBSDは10.0Alpha5のi386(32bit)版がよさそう。9.2と10.0ではコンパイラがgcc→clangになっているがBeagleBone用のソースが10.0なんで相性がよさそう。
32bitがいい理由は途中portsパッケージのインストールを要求されるのだが、これが32bitでのコンパイルの方が問題無いからだ。
PC上にVMWarePlayerを用意して、50Gくらいのディスクにインストールする。TeraTermからsshログインできるようにしておいたほうが便利。OSインストールして、ユーザーアカウント登録している所から始める。#はrootでの作業、$はユーザーアカウントでの作業。
# portsnap fetch
# portsnap extract # portsがインストールできるようになる
# cd/usr/ports/security/sudo
# make install clean # sudoのインストール
# visudo # これでユーザーがsudoを実行できるようにしておく
# cd /usr/ports/devel/git
# make install clean # gitのインストール SVNにチェックを入れると
# subversionもインストールされる
portsからgit (subversion含む), sudo をインストールしておく。ソースはユーザーアカウントしておいて、ログインディレクトリ直下に配置し、sudo コマンド使ってrootでコンパイル(crochet.shの実行)をすることになる。
2.chrochet-freebsdの取得
$ cd
$ git clone https://github.com/kientzle/crochet-freebsd.git
3.config.shを用意する
config.sh.sample を参考にconfig.shを用意する。
board_setup BeagleBone
option ImageSize 15900mb # for 16 Gigabyte card
option User brahmint
option SwapFile 768mb
option UsrSrc
FREEBSD_SRC=${TOPDIR}/src
WORKDIR=${TOPDIR}/work
とりあえず、このあたりを設定してみる。
4.crochet.shを実行する
$ sudo /bin/sh crochet.sh -c config.sh
Password:xxx
Starting at Fri Oct 11 15:16:46 JST 2013
Loading configuration from config.sh
Board: BeagleBone
Option: ImageSize 15900mb
Option: User brahmint
Option: SwapFile 768mb
Option: UsrSrc
grep: /usr/home/brahmint/crochet-freebsd/src/sys/conf/newvers.sh: No such file or directory
OS major version is:
Image name is: /usr/home/brahmint/crochet-freebsd/work/FreeBSD-armv6--BEAGLEBONE.img
[: : bad number
[: : bad number
[: : bad number
Object files are at:
This does not look like a FreeBSD source tree.
Did not find: /usr/home/brahmint/crochet-freebsd/src/COPYRIGHT
You can obtain a suitable FreeBSD source tree with the folowing commands:
$ svn co https://svn0.us-west.freebsd.org/base/head /usr/home/brahmint/crochet-freebsd/src
Set $FREEBSD_SRC in config.sh if you have the sources in a different directory.
Run this script again after you have the sources installed.
$
4.srcを用意する
chrochet.shよりソースを読み込めと指示あり。
$ svn co https://svn0.us-west.freebsd.org/base/head /usr/home/brahmint/crochet-freebsd/src
A src/tools
A src/tools/debugscripts
A src/tools/build
・
・ (途中略)
・
A src/games/fortune/README
A src/games/fortune/tools/do_uniq.py
A src/games/fortune/fortune/fortune.c
A src/games/ppt/ppt.c
A src/games/morse/morse.6
U src
Checked out revision 256307.
1時間ほどでチェックアウトが終わる。
5.chrochet.shの再実行
$ sudo /bin/sh crochet.sh -c config.sh
Starting at Fri Oct 11 18:32:41 JST 2013
Loading configuration from config.sh
Board: BeagleBone
Option: ImageSize 15900mb
Option: User brahmint
Option: SwapFile 768mb
Option: UsrSrc
OS major version is: 11
Image name is: /usr/home/brahmint/crochet-freebsd/work/FreeBSD-armv6-11.0-BEAGLEBONE.img
Object files are at:
Found suitable FreeBSD source tree in:
/usr/home/brahmint/crochet-freebsd/src
Please consider installing sysutils/u-boot-beaglebone-eabi port.
That will avoid the need for Crochet to build U-Boot.
Can't find appropriate FreeBSD xdev tools.
If you have FreeBSD-CURRENT sources in /usr/src, you can build these with the following command:
cd /usr/src && sudo make XDEV=arm XDEV_ARCH=armv6 xdev
Run this script again after you have the xdev tools installed.
$
6.クロスコンパイル環境の構築
ログにはthe xdev toolsをインストールしてねという事で
$ cd /usr/src && sudo make XDEV=arm XDEV_ARCH=armv6 xdev
(実行時間1時間38分)
7. U-Boot
ログにはsysutils/u-boot-beaglebone-eabiのportsも入れとけば、crochet.shでのu-bootのビルドは必要ないというこなので、こちらも。
$ cd /usr/ports/sysutils/u-boot-beaglebone-eabi && sudo make install clean
arm-eabi-gcc-4.5.4 とかのインストールがされるので、そこそこ時間は掛かる。
この途中で、gmp-5.1.3のビルド途中でエラーが出る。最後の方のログはこんな感じ。
/bin/sh /usr/ports/math/gmp/work/gnome-libtool --mode=compile --tag=CC ../mpn/m4-ccas --m4="m4" cc -c -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_`echo add_n | sed 's/_$//'` -O2 -pipe -fno-strict-aliasing -Wa,--noexecstack `test -f 'add_n.asm' || echo './'`add_n.asm
gnome-libtool: compile: ../mpn/m4-ccas --m4=m4 cc -c -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_add_n -O2 -pipe -fno-strict-aliasing -Wa,--noexecstack add_n.asm -fPIC -DPIC -o .libs/add_n.o
m4 -DHAVE_CONFIG_H -D__GMP_WITHIN_GMP -DOPERATION_add_n -DPIC add_n.asm >tmp-add_n.s
cc -c -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_add_n -O2 -pipe -fno-strict-aliasing -Wa,--noexecstack tmp-add_n.s -fPIC -DPIC -o .libs/add_n.o
cc: warning: argument unused during compilation: '-D HAVE_CONFIG_H'
cc: warning: argument unused during compilation: '-I .'
cc: warning: argument unused during compilation: '-I ..'
cc: warning: argument unused during compilation: '-D __GMP_WITHIN_GMP'
cc: warning: argument unused during compilation: '-I ..'
cc: warning: argument unused during compilation: '-D OPERATION_add_n'
cc: warning: argument unused during compilation: '-fno-strict-aliasing'
cc: warning: argument unused during compilation: '-fPIC'
cc: warning: argument unused during compilation: '-D PIC'
tmp-add_n.s:76:15: error: expected ']' in brackets expression
ldr r12, [r13, #0]
^
tmp-add_n.s:77:11: error: unexpected token in argument list
stmfd r13!, { r8, r9, r14 }
^
tmp-add_n.s:78:11: error: unknown token in expression
cmp r12, #1
^
tmp-add_n.s:79:2: error: invalid instruction mnemonic 'b'
b .Lent
^
tmp-add_n.s:87:11: error: unexpected token in argument list
stmfd r13!, { r8, r9, r14 }
^
tmp-add_n.s:88:10: error: unknown token in expression
cmn r0, #0
^
tmp-add_n.s:89:16: error: unknown token in expression
.Lent: tst r3, #1
^
tmp-add_n.s:90:2: error: invalid instruction mnemonic 'beq'
beq .Lskip1
^~~
tmp-add_n.s:91:17: error: unknown token in expression
ldr r12, [r1], #4
^
tmp-add_n.s:92:17: error: unknown token in expression
ldr r14, [r2], #4
^
tmp-add_n.s:93:2: error: invalid instruction mnemonic 'adcs'
adcs r12, r12, r14
^~~~
tmp-add_n.s:94:17: error: unknown token in expression
str r12, [r0], #4
^
tmp-add_n.s:96:10: error: unknown token in expression
tst r3, #2
^
tmp-add_n.s:97:2: error: invalid instruction mnemonic 'beq'
beq .Lskip2
^~~
tmp-add_n.s:98:10: error: unexpected token in argument list
ldmia r1!, { r8, r9 }
^
tmp-add_n.s:99:10: error: unexpected token in argument list
ldmia r2!, { r12, r14 }
^
tmp-add_n.s:100:2: error: invalid instruction mnemonic 'adcs'
adcs r8, r8, r12
^~~~
tmp-add_n.s:101:2: error: invalid instruction mnemonic 'adcs'
adcs r9, r9, r14
^~~~
tmp-add_n.s:102:10: error: unexpected token in argument list
stmia r0!, { r8, r9 }
^
tmp-add_n.s:104:15: error: unknown token in expression
bics r3, r3, #3
^
tmp-add_n.s:105:2: error: invalid instruction mnemonic 'beq'
beq .Lrtn
^~~
tmp-add_n.s:106:11: error: unexpected token in argument list
stmfd r13!, { r4, r5, r6, r7 }
^
tmp-add_n.s:108:16: error: unexpected token in argument list
.Ltop: ldmia r1!, { r4, r5, r6, r7 }
^
tmp-add_n.s:109:10: error: unexpected token in argument list
ldmia r2!, { r8, r9, r12, r14 }
^
tmp-add_n.s:110:2: error: invalid instruction mnemonic 'adcs'
adcs r4, r4, r8
^~~~
tmp-add_n.s:111:14: error: unknown token in expression
sub r3, r3, #4
^
tmp-add_n.s:112:2: error: invalid instruction mnemonic 'adcs'
adcs r5, r5, r9
^~~~
tmp-add_n.s:113:2: error: invalid instruction mnemonic 'adcs'
adcs r6, r6, r12
^~~~
tmp-add_n.s:114:2: error: invalid instruction mnemonic 'adcs'
adcs r7, r7, r14
^~~~
tmp-add_n.s:115:10: error: unexpected token in argument list
stmia r0!, { r4, r5, r6, r7 }
^
tmp-add_n.s:116:10: error: unknown token in expression
teq r3, #0
^
tmp-add_n.s:117:2: error: invalid instruction mnemonic 'bne'
bne .Ltop
^~~
tmp-add_n.s:119:11: error: unexpected token in argument list
ldmfd r13!, { r4, r5, r6, r7 }
^
tmp-add_n.s:121:20: error: unknown token in expression
.Lrtn: adc r0, r3, #0
^
tmp-add_n.s:122:11: error: unexpected token in argument list
ldmfd r13!, { r8, r9, r15 }
^
*** [add_n.lo] Error code 1
make[7]: stopped in /usr/ports/math/gmp/work/gmp-5.1.3/mpn
1 error
make[7]: stopped in /usr/ports/math/gmp/work/gmp-5.1.3/mpn
*** [all-recursive] Error code 1
make[6]: stopped in /usr/ports/math/gmp/work/gmp-5.1.3
1 error
make[6]: stopped in /usr/ports/math/gmp/work/gmp-5.1.3
*** [all] Error code 2
make[5]: stopped in /usr/ports/math/gmp/work/gmp-5.1.3
1 error
make[5]: stopped in /usr/ports/math/gmp/work/gmp-5.1.3
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1
Stop.
make[4]: stopped in /usr/ports/math/gmp
*** Error code 1
Stop.
make[3]: stopped in /usr/ports/math/gmp
*** Error code 1
Stop.
make[2]: stopped in /usr/ports/devel/arm-eabi-gcc
*** Error code 1
Stop.
make[1]: stopped in /usr/ports/devel/arm-eabi-gcc
*** Error code 1
Stop.
make: stopped in /usr/ports/sysutils/u-boot-beaglebone-eabi
$
はて、どうしよう。手に余る感じだ。
2013年10月11日金曜日
2013年9月9日月曜日
BeagleBone Black に FreeBSDをインストール 4
さて、 U-boot の続きに移ろう。Gitの使い方も良く分からんのだが、FreeBSDマシンでリポジトリをゲットしてみる。
# mkdir uboot
# cd uboot
# git clone git://arago-project.org/git/projects/u-boot-am33x.git
Cloning into 'u-boot-am33x'...
remote: Counting objects: 194729, done.
remote: Compressing objects: 100% (40345/40345), done.
remote: Total 194729 (delta 156551), reused 189594 (delta 151599)
Receiving objects: 100% (194729/194729), 49.90 MiB | 282.00 KiB/s, done.
Resolving deltas: 100% (156551/156551), done.
Checking connectivity... done
Checking out files: 100% (7448/7448), done.
OK!読み込めた。
ちょっと、ディレクトリ内部を見てみると…
# ls -l
total 4
drwxr-xr-x 21 root wheel 1024 9月 9 06:02 u-boot-am33x
# cd u-boot-am33x
# ls -l
total 524
-rw-r--r-- 1 root wheel 274 9月 9 06:01 .checkpatch.conf
drwxr-xr-x 8 root wheel 512 9月 9 06:02 .git
-rw-r--r-- 1 root wheel 799 9月 9 06:01 .gitignore
-rw-r--r-- 1 root wheel 16398 9月 9 06:01 COPYING
-rw-r--r-- 1 root wheel 12200 9月 9 06:01 CREDITS
-rw-r--r-- 1 root wheel 25370 9月 9 06:01 MAINTAINERS
-rwxr-xr-x 1 root wheel 21003 9月 9 06:01 MAKEALL
-rw-r--r-- 1 root wheel 27807 9月 9 06:01 Makefile
-rw-r--r-- 1 root wheel 179855 9月 9 06:01 README
drwxr-xr-x 2 root wheel 512 9月 9 06:01 api
drwxr-xr-x 16 root wheel 512 9月 9 06:01 arch
drwxr-xr-x 290 root wheel 5120 9月 9 06:01 board
-rw-r--r-- 1 root wheel 116414 9月 9 06:01 boards.cfg
drwxr-xr-x 3 root wheel 3584 9月 9 06:01 common
-rw-r--r-- 1 root wheel 10680 9月 9 06:01 config.mk
drwxr-xr-x 2 root wheel 512 9月 9 06:01 disk
drwxr-xr-x 7 root wheel 3072 9月 9 06:01 doc
drwxr-xr-x 28 root wheel 512 9月 9 06:01 drivers
drwxr-xr-x 2 root wheel 512 9月 9 06:01 dts
drwxr-xr-x 4 root wheel 512 9月 9 06:01 examples
drwxr-xr-x 11 root wheel 512 9月 9 06:01 fs
drwxr-xr-x 18 root wheel 5632 9月 9 06:02 include
drwxr-xr-x 7 root wheel 1024 9月 9 06:02 lib
-rwxr-xr-x 1 root wheel 4512 9月 9 06:02 mkconfig
drwxr-xr-x 3 root wheel 512 9月 9 06:02 nand_spl
drwxr-xr-x 2 root wheel 512 9月 9 06:02 net
drwxr-xr-x 6 root wheel 512 9月 9 06:02 post
-rw-r--r-- 1 root wheel 2487 9月 9 06:02 rules.mk
-rw-r--r-- 1 root wheel 17 9月 9 06:02 snapshot.commit
drwxr-xr-x 2 root wheel 512 9月 9 06:02 spl
drwxr-xr-x 2 root wheel 512 9月 9 06:02 test
drwxr-xr-x 12 root wheel 1536 9月 9 06:02 tools
とまあ、こんな感じ。
Gitの方が、Subversionより使い易い様な感じがする。現在はSubversionを使っているけど、履歴を残す+サーバーにバックアップするという感覚で使っている。使用者が自分一人だけなんで面倒が少ないけど、グループで開発とかになったら、また別の問題も発生するんだろうな。Subversionを仕事で初めて使いたてのときには、結構updateせずにcommitして、他の人の変更箇所を無視してしまったりという間違いをしていたしなあw
# mkdir uboot
# cd uboot
# git clone git://arago-project.org/git/projects/u-boot-am33x.git
Cloning into 'u-boot-am33x'...
remote: Counting objects: 194729, done.
remote: Compressing objects: 100% (40345/40345), done.
remote: Total 194729 (delta 156551), reused 189594 (delta 151599)
Receiving objects: 100% (194729/194729), 49.90 MiB | 282.00 KiB/s, done.
Resolving deltas: 100% (156551/156551), done.
Checking connectivity... done
Checking out files: 100% (7448/7448), done.
OK!読み込めた。
ちょっと、ディレクトリ内部を見てみると…
# ls -l
total 4
drwxr-xr-x 21 root wheel 1024 9月 9 06:02 u-boot-am33x
# cd u-boot-am33x
# ls -l
total 524
-rw-r--r-- 1 root wheel 274 9月 9 06:01 .checkpatch.conf
drwxr-xr-x 8 root wheel 512 9月 9 06:02 .git
-rw-r--r-- 1 root wheel 799 9月 9 06:01 .gitignore
-rw-r--r-- 1 root wheel 16398 9月 9 06:01 COPYING
-rw-r--r-- 1 root wheel 12200 9月 9 06:01 CREDITS
-rw-r--r-- 1 root wheel 25370 9月 9 06:01 MAINTAINERS
-rwxr-xr-x 1 root wheel 21003 9月 9 06:01 MAKEALL
-rw-r--r-- 1 root wheel 27807 9月 9 06:01 Makefile
-rw-r--r-- 1 root wheel 179855 9月 9 06:01 README
drwxr-xr-x 2 root wheel 512 9月 9 06:01 api
drwxr-xr-x 16 root wheel 512 9月 9 06:01 arch
drwxr-xr-x 290 root wheel 5120 9月 9 06:01 board
-rw-r--r-- 1 root wheel 116414 9月 9 06:01 boards.cfg
drwxr-xr-x 3 root wheel 3584 9月 9 06:01 common
-rw-r--r-- 1 root wheel 10680 9月 9 06:01 config.mk
drwxr-xr-x 2 root wheel 512 9月 9 06:01 disk
drwxr-xr-x 7 root wheel 3072 9月 9 06:01 doc
drwxr-xr-x 28 root wheel 512 9月 9 06:01 drivers
drwxr-xr-x 2 root wheel 512 9月 9 06:01 dts
drwxr-xr-x 4 root wheel 512 9月 9 06:01 examples
drwxr-xr-x 11 root wheel 512 9月 9 06:01 fs
drwxr-xr-x 18 root wheel 5632 9月 9 06:02 include
drwxr-xr-x 7 root wheel 1024 9月 9 06:02 lib
-rwxr-xr-x 1 root wheel 4512 9月 9 06:02 mkconfig
drwxr-xr-x 3 root wheel 512 9月 9 06:02 nand_spl
drwxr-xr-x 2 root wheel 512 9月 9 06:02 net
drwxr-xr-x 6 root wheel 512 9月 9 06:02 post
-rw-r--r-- 1 root wheel 2487 9月 9 06:02 rules.mk
-rw-r--r-- 1 root wheel 17 9月 9 06:02 snapshot.commit
drwxr-xr-x 2 root wheel 512 9月 9 06:02 spl
drwxr-xr-x 2 root wheel 512 9月 9 06:02 test
drwxr-xr-x 12 root wheel 1536 9月 9 06:02 tools
とまあ、こんな感じ。
Gitの方が、Subversionより使い易い様な感じがする。現在はSubversionを使っているけど、履歴を残す+サーバーにバックアップするという感覚で使っている。使用者が自分一人だけなんで面倒が少ないけど、グループで開発とかになったら、また別の問題も発生するんだろうな。Subversionを仕事で初めて使いたてのときには、結構updateせずにcommitして、他の人の変更箇所を無視してしまったりという間違いをしていたしなあw
ラベル:
BeagleBone Black,
Code Sourcery,
FreeBSD,
Git,
U-Boot
登録:
投稿 (Atom)