debootstrap で作ったツリーのセットアップ

Debian LS-CL

LS-CL の標準ファーム上でハックキットの ディレクトリツリーに chroot できなかったり、 ハックキットをインストールしても起動しなかったりという問題は、 おそらく ABI 問題。

Debian GNU/Linux 5.0 (lenny) は armel に対応しているとのこと、 lenny ベースのハックキットを作ってみる。
lenny は、まだ正式リリースされていないけど。。。。

その2。debootstrap で作ったツリーのセットアップ

D.3. Unix/Linux システムからの Debian GNU/Linux のインストール を参考にさせていただいて、セットアップを進める。

D.3.4. 基本システムの設定

順に設定していく。
D.3. Unix/Linux システムからの Debian GNU/Linux のインストール の中には不要な項目もある。

chroot

/mnt/debinst に chroot する。
root@LS-CL701:~# LANG=C chroot /mnt/debinst /bin/bash
LS-CL701:/#
できた!。
Illegal instruction なんても言われていない。

D.3.4.1. デバイスファイルの作成

何を作ればよいのか、特定できないので、 デフォルトの静的デバイスファイル群を作成する。
LS-CL701:/dev# MAKEDEV generic
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
/sbin/MAKEDEV: warning: can't read /proc/devices
LS-CL701:/dev#
/proc をマウントしてみる。
LS-CL701:/dev# mount -t proc proc /proc
LS-CL701:/dev#
再度実行
LS-CL701:/dev# MAKEDEV generic
LS-CL701:/dev#

D.3.4.2. パーティションのマウント

fstab を作る。
LS-CL701:/dev# vi /etc/fstab
	:
	:
LS-CL701:/dev# cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>                       <dump>  <pass>
/dev/sda2       /               xfs     defaults,noatime                0 0
proc            /proc           proc    defaults                        0 0
/dev/sda3       swap            swap    defaults                        0 0
/dev/sda1       /boot           ext3    defaults,noatime                0 1
/dev/sda4       /mnt            xfs     defaults,noatime                0 2
LS-CL701:/dev#
いつものパターン。

D.3.4.3. タイムゾーンの設定

内部時計が UTC かどうかの設定、あるやん。
LS-CL701:/dev# vi /etc/default/rcS
	:
	:
LS-CL701:/dev# grep UTC !$
grep UTC /etc/default/rcS
UTC=no
LS-CL701:/dev#
tzconfig を実行する。
LS-CL701:/dev# tzconfig
WARNING: the tzconfig command is deprecated, please use:
 dpkg-reconfigure tzdata
LS-CL701:/dev#
言われるがままに dpkg-reconfigure tzdata を実行
LS-CL701:/dev# dpkg-reconfigure tzdata
	:
Asia → Tokyo を選択。
Package configuration
        lqqqqqqqqqqqqqqqqqqqqu Configuring tzdata tqqqqqqqqqqqqqqqqqqqqk
        x Please select the time zone corresponding to your location.  x
        x                                                              x
        x Time zone:                                                   x
        x                                                              x
        x                       Tel_Aviv                               x
        x                       Thimphu          a                     x
        x                       Tokyo            a                     x
        x                       Ujung_Pandang    a                     x
        x                       Ulaanbaatar      a                     x
        x                       Urumqi           a                     x
        x                       Vientiane        a                     x
        x                       Vladivostok      a                     x
        x                       Yakutsk                                x
        x                       Yekaterinburg    a                     x
        x                       Yerevan                                x
        x                                                              x
        x                                                              x
        x                                                  x
        x                                                              x
        mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj


Current default timezone: 'Asia/Tokyo'
Local time is now:      Fri Nov 21 18:25:52 JST 2008.
Universal Time is now:  Fri Nov 21 09:25:52 UTC 2008.

LS-CL701:/dev#

D.3.4.4. ネットワークの設定

ハックキットのインストーラで設定するが、、、とりあえず作っておく。
LS-CL701:/dev# vi /etc/network/interfaces
	:
	:
LS-CL701:/dev# cat !$
cat /etc/network/interfaces
######################################################################
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# See the interfaces(5) manpage for information on what options are
# available.
######################################################################

# We always want the loopback interface.
#
auto lo
iface lo inet loopback

# To use dhcp:
#
# auto eth0
# iface eth0 inet dhcp

# Static IP setup: (broadcast and gateway are optional)
#
auto eth0
iface eth0 inet static
        address 192.168.2.47
        network 192.168.2.0
        netmask 255.255.255.0
        broadcast  192.168.2.255
        gateway 192.168.2.1
LS-CL701:/dev# vi /etc/resolv.conf
	:
	:
LS-CL701:/dev# cat !$
cat /etc/resolv.conf
nameserver 192.168.2.39
nameserver 192.168.1.2
search yamasita.jp
domain yamasita.jp
LS-CL701:/dev# echo hackkit > /etc/hostname
LS-CL701:/dev# echo "127.0.0.1  localhost hackkit" > /etc/hosts
LS-CL701:/dev# cat /etc/hosts
127.0.0.1       localhost hackkit
LS-CL701:/dev#

D.3.4.5. apt の設定

LS-CL701:/dev# cat /etc/apt/sources.list
deb http://ftp.jp.debian.org/debian lenny main
LS-CL701:/dev# vi /etc/apt/sources.list
	:
	:
LS-CL701:/dev# cat !$
cat /etc/apt/sources.list
deb http://ftp.jp.debian.org/debian lenny main
deb-src http://ftp.jp.debian.org/debian lenny main

deb http://security.debian.org/ lenny/updates main
deb-src http://security.debian.org/ lenny/updates main

LS-CL701:/dev#
こんなもんでしょうか???

apt-get update を実行する。

LS-CL701:/dev# apt-get update
Get:1 http://ftp.jp.debian.org lenny Release.gpg [189B]
Get:2 http://security.debian.org lenny/updates Release.gpg [189B]
Get:3 http://ftp.jp.debian.org lenny Release [74.5kB]
Get:4 http://security.debian.org lenny/updates Release [40.7kB]
Get:5 http://security.debian.org lenny/updates/main Packages [3344B]
Get:6 http://ftp.jp.debian.org lenny/main Packages/DiffIndex [2038B]
Get:7 http://security.debian.org lenny/updates/main Sources [3815B]
Get:8 http://ftp.jp.debian.org lenny/main Sources [2986kB]
Get:9 http://ftp.jp.debian.org lenny/main 2008-11-21-0827.57.pdiff [2057B]
Get:10 http://ftp.jp.debian.org lenny/main 2008-11-21-0827.57.pdiff [2057B]
Get:11 http://ftp.jp.debian.org lenny/main 2008-11-21-0827.57.pdiff [2057B]
Fetched 3113kB in 37s (83.6kB/s)
Reading package lists... Done
LS-CL701:/dev#
ついでに、アップグレードも実行。
LS-CL701:/dev# apt-get -f install
Reading package lists... Done
Building dependency tree... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
LS-CL701:/dev# apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
LS-CL701:/dev#
整合性も取れているようだし、アップグレードが必要なパッケージも無し。

掃除。

LS-CL701:/dev# apt-get clean
LS-CL701:/dev#

D.3.4.6. ロケールとキーボードの設定

C でいいんですが、、、
LS-CL701:/dev# apt-get install locales
Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed:
  locales
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 4491kB of archives.
After this operation, 12.0MB of additional disk space will be used.
Get:1 http://ftp.jp.debian.org lenny/main locales 2.7-16 [4491kB]
Fetched 4491kB in 10s (424kB/s)
Preconfiguring packages ...
Selecting previously deselected package locales.
(Reading database ... 7907 files and directories currently installed.)
Unpacking locales (from .../locales_2.7-16_all.deb) ...
Processing triggers for man-db ...
Setting up locales (2.7-16) ...
Generating locales (this might take a while)...
Generation complete.
LS-CL701:/dev# dpkg-reconfigure locales
Package configuration
 lqqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring locales tqqqqqqqqqqqqqqqqqqqqqqqqqqk
 x Locales are a framework to switch between multiple languages and allow    x
 x users to use their language, country, characters, collation order, etc.   x
 x                                                                           x
 x Please choose which locales to generate. UTF-8 locales should be chosen   x
 x by default, particularly for new installations. Other character sets may  x
 x be useful for backwards compatibility with older systems and software.    x
 x                                                                           x
 x Locales to be generated:                                                  x
 x                                                                           x
 x    [ ] iu_CA UTF-8                                                        x
 x    [ ] iw_IL ISO-8859-8                                                   x
 x    [ ] iw_IL.UTF-8 UTF-8                                                  x
 x    [*] ja_JP.EUC-JP EUC-JP                                                x
 x    [*] ja_JP.UTF-8 UTF-8                                                  x
 x    [ ] ka_GE GEORGIAN-PS                                                  x
 x                                                                           x
 x                                                                           x
 x                                                               x
 x                                                                           x
 mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

ja_JP.EUC-JP EUC-JP と ja_JP.UTF-8 UTF-8 とを選んで、

Package configuration

 lqqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring locales tqqqqqqqqqqqqqqqqqqqqqqqqqqk
 x Many packages in Debian use locales to display text in the correct        x
 x language for the user. You can choose a default locale for the system     x
 x from the generated locales.                                               x
 x                                                                           x
 x This will select the default language for the entire system. If this      x
 x system is a multi-user system where not all users are able to speak the   x
 x default language, they will experience difficulties.                      x
 x                                                                           x
 x Default locale for the system environment:                                x
 x                                                                           x
 x                               None                                        x
 x                               ja_JP.EUC-JP                                x
 x                               ja_JP.UTF-8                                 x
 x                                                                           x
 x                                                                           x
 x                                                               x
 x                                                                           x
 mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj


ここでは、硬派に None.
Generating locales (this might take a while)...
  ja_JP.EUC-JP... done
  ja_JP.UTF-8... done
Generation complete.
LS-CL701:/dev#

D.3.5. カーネルのインストール

要らない

D.3.6. ブートローダのセットアップ

要らない

D.3.7. 仕上げに

psmisc のインストール

LS-CL701:/dev# which killall
LS-CL701:/dev# 
killall がないので、psmisc をインストールする。
LS-CL701:/dev# apt-get install psmisc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  psmisc
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 82.1kB of archives.
After this operation, 492kB of additional disk space will be used.
Get:1 http://ftp.jp.debian.org lenny/main psmisc 22.6-1 [82.1kB]
Fetched 82.1kB in 2s (39.8kB/s)
Selecting previously deselected package psmisc.
(Reading database ... 8454 files and directories currently installed.)
Unpacking psmisc (from .../psmisc_22.6-1_armel.deb) ...
Processing triggers for man-db ...
Setting up psmisc (22.6-1) ...
LS-CL701:/dev# which killall
/usr/bin/killall
LS-CL701:/dev#

less,nkf,ftp,telnetd

こんなもんかなぁ。。。

掃除

LS-CL701:/dev# apt-get clean
LS-CL701:/dev#

そのほか、、、

root のパスワードの変更

インストール直後は、、、
LS-CL701:/dev# grep root /etc/shadow
root::14204:0:99999:7:::
LS-CL701:/dev#
パスワード無し。debian らしくない。
パスワードをつける。いつもの。
LS-CL701:/dev# passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
LS-CL701:/dev# grep root /etc/shadow
root:(暗号化されたパスワード):14204:0:99999:7:::
LS-CL701:/dev#

guest の作成

LS-CL701:/dev# adduser guest
Adding user `guest' ...
Adding new group `guest' (1000) ...
Adding new user `guest' (1000) with group `guest' ...
Creating home directory `/home/guest' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for guest
Enter the new value, or press ENTER for the default
        Full Name []:
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y
LS-CL701:/dev#

さて、、、

いくら凝っても、ブートしないと意味がないので、このへんにしておく。
LS-CL701:/dev# exit
exit
root@LS-CL701:~#


LS-CL
バッファローダイレクト
楽天市場
amazon


lenny + armel で debootstrap
ハックの記録
LinkStation/玄箱 をハックしよう

lenny + armel のハックキットで起動

Copyright (C) 2003-2010 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市