[HOME] [玄箱PROのシステムバックアップ] [玄箱PROでNTFSを使う] [玄箱PROのUSB-シリアル接続] [miconapl互換コマンドの作成] [玄箱インストールmemo]

玄箱PROのDebian Etch化の手順

Jun Mizutani 2007/05/17

概要

標準のHDDブート環境に設定済みの玄箱PROをDebian etch化する手順を書いてみました。標準のHDDブート環境にpatch、MAKEDEV、wget、debootstrapのみをソースからインストールします。SATAのHDDをGroovyのUD-500SAで玄箱PROにUSB接続して、そのHDD上にブート可能なDebian Etchを構築します。既にHDDブート環境に移行済みでシリアル接続したコンソールがなく、フラッシュからのブートからHDDブート環境に移行するタイミングでDebian化することができない場合でもDebian化できます。ただし操作を間違える(USBのHDDをフォーマットするつもりで本体のHDDをフォーマットするなど)とシリアルケーブルが必要になります。標準のHDDブート環境に対する変更は最小限(patch, MAKEDEV, debootstrap, wgetのインストールのみ)ですからハードディスクの指定(デバイスsda,sdbとパーティション)さえ間違えなければ再起不能になることは無いと思います。


すべての内容を消しても良いハードディスクを使って、
作業内容が理解できる方のみ行ってください。
このページに記述した操作を行った結果に対して筆者は責任は負えません。
あくまで自己責任でお願いいたします。

SWATの不具合の修正用ファームウェア書き換えキットで工場出荷状態に戻した玄箱PROを使っています。

大まかな手順は以下のようになります。


ソースの入手

HDDブートの開発環境には debootstrap が必要とする MAKEDEV、wget がないため、debootstrap をコンパイルする前に用意します。またMAKEDEVにパッチを当てるため patch のソースも入手します。

ソースをWindows側から転送

HDDブート環境から起動

玄箱PROを起動します。

KUROUTOSHIKOU KUROBOX Series
KUROBOX-PRO login: root
Password:


BusyBox v1.1.1 (2006.11.29-02:37+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ # df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda2              2929652    218760   2710892   7% /
/dev/ram1                 8192       132      8060   2% /mnt/ram
/dev/sda4            157625072       624 157624448   0% /home

ソースを玄箱PROに転送

Windowsから玄箱PROに接続して\homesフォルダ以下に\srcを作成、さらに\srcフォルダ以下に tgz フォルダを作成しました。入手した makedev_2.3.1.orig.tar.gz、makedev_2.3.1-83.diff.gz、debootstrap、wget のソースを玄箱PROに転送します。

ソースは /home/src/tgz 以下に置き、コンパイルは /home/src 以下で行うことにします。

/home/src/ # ls tgz -l
-rwxrw-rw-    1 nobody   99         221535 May  6 07:07 debootstrap_0.3.3.3.tar.gz
-rwxrw-rw-    1 nobody   99          48005 May 15 00:45 makedev_2.3.1-83.diff.gz
-rwxrw-rw-    1 nobody   99           9924 May 15 00:45 makedev_2.3.1.orig.tar.gz
-rwxrw-rw-    1 nobody   99         186879 May 15 14:37 patch-2.5.4.tar.gz
-rwxrw-rw-    1 nobody   99        1213056 May 15 14:54 wget-1.10.2.tar.gz

インストール用のハードディスクの用意

SATAの160GB HDDをシリアルATA&IDE→USB2.0変換ケーブル(Groovy UD-500SA)で玄箱PROにUSB接続します。

ハードディスクをクリア

一応、USB接続したハードディスク(/dev/sdb)の先頭の5GBに以下のようにゼロを書き込み強制的に未フォーマットの状態にしました。

/home/src/ # time dd if=/dev/zero of=/dev/sdb bs=1M count=5120
5120+0 records in
5120+0 records out
real    3m 36.04s
user    0m 0.03s
sys     1m 25.20s

パーティションを作成

USB接続したハードディスク(/dev/sdb)にHDDブート環境と同じ構成でパーティションを作成します。

~ # fdisk /dev/sdb <<EOF
n
p
1

+50MB
n
p
2

+3GB
n
p
3

+128MB
t
3
82
n
p
4


p
w

EOF

パーティションの確認

/home # fdisk /dev/sdb

The number of cylinders for this disk is set to 19452.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 160.0 GB, 160000000000 bytes
255 heads, 63 sectors/track, 19452 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1           7       56196   83  Linux
/dev/sdb2               8         373     2939895   83  Linux
/dev/sdb3             374         390      136552+  82  Linux swap
/dev/sdb4             391       19452   153115515   83  Linux

Command (m for help): q

ファイルシステムのフォーマット

HDDブート環境には mkfs.xfsが入っていないため、フラッシュROMをマウントしてchroot環境でフォーマットします。

フラッシュROM(/dev/mtdblock2)をマウント

マウントポイント(/mnt/mtd2)を用意してフラッシュROMをマウントします。

~ # mkdir /mnt/mtd2
~ # mount /dev/mtdblock2 /mnt/mtd2

chroot してUSBで接続したHDDをフォーマット

フラッシュROM環境にchroot して /dev/sdb をフォーマットします。

/ # chroot /mnt/mtd2


BusyBox v1.1.1 (2007.04.06-12:02+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

/ # mount -t proc proc /proc

修正前には次のようにBusyBoxのバージョンがv1.4.1でした。swatの不具合修正後はv1.1.1とHDDブート環境と同じバージョン(ビルド日付は異なる)になっています。

BusyBox v1.4.1 (2007-02-06 15:15:35 JST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

/dev/sdb1 を ext3 でフォーマット。

/ # mkfs.ext3 /dev/sdb1
mke2fs 1.27 (8-Mar-2002)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
14056 inodes, 56196 blocks
2809 blocks (5.00%) reserved for the super user
First data block=1
7 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

/dev/sdb2 を xfs でフォーマット。

/ # mkfs.xfs -f /dev/sdb2
meta-data=/dev/sdb2              isize=256    agcount=8, agsize=91872 blks
         =                       sectsz=512
data     =                       bsize=4096   blocks=734973, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=2560, version=1
         =                       sectsz=512   sunit=0 blks
realtime =none                   extsz=65536  blocks=0, rtextents=0

/dev/sdb4 を xfs でフォーマット

/ # mkfs.xfs -f /dev/sdb4
meta-data=/dev/sdb4              isize=256    agcount=37, agsize=1048576 blks
         =                       sectsz=512
data     =                       bsize=4096   blocks=38278878, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=18690, version=1
         =                       sectsz=512   sunit=0 blks
realtime =none                   extsz=65536  blocks=0, rtextents=0

swap を用意。

/ # mkswap /dev/sdb3
Setting up swapspace version 1, size = 139825152 bytes

chroot環境から抜けます。

/ # exit

カーネルイメージのコピー

起動したパーティション(/dev/sda1)からフォーマットしたHDD(/dev/sdb1)カーネルイメージをコピーします。マウントポイントのディレクトリを作成してマウントします。

~ # mkdir /mnt/sda1
~ # mkdir /mnt/sdb1
~ # mount /dev/sda1 /mnt/sda1
~ # mount /dev/sdb1 /mnt/sdb1
~ # cp /mnt/sda1/uImage.buffalo /mnt/sdb1

カーネルイメージの確認

/dev/sda1 と /dev/sdb1 を確認します。

/ # df
/dev/sda2              2929652    218764   2710888   7% /
/dev/ram1                 8192       132      8060   2% /mnt/ram
/dev/sda4            157625072      7688 157617384   0% /home
/dev/mtdblock2           65536     16132     49404  25% /mnt/mtd2
/dev/sda1                54416      5831     45776  11% /mnt/sda1
/dev/sdb1                54416      5831     45776  11% /mnt/sdb1
~ # ls -l /mnt/sda1
drwx------    2 root     0           12288 May 15 21:53 lost+found
-rwxrw-rw-    1 nobody   99        1736436 Feb  8 09:10 uImage.buffalo
~ # ls -l /mnt/sdb1
drwx------    2 root     0           12288 May 16 07:32 lost+found
-rwxr--r--    1 root     0         1736436 May 16 07:34 uImage.buffalo

ソースのビルドとインストール

patch-2.5.4のインストール

patch は /usr/local/ 以下にインストールすることにします。

/home/src # tar zxf tgz/patch-2.5.4.tar.gz
/home/src # cd patch-2.5.4/
/home/src/patch-2.5.4 # ./configure
creating cache ./config.cache
checking host system type... armv5tejl-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking for a BSD compatible install... /usr/bin/install -c
checking whether make sets ${MAKE}... yes
checking for ed... ed
checking build system type... armv5tejl-unknown-linux-gnu
checking for getconf... getconf
checking for CFLAGS value to request large file support... no
checking for LDFLAGS value to request large file support... no
checking for LIBS value to request large file support... no
checking for _FILE_OFFSET_BITS... no
checking for _LARGEFILE_SOURCE... no
checking for _LARGE_FILES... no
checking for AIX... no
checking for minix/config.h... no
checking for POSIXized ISC... no
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for executable suffix... no
checking for gcc option to accept ANSI C... none needed
checking for function prototypes... yes
checking for working const... yes
checking for dirent.h that defines DIR... yes
checking for opendir in -ldir... no
checking for ANSI C header files... yes
checking for fcntl.h... yes
checking for limits.h... yes
checking for string.h... yes
checking for unistd.h... yes
checking for utime.h... yes
checking for varargs.h... no
checking for inttypes.h... yes
checking for mode_t... yes
checking for off_t... yes
checking for pid_t... yes
checking return type of signal handlers... void
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking for utime.h... (cached) yes
checking for struct utimbuf... yes
checking for getopt_long... yes
checking for _doprintf... no
checking for isascii... yes
checking for fseeko... yes
checking for memcmp... yes
checking for mktemp... yes
checking for pathconf... yes
checking for raise... yes
checking for setmode... no
checking for sigaction... yes
checking for sigprocmask... yes
checking for sigsetmask... yes
checking for strerror... yes
checking for memchr... yes
checking for mkdir... yes
checking for rename... yes
checking for rmdir... yes
checking for working malloc... yes
checking for working realloc... yes
checking whether closedir returns void... no
checking for vprintf... yes
checking for long file names... yes
checking for d_ino member in directory struct... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
creating config.h
/home/src/patch-2.5.4 # time make
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 addext.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 argmatch.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 backupfile.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 basename.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 error.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 inp.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 maketime.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 partime.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 patch.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 pch.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 quotearg.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 quotesys.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 util.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 version.c
gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -I. -I. -g -O2 xmalloc.c
gcc -o patch -g -O2  addext.o argmatch.o backupfile.o basename.o error.o inp.o m
aketime.o partime.o patch.o pch.o quotearg.o quotesys.o util.o version.o xmalloc
.o
patch.o: In function `make_temp':/home/src/patch-2.5.4/patch.c:1325: warning: th
e use of `mktemp' is dangerous, better use `mkstemp'
real    0m 45.87s
user    0m 43.66s
sys     0m 2.18s
/home/src/patch-2.5.4 # make install

makedev_2.3.1-83 のインストール

MAKEDEVはシェルスクリプトなので展開、patchの後、実行権限を付加して /sbin にMAKEDEV というファイル名でコピーします。また/dev/MAKEDEVに/sbin/MAKEDEVへのシンボリックリンクを作成します。

/home/src# tar zxf makedev_2.3.1.orig.tar.gz
/home/src# gzip -dc makedev_2.3.1-83.diff.gz |patch -p0
patching file makedev-2.3.1.orig/MAKEDEV.man
patching file makedev-2.3.1.orig/MAKEDEV
patching file makedev-2.3.1.orig/debian/old/README.debian
patching file makedev-2.3.1.orig/debian/old/devices.sgml
patching file makedev-2.3.1.orig/debian/changelog
patching file makedev-2.3.1.orig/debian/compat
patching file makedev-2.3.1.orig/debian/control
patching file makedev-2.3.1.orig/debian/copyright
patching file makedev-2.3.1.orig/debian/dirs
patching file makedev-2.3.1.orig/debian/init.d
patching file makedev-2.3.1.orig/debian/postinst
patching file makedev-2.3.1.orig/debian/preinst
patching file makedev-2.3.1.orig/debian/rules
patching file makedev-2.3.1.orig/Makefile

/home/src# cd makedev-2.3.1.orig/
/home/src/makedev-2.3.1.orig# ls -lt
total 92
-rw-rw-r-- 1 root root 52320 May 15 16:32 MAKEDEV
-rw-rw-r-- 1 root root 24497 May 15 16:32 MAKEDEV.man
-rw-rw-r-- 1 root root   300 May 15 16:32 Makefile
drwxr-xr-x 3 root root   304 May 15 16:32 debian
-rw-rw-r-- 1 jun  1000   848 Jun 10  1999 MAKEDEV-2.3.1.lsm
-rw-rw-r-- 1 jun  1000  1230 Jun 10  1999 MAKEDEV.spec
-rw-rw-r-- 1 jun  1000  1162 Jun 10  1999 README

/home/src/makedev-2.3.1.orig # chmod +x MAKEDEV
/home/src/makedev-2.3.1.orig # cp MAKEDEV /sbin
/home/src/makedev-2.3.1.orig # ln -s /sbin/MAKEDEV /dev/MAKEDEV
/home/src # cd ..

wget-1.10.2のインストール

wgetは /usr/local/ 以下にインストールすることにします。

展開とconfigure

/home/src # tar zxf tgz/wget-1.10.2.tar.gz
/home/src # cd wget-1.10.2/
/home/src/wget-1.10.2 # ./configure
configure: configuring for GNU Wget 1.10.2
:
:省略
:
generating po/POTFILES from ./po/POTFILES.in
creating po/Makefile

ビルド

/home/src/wget-1.10.2 # time make
:
省略
:
cd po && make CC='gcc' CPPFLAGS= DEFS='-DHAVE_CONFIG_H -DSYSTEM_WGETRC=\"/usr/local/etc/wgetrc\" -DLOCALEDIR=\"/usr/local/share/locale\"' CFLAGS='-O2 -Wall -Wno-implicit' LDFLAGS= LIBS='-ldl -lrt  ' prefix='/usr/local' exec_prefix='/usr/local' bindir='/usr/local/bin' infodir='/usr/local/in
 -DLOCALEDIR=\"/usr/local/share/locale\"' CFLAGS='-O2 -Wall -Wno-implicit' LDFLAGS= LIBS='-ldl -lrt  ' prefix='/usr/local' exec_prefix='/usr/local' bindir='/usr/local/bin' infodir='/usr/local/in
lrt  ' prefix='/usr/local' exec_prefix='/usr/local' bindir='/usr/local/bin' infodir='/usr/local/in
fo' mandir='/usr/local/man' manext='1'
make[1]: Entering directory `/home/src/wget-1.10.2/po'
file=./`echo bg | sed 's,.*/,,'`.gmo \
  && rm -f $file && PATH=../src:$PATH msgfmt -o $file bg.po
/bin/sh: msgfmt: not found
make[1]: *** [bg.gmo] Error 127
make[1]: Leaving directory `/home/src/wget-1.10.2/po'
make: *** [po] Error 2
Command exited with non-zero status 2
real    2m 53.97s
user    2m 47.83s
sys     0m 5.38s

約3分でエラーで終了しました。


gettext の msgfmt がインストールされていないためエラーとなっていますが、ここでは無視してもOKです。

/home/src/wget-1.10.2 # make install

makeと同様にエラーが表示されますが、インストールは終了しています。

/etc/groupの用意

HDDブート環境には /etc/group がないため適当に作成しました。

cat /etc/group
root::0:root
bin::1:root,bin,daemon
daemon::2:root,bin,daemon
sys::3:root,bin,adm
adm::4:root,adm,daemon
tty::5:
disk::6:root,adm
lp::7:lp
mem::8:
kmem::9:
wheel::10:root
floppy::11:root
mail::12:mail
news::13:news
uucp::14:uucp
man::15:man
users::100:games

debootstrap のインストール

make

debootstrap_0.3.3.3.tar.gzを展開して、make します。

/home/src # tar zxf tgz/debootstrap_0.3.3.3.tar.gz
/home/src # cd debootstrap-0.3.3.3/

Makefile を編集して generic を generic-arm に変更します。

DEVS := generic-arm hde hdf hdg hdh sde sdf sdg sdh scd-all initrd input usb md

debootstrap自体はシェルスクリプトですが、pkgdetailsはコンパイルする必要があるため make を実行します。

/home/src/debootstrap-0.3.3.3 # time make
make: dpkg: Command not found
rm -rf dev
mkdir -p dev
chown 0:0 dev
chmod 755 dev
(cd dev && /dev/MAKEDEV generic-arm hde hdf hdg hdh sde sdf sdg sdh scd-all init
rd input usb md lp rtc video     )
chown: unknown group name: cdrom
makedev scd0 b 11 0 root cdrom 0660: failed
 :
 : 省略
 :
chown: unknown group name: video
makedev vttuner c 83 16 root video 0660: failed
tar cf - dev | gzip -9 >devices.tar.gz
rm -rf dev
echo  >debootstrap-arch
real    0m 50.25s
user    0m 14.14s
sys     0m 35.05s

インストール

インストールするには make install-arch を実行します。

/home/src/debootstrap-0.3.3.3 # make install-arch
make: dpkg: Command not found
mkdir -p /usr/lib/debootstrap/scripts
mkdir -p /usr/sbin
mkdir -p /usr/share/man/man8
install -o root -g root -m 0644 potato /usr/lib/debootstrap/scripts/
install -o root -g root -m 0644 woody /usr/lib/debootstrap/scripts/
install -o root -g root -m 0644 woody.buildd /usr/lib/debootstrap/scripts/
install -o root -g root -m 0644 sarge /usr/lib/debootstrap/scripts/
install -o root -g root -m 0644 sarge.buildd /usr/lib/debootstrap/scripts/
install -o root -g root -m 0644 sarge.fakechroot /usr/lib/debootstrap/scripts/
install -o root -g root -m 0644 sid /usr/lib/debootstrap/scripts/
install -o root -g root -m 0644 warty /usr/lib/debootstrap/scripts/
install -o root -g root -m 0644 warty.buildd /usr/lib/debootstrap/scripts/
install -o root -g root -m 0644 hoary /usr/lib/debootstrap/scripts/
install -o root -g root -m 0644 hoary.buildd /usr/lib/debootstrap/scripts/
install -o root -g root -m 0644 breezy /usr/lib/debootstrap/scripts/
install -o root -g root -m 0644 functions /usr/lib/debootstrap/
ln -s sid /usr/lib/debootstrap/scripts/etch
ln -s sid /usr/lib/debootstrap/scripts/lenny
install -o root -g root -m 0755 debootstrap.8 /usr/share/man/man8/
install -o root -g root -m 0755 debootstrap /usr/sbin/
install -o root -g root -m 0755 pkgdetails /usr/lib/debootstrap/
install -o root -g root -m 0644 devices.tar.gz /usr/lib/debootstrap/
install -o root -g root -m 0644 debootstrap-arch /usr/lib/debootstrap/arch

USB接続したドライブにDebian環境を構築

インストール先のパーティションをマウント

Debian環境はUSB接続したハードディスク(/dev/sdb)にインストールします。まずインストール先のパーティション(/dev/sdb2)を /mnt/sdb2 にマウントします。

~ # mkdir /mnt/sdb2
~ # mount /dev/sdb2 /mnt/sdb2
~ # df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda2              2929652    219656   2709996   7% /
/dev/ram1                 8192       132      8060   2% /mnt/ram
/dev/sda4            157625072     18172 157606900   0% /home
/dev/mtdblock2           65536     16132     49404  25% /mnt/mtd2
/dev/sda1                54416      5831     45776  11% /mnt/sda1
/dev/sdb1                54416      5831     45776  11% /mnt/sdb1
/dev/sdb2              2929652       144   2929508   0% /mnt/sdb2

debootstrap の実行

debootstrap を実行します。パッケージの取得にかかる時間はネットワークの速度に依存しますが、数十分かかります。

~ # time debootstrap --arch arm sarge /mnt/sdb2 https://cdn.debian.or.jp/debian
I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Found additional required dependencies: libtext-iconv-perl zlib1g
I: Checking component main on https://cdn.debian.or.jp/debian...
I: Retrieving adduser
I: Validating adduser
 :
 : 省略
 :
I: Extracting zlib1g...
I: Installing core packages...
I: Unpacking required packages...
I: Configuring required packages...
I: Installing base packages...
I: Base system installed successfully.

real    19m 52.29s
user    7m 8.16s
sys     11m 28.86s

うちの環境では20分程度で終了しました。

カーネルモジュールのコピー

HDDブート環境からカーネルモジュールをDebian側にコピーします。玄箱PROのカーネルは必要なモジュールは組み込まれていて、カーネルモジュールは空ですが、一応コピーしておきます。

~ # cd /lib
/lib # ls
/lib # cp -a modules /mnt/sdb2/lib

chrootを使ったdebian環境での作業

以上でDebian sargeのインストールが終了しました。chrootを使ってDebian sarge環境をテストしてみます。

各種設定と sarge から etch への移行をchrootを使ったdebian環境で作業します。telnetdのインストールと一般ユーザの追加と root のパスワードの設定を忘れるとログインできなくなります。

~ # chroot /mnt/sdb2
sh-2.05b# mount -t proc proc /proc

/etc/apt/sources.list の設定

sh-2.05b# cat /etc/apt/sources.list
deb https://cdn.debian.or.jp/debian/stable main
deb-src https://cdn.debian.or.jp/debian/stable main
deb https://security.debian.org/stable/updates main

ホスト名の設定

sh-2.05b# cat /etc/hostname
KUROBOX-PRO

/etc/hostsの設定

sh-2.05b# cat /etc/hosts
127.0.0.1 localhost KUROBOX-PRO

ネットワーク設定

DHCPで自動設定されるように設定しました。

sh-2.05b# cat /etc/network/interfaces
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for me information.

iface lo inet loopback
iface eth0 inet dhcp
auto lo
auto eth0

/etc/inetd.conf に以下の行があることを確認します。

telnet  stream  tcp   nowait  telnetd /usr/sbin/tcpd  /usr/sbin/in.telnetd

root のパスワード設定

sh-2.05b# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

apt-get update の実行

sh-2.05b# apt-get update
Get:1 https://security.debian.orgstable/updates/main Packages [54.4kB]
Get:2 https://cdn.debian.or.jpstable/main Packages [5464kB]
Get:3 https://security.debian.orgstable/updates/main Release [96B]
Get:4 https://cdn.debian.or.jpstable/main Release [94B]
Get:5 https://cdn.debian.or.jpstable/main Sources [1653kB]
Get:6 https://cdn.debian.or.jpstable/main Release [97B]
Fetched 7171kB in 11s (610kB/s)
Reading Package Lists... Done

telnetd のインストール

sh-2.05b# apt-get install update-inetd
sh-2.05b# apt-get install xinetd
sh-2.05b# apt-get install telnetd

xfsprogs のインストール

sh-2.05b# apt-get install xfsprogs
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
  libncurses5 libreadline5 readline-common
Suggested packages:
  xfsdump attr dvhtool quota
The following NEW packages will be installed:
  libreadline5 readline-common xfsprogs
The following packages will be upgraded:
  libncurses5
1 upgraded, 3 newly installed, 0 to remove and 93 not upgraded.
Need to get 1866kB of archives.
After unpacking 3486kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://cdn.debian.or.jpstable/main libncurses5 5.5-5 [305kB]
Get:2 https://cdn.debian.or.jpstable/main readline-common 5.2-2 [50.6kB]
Get:3 https://cdn.debian.or.jpstable/main libreadline5 5.2-2 [125kB]
Get:4 https://cdn.debian.or.jpstable/main xfsprogs 2.8.11-1 [1385kB]
Fetched 1866kB in 2s (764kB/s)
(Reading database ... 7315 files and directories currently installed.)
Preparing to replace libncurses5 5.4-4 (using .../libncurses5_5.5-5_arm.deb) ...
Unpacking replacement libncurses5 ...
Setting up libncurses5 (5.5-5) ...

Selecting previously deselected package readline-common.
(Reading database ... 7316 files and directories currently installed.)
Unpacking readline-common (from .../readline-common_5.2-2_all.deb) ...
Selecting previously deselected package libreadline5.
Unpacking libreadline5 (from .../libreadline5_5.2-2_arm.deb) ...
Selecting previously deselected package xfsprogs.
Unpacking xfsprogs (from .../xfsprogs_2.8.11-1_arm.deb) ...
Setting up readline-common (5.2-2) ...

Setting up libreadline5 (5.2-2) ...

Setting up xfsprogs (2.8.11-1) ...

一般ユーザの追加

telnet経由では root でログインできないため、一般ユーザを追加します。

sh-2.05b# adduser
Enter a username to add: kuro
Adding user `kuro'...
Adding new group `kuro' (1000).
Adding new user `kuro' (1000) with group `kuro'.
Creating home directory `/home/kuro'.
Copying files from `/etc/skel'
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for kuro
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

/etc/fstab の設定

sh-2.05b# cat /etc/fstab
# UNCONFIGURED FSTAB FOR BASE SYSTEM
proc            /proc           proc    defaults        0       0
sysfs           /sys            sysfs   defaults        0       0
devpts          /dev/pts        devpts  gid=4,mode=620  0       0
/dev/sda2       /               xfs     defaults        1       1
/dev/sda4       /home           xfs     defaults        1       1

シリアルコンソールからのログインも有効にする

/etc/inittab のT0のコメントアウトを解除して以下のように修正します。また接続速度を115200bpsに変更しないとシリアルコンソールからログインできません。

# Example how to put a getty on a serial line (for a terminal)
#
T0:12345:respawn:/sbin/getty -L ttyS0 115200 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

シリアル接続用の/dev/ttyS0がなかったのでUARTのデバイスファイルを作成します。

sh-2.05b# cd /dev
sh-2.05b# MAKEDEV ttyS0

JSTに変更

「UTC=no」に変更します。

KUROBOX-PRO:~# cat /etc/default/rcS
#
#       Defaults for the boot scripts in /etc/rcS.d
#

# Time files in /tmp are kept in days.
TMPTIME=0
# Set to yes if you want sulogin to be spawned on bootup
SULOGIN=no
# Set to no if you want to be able to login over telnet/rlogin
# before system startup is complete (as soon as inetd is started)
DELAYLOGIN=yes
# Set UTC=yes if your system clock is set to UTC (GMT), and UTC=no if not.
UTC=no
# Set VERBOSE to "no" if you would like a more quiet bootup.
VERBOSE=yes
# Set EDITMOTD to "no" if you don't want /etc/motd to be editted automatically
EDITMOTD=yes
# Set FSCKFIX to "yes" if you want to add "-y" to the fsck at startup.
FSCKFIX=no

tzconfig の実行

タイムゾーンを設定します。

KUROBOX-PRO:/# tzconfig
Your current time zone is set to Asia/Tokyo
Do you want to change that? [n]: y

Please enter the number of the geographic area in which you live:


        1) Africa                       7) Australia

        2) America                      8) Europe

        3) US time zones                9) Indian Ocean

        4) Canada time zones            10) Pacific Ocean

        5) Asia                         11) Use System V style time zones

        6) Atlantic Ocean               12) None of the above


Then you will be shown a list of cities which represent the time zone
in which they are located. You should choose a city in your time zone.

Number: 5

Aden Almaty Amman Anadyr Aqtau Aqtobe Ashgabat Ashkhabad Baghdad Bahrain
Baku Bangkok Beirut Bishkek Brunei Calcutta Choibalsan Chongqing Chungking
Colombo Dacca Damascus Dhaka Dili Dubai Dushanbe Gaza Harbin Hong_Kong
Hovd Irkutsk Istanbul Jakarta Jayapura Jerusalem Kabul Kamchatka Karachi
Kashgar Katmandu Krasnoyarsk Kuala_Lumpur Kuching Kuwait Macao Macau
Magadan Makassar Manila Muscat Nicosia Novosibirsk Omsk Oral Phnom_Penh
Pontianak Pyongyang Qatar Qyzylorda Rangoon Riyadh Riyadh87 Riyadh88
Riyadh89 Saigon Sakhalin Samarkand Seoul Shanghai Singapore Taipei
Tashkent Tbilisi Tehran Tel_Aviv Thimbu Thimphu Tokyo Ujung_Pandang
Ulaanbaatar Ulan_Bator Urumqi Vientiane Vladivostok Yakutsk Yekaterinburg
Yerevan

Please enter the name of one of these cities or zones
You just need to type enough letters to resolve ambiguities
Press Enter to view all of them again
Name: [] Tokyo
Your default time zone is set to 'Asia/Tokyo'.
Local time is now:      Thu May 17 14:29:45 JST 2007.
Universal Time is now:  Thu May 17 05:29:45 UTC 2007.

Debianをインストールしたパーティションを保存

ここまでの作業でUSBでつないだHDDからDebianが起動するはずです。ここまでの作業をバックアップします。


telnetでもう1つログインして /dev/sdb2 の領域のサイズを確認します。

~ # df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda2              2929652    219672   2709980   7% /
/dev/ram1                 8192       132      8060   2% /mnt/ram
/dev/sda4            157625072     18172 157606900   0% /home
/dev/sdb2              2929652    175976   2753676   6% /mnt/sdb2

あとで /mnt/sdb2 を圧縮して保存するためにインストール済みの deb ファイルを消しておきます。/procをアンマウントして chroot 環境から抜けます。

sh-2.05b# apt-get clean
sh-2.05b# umount /proc
sh-2.05b# exit

サイズを確認します。

~ # df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda2              2929652    219672   2709980   7% /
/dev/ram1                 8192       132      8060   2% /mnt/ram
/dev/sda4            157625072     18172 157606900   0% /home
/dev/sdb2              2929652    136736   2792916   5% /mnt/sdb2

40MB近くディスクが空きました。

ここまでの作業を保存するために /mnt/sdb2 を固めておきます。

/mnt/sdb2 # time tar zcf /home/src/kpro_sarge20070516.tar.gz *
real    14m 27.08s
user    13m 14.24s
sys     1m 5.50s

ちょっと時間がかかりますが、フォーマットして書き戻せば今の状態まで戻ることができます。

サイズを確認

/mnt/sdb2 # cd /home/src
/home/src # ls -l kpro_sarge20070516.tar.gz
-rw-r--r--  1 root   root   46672355 May 17 08:44 kpro_sarge20070516.tar.gz

Windowsからsamba経由で接続して\\Kuro-box\homes\src\kpro_sarge20070516.tar.gzを保存しておきます。

ハードディスクの入れ替えと再起動

Debianをインストールしたハードディスクを本体に格納して再起動します。

Debianの実行(telnet)

一般ユーザでログインします。telnetではrootでログインできません。一般ユーザを作成していないとログインできないため、忘れた場合はHDDブート環境からUSBで接続したのち、chrootして作成してください。

Debian GNU/Linux 3.1 localhost
KUROBOX-PRO login: kuro
Password:
Linux KUROBOX-PRO 2.6.12.6-arm1 #2 Thu Feb 8 15:00:20 JST 2007 armv5tejl GNU/Lin
ux

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
kuro@KUROBOX-PRO:~$

Debianの実行(コンソール画面)

一応、起動時のシリアルコンソールの出力を貼っておきます。

=== KURO U-Boot. ===
 ** LOADER **
 ** KUROBOX BOARD: KURO_BOX  LE (CFG_ENV_ADDR=fffff000)


U-Boot 1.1.1 (Apr 10 2007 - 18:10:08) Marvell version: 1.12.1 - TINY

DRAM CS[0] base 0x00000000   size 128MB
DRAM Total size 128MB
[256kB@fffc0000] Flash: 256 kB
Addresses 20M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (20M - 16M): Done
NAND: 256 MB

Soc: 88F5182 A2
CPU: ARM926 (Rev 0) running @ 500Mhz
Orion 1 streaming disabled
SysClock = 250Mhz , TClock = 166Mhz


USB 0: host mode
USB 1: host mode
PCI 0: PCI Express Root Complex Interface
PCI 1: Conventional PCI, speed = 33000000
Net:   egiga0 [PRIME]
Using 88E1118 phy
hit any key to switch tftp boot.
Hit any key to stop autoboot:  0
<<system_bootend>>
Hit any key to stop autoboot:  0

Reset IDE:
Marvell Serial ATA Adapter
Integrated Sata device found
  Device 0: OK
Model: WDC WD1600JD-75HBB0                      Firm: 08.02D08 Ser#:      WD-WMA
L93772736
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 152587.8 MB = 149.0 GB (312500000 x 512)

Using device ide0, partition 1

Loading from block device ide device 0, partition 1: Name: hda1
  Type: U-Boot  File:/uImage.buffalo

1736436 bytes read
<<stop_sound>>
## Booting image at 00100000 ...
   Image Name:   Linux-2.6.12.6-arm1
   Created:      2007-02-08   6:00:09 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1736372 Bytes =  1.7 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK

Starting kernel ...

arg:console=ttyS0,115200 root=/dev/sda2 rw panic=5 BOOTVER=1.09
CONFIG_BUFFALO_PLATFORM CONFIG_BUFFALO_KUROBOX ---
Uncompressing Linux.............................................................
.................................................... done, booting the kernel.
Linux version 2.6.12.6-arm1 (root@dev-hara) (gcc version 3.4.4 (release) (CodeSo
urcery ARM 2005q3-2)) #2 Thu Feb 8 15:00:20 JST 2007
CPU: ARM926EJ-Sid(wb) [41069260] revision 0 (ARMv5TEJ)
CPU0: D VIVT write-back cache
CPU0: I cache: 32768 bytes, associativity 1, 32 byte lines, 1024 sets
CPU0: D cache: 32768 bytes, associativity 1, 32 byte lines, 1024 sets
Machine: MV-88fxx81
Using UBoot passing parameters structure
Sys Clk = 250000000, Tclk = 166664740
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists
Kernel command line: console=ttyS0,115200 root=/dev/sda2 rw panic=5 BOOTVER=1.09
PID hash table entries: 1024 (order: 10, 16384 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 128MB 0MB 0MB 0MB = 128MB total
Memory: 126208KB available (3037K code, 425K data, 112K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
serial_initialize_ttyS1 (Debug): ttyS1 is initialized.
 config_device_cs Error : Unknown board

CPU Interface
-------------
SDRAM_CS0 ....base 00000000, size 128MB
SDRAM_CS1 ....disable
SDRAM_CS2 ....disable
SDRAM_CS3 ....disable
PEX0_MEM ....base e0000000, size 128MB
PEX0_IO ....base f2000000, size   1MB
PCI0_MEM ....base e8000000, size 128MB
PCI0_IO ....base f2100000, size   1MB
INTER_REGS ....base f1000000, size   1MB
DEVICE_CS0 ....base fa000000, size   2MB
DEVICE_CS1 ....base f4000000, size  32MB
DEVICE_CS2 ....base fa800000, size   1MB
DEV_BOOCS ....base ff800000, size   8MB
CRYPTO ENG ....no such
Flash bankwidth 1, base ff800000, size 400000
BUFFALO KUROBOX FLASH size 4096[KB]

  Marvell Development Board (LSP Version 1.10.3.patch5_DB_NAS)-- BUFFALO_BOARD_K
UROBOX  Soc: 88F5182 A2

 Detected Tclk 166664740 and SysClk 250000000
Marvell USB EHCI Host controller #0: c04e4b00
Marvell USB EHCI Host controller #1: c04e4a40
pexBarOverlapDetect: winNum 2 overlap current 0
mvPexInit:Warning :Bar 2 size is illigal
it will be disabled
please check Pex and CPU windows configuration
PCI: bus0: Fast back to back transfers enabled
PCI: bus1: Fast back to back transfers enabled
SCSI subsystem initialized
usbcore: registered new driver usbfs
usbcore: registered new driver hub
Use the XOR engines (offloading) for enhancing the following functions:
  o RAID 5 Xor calculation
  o kernel memcpy
  o kenrel memzero
  o copy user to/from kernel buffers
Number of XOR engines to use: 2
cesadev_init(c00122e0)
Fast Floating Point Emulator V0.9 (c) Peter Teichmann.
inotify device minor=63
JFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc.
SGI XFS with no debug enabled
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
ttyS0 at MMIO 0x0 (irq = 3) is a 16550A
ttyS1 at MMIO 0x0 (irq = 4) is a 16550A
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
RAMDISK driver initialized: 3 RAM disks of 32768K size 1024 blocksize
loop: loaded (max 8 devices)
Marvell Gigabit Ethernet Driver 'egiga':
  o Ethernet descriptors in DRAM
  o DRAM SW cache-coherency
  o Checksum offload enabled
  o Loading network interface ** egiga_init_module (10)
'eth0'
Intergrated Sata device found
scsi0 : Marvell SCSI to SATA adapter
scsi1 : Marvell SCSI to SATA adapter
  Vendor: WDC       Model: WD1600JD-75HBB0   Rev: 08.0
  Type:   Direct-Access                      ANSI SCSI revision: 03
SCSI device sda: 312500000 512-byte hdwr sectors (160000 MB)
SCSI device sda: drive cache: write back
SCSI device sda: 312500000 512-byte hdwr sectors (160000 MB)
SCSI device sda: drive cache: write back
 sda: sda1 sda2 sda3 sda4
Attached scsi disk sda at scsi0, channel 0, id 0, lun 0
Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0,  type 0
physmap flash device: 400000 at ff800000
Found: SST 39LF020
phys_mapped_flash: Found 1 x8 devices at 0x0 in 8-bit bank
number of JEDEC chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
RedBoot partition parsing not available
NAND device: Manufacturer ID: 0x20, Chip ID: 0xda (ST Micro NAND 256MiB 3,3V 8-b
it)
Scanning device for bad blocks
Bad eraseblock 223 at 0x01be0000
Bad eraseblock 572 at 0x04780000
Using static partition definition
Creating 3 MTD partitions on "nand_mtd":
0x00000000-0x00400000 : "uImage"
0x00400000-0x04400000 : "rootfs"
0x04400000-0x10000000 : "extra"
usbmon: debugs is not available
ehci_platform ehci_platform.4523: EHCI Host Controller
ehci_platform ehci_platform.4523: new USB bus registered, assigned bus number 1
ehci_platform ehci_platform.4523: irq 17, io mem 0x00000000
ehci_platform ehci_platform.4523: park 0
ehci_platform ehci_platform.4523: USB 0.0 initialized, EHCI 1.00, driver 10 Dec
2004
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ehci_platform ehci_platform.16781: EHCI Host Controller
ehci_platform ehci_platform.16781: new USB bus registered, assigned bus number 2
ehci_platform ehci_platform.16781: irq 12, io mem 0x00000000
ehci_platform ehci_platform.16781: park 0
ehci_platform ehci_platform.16781: USB 0.0 initialized, EHCI 1.00, driver 10 Dec
 2004
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
USB Universal Host Controller Interface driver v2.2
Initializing USB Mass Storage driver...
usb 2-1: new high speed USB device using ehci_platform and address 2
scsi2 : SCSI emulation for USB Mass Storage devices
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usbcore: registered new driver usbhid
drivers/usb/input/hid-core.c: v2.01:USB HID core driver
mice: PS/2 mouse device common for all mice
md: raid0 personality registered as nr 2
md: raid1 personality registered as nr 3
md: raid5 personality registered as nr 4
raid5: measuring checksumming speed
   arm4regs  :   304.000 MB/sec
   8regs     :   215.200 MB/sec
   32regs    :   249.200 MB/sec
raid5: using function: arm4regs (304.000 MB/sec)
md: md driver 0.90.1 MAX_MD_DEVS=256, MD_SB_DISKS=27
Buffalo Platform Linux Driver(Light) 0.01 installed.
MICON ctrl (C) BUFFALO INC. V.1.00 installed.
Kernel event proc (C) BUFFALO INC. V.1.00 installed.
MICON V2 (C) BUFFALO INC. V.1.00 installed.
NET: Registered protocol family 2
IP: routing cache hash table of 1024 buckets, 8Kbytes
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
NET: Registered protocol family 1
NET: Registered protocol family 17
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
XFS mounting filesystem sda2
VFS: Mounted root (xfs filesystem).
Freeing init memory: 112K
INIT: version 2.86 booting
Activating swap.
Checking root file system...
fsck 1.37 (21-Mar-2005)
/sbin/fsck.xfs: XFS file system.
  Vendor:           Model:                   Rev:
  Type:   Direct-Access                      ANSI SCSI revision: 02
sdb: Unit Not Ready, sense:
: Current: sense key=0x0
    ASC=0x0 ASCQ=0x0
sdb : READ CAPACITY failed.
sdb : status=1, message=00, host=0, driver=08
sd: Current: sense key=0x0
    ASC=0x0 ASCQ=0x0
sdb: assuming drive cache: write through
sdb: Unit Not Ready, sense:
: Current: sense key=0x0
    ASC=0x0 ASCQ=0x0
sdb : READ CAPACITY failed.
sdb : status=1, message=00, host=0, driver=08
sd: Current: sense key=0x0
    ASC=0x0 ASCQ=0x0
sdb: assuming drive cache: write through
 sdb:<6>sdb: Current: sense key=0x0
    ASC=0x0 ASCQ=0x0
 unknown partition table
Attached scsi disk sdb at scsi2, channel 0, id 0, lun 0
Attached scsi generic sg1 at scsi2, channel 0, id 0, lun 0,  type 0
System time was Wed May 16 23:14:12 UTC 2007.
Setting the System Clock using the Hardware Clock as reference...
System Clock set. System local time is now Thu May 17 08:14:13 JST 2007.
Cleaning up ifupdown...done.
Checking all file systems...
fsck 1.37 (21-Mar-2005)
Setting kernel variables ...
... done.
Mounting local filesystems...
Cleaning /tmp /var/run /var/lock.
Setting up networking...done.
* /etc/network/options is deprecated (see README.Debian of netbase).
Setting up IP spoofing protection...done (rp_filter).
Configuring network interfaces...Internet Software Consortium DHCP Client 2.0pl5
Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.
All rights reserved.

Please contribute if you find this software useful.
For info, please visit https://www.isc.org/dhcp-contrib.html

eth0: link down
Listening on LPF/eth0/00:16:01:a4:ca:c5
Sending on   LPF/eth0/00:16:01:a4:ca:c5
Sending on   Socket/fallback/fallback-net
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
eth0: link up<5>, full duplex<5>, speed 100 Mbps<5>
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
DHCPOFFER from 172.18.21.1
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPACK from 172.18.21.1
bound to 172.18.21.14 -- renewal in 86400 seconds.
done.

Setting the System Clock using the Hardware Clock as reference...
System Clock set. Local time: Thu May 17 08:14:28 JST 2007

Initializing random number generator...done.
INIT: Entering runlevel: 2
Starting system log daemon: syslogd.
Starting kernel log daemon: klogd.
Starting internet superserver: inetd.
Starting internet superserver: xinetd.
Starting periodic command scheduler: cron.

Debian GNU/Linux 3.1 KUROBOX-PRO ttyS0

KUROBOX-PRO login:

Debian Sarge が起動しています。

sarge から etch へのアップグレード

「apt-get dist-upgrade」を実行してsarge から etch へのアップグレードを行います。

Debian GNU/Linux 3.1 localhost
KUROBOX-PRO login: kuro
Password:
Last login: Thu May 17 07:52:40 2007 from 172.18.21.65 on pts/0
Linux KUROBOX-PRO 2.6.12.6-arm1 #2 Thu Feb 8 15:00:20 JST 2007 armv5tejl GNU/Linux

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
kuro@KUROBOX-PRO:~$ su
Password:
KUROBOX-PRO:/home/kuro# apt-get update
Hit https://cdn.debian.or.jp stable/main Packages
Hit https://cdn.debian.or.jp stable/main Release
Hit https://cdn.debian.or.jp stable/main Sources
Hit https://cdn.debian.or.jp stable/main Release
Hit https://security.debian.org stable/updates/main Packages
Get:1 https://security.debian.org stable/updates/main Release [96B]
Fetched 96B in 1s (68B/s)
Reading Package Lists... Done

KUROBOX-PRO:/home/kuro# apt-get dist-upgrade
Reading Package Lists... Done
Building Dependency Tree... Done
Calculating Upgrade... Done
The following packages will be REMOVED:
  libnewt0.51
The following NEW packages will be installed:
  debian-archive-keyring gcc-4.1-base gnupg gpgv laptop-detect libbz2-1.0
  libdb4.4 libdevmapper1.02 libldap2 libncursesw5 libnewt0.52 libsasl2-2
  libselinux1 libsepol1 libsigc++-2.0-0c2a libslang2 libssl0.9.8 libstdc++6
  libusb-0.1-4 mktemp sysvinit-utils tasksel-data
The following packages will be upgraded:
  adduser apt apt-utils aptitude base-files base-passwd bash bsdmainutils
  bsdutils console-common console-data console-tools coreutils cpio cron
  debconf debconf-i18n debianutils dhcp-client dpkg dselect e2fslibs e2fsprogs
  exim4-config fdutils findutils gcc-3.3-base gettext-base grep groff-base
  gzip hostname ifupdown info initscripts iptables iputils-ping klogd libacl1
  libattr1 libblkid1 libcomerr2 libconsole libdb1-compat libdb3 libdb4.2
  libgcc1 libgdbm3 libgpmg1 liblocale-gettext-perl liblockfile1 liblzo1
  libpam-modules libpam-runtime libpam0g libpcre3 libperl5.8 libpopt0 libss2
  libssl0.9.7 libstdc++5 libtext-charwidth-perl libtext-iconv-perl
  libtext-wrapi18n-perl libtextwrap1 libuuid1 libwrap0 login logrotate makedev
  man-db manpages modutils mount nano ncurses-base ncurses-bin net-tools nvi
  passwd perl-base procps sed sysklogd sysv-rc sysvinit tar tasksel tcpd
  util-linux wget whiptail zlib1g
93 upgraded, 22 newly installed, 1 to remove and 0 not upgraded.
Need to get 34.1MB of archives.
After unpacking 23.5MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://cdn.debian.or.jp stable/main libslang2 2.0.6-4 [412kB]
Get:2 https://cdn.debian.or.jp stable/main whiptail 0.52.2-10 [34.4kB]
Get:3 https://cdn.debian.or.jp stable/main libnewt0.52 0.52.2-10 [63.1kB]
Get:4 https://cdn.debian.or.jp stable/main libpopt0 1.10-3 [32.2kB]
 :
 :省略
 :

途中でダイアログが開いて質問されますが、critical を選んで最小限の質問で済ませます。細かい設定は後で行えばいいでしょう。

 Debian Configuration

 +--------------------------- Configuring debconf ---------------------------+
 x Debconf prioritizes the questions it asks you. Pick the lowest priority   x
 x of question you want to see:                                              x
 x   - 'critical' only prompts you if the system might break.                x
 x     Pick it if you are a newbie, or in a hurry.                           x
 x   - 'high' is for rather important questions                              x
 x   - 'medium' is for normal questions                                      x
 x   - 'low' is for control freaks who want to see everything                x
 x                                                                           x
 x                                                                           x
 x Note that no matter what level you pick here, you will be able to see     x
 x every question if you reconfigure a package with dpkg-reconfigure.        x
 x                                                                           x
 x Ignore questions with a priority less than:                               x
 x                                                                           x
 x                                 critical                                  x
 x                                 high                                      x
 x                                 medium                                    x
 x                                 low                                       x
 x                                                                           x
 x                                                                           x
 x                    <Ok>                        <Cancel>                   x
 x                                                                           x
 +---------------------------------------------------------------------------+

 +---------------------------- Configuring debconf --------------------------+
 x Packages that use debconf for configuration share a common look and       x
 x feel. You can select the type of user interface they use.                 x
 x                                                                           x
 x The dialog frontend is a full-screen, character based interface, while    x
 x the readline frontend uses a more traditional plain text interface, and   x
 x both the gnome and kde frontends are modern X interfaces, fitting the     x
 x respective desktops (but may be used in any X environment). The editor    x
 x frontend lets you configure things using your favorite text editor. The   x
 x noninteractive frontend never asks you any questions.                     x
 x                                                                           x
 x Interface to use:                                                         x
 x                                                                           x
 x                              Dialog                                       x
 x                              Readline                                     x
 x                              Gnome                                        x
 x                              Kde                                          x
 x                              Editor                                       x
 x                              Noninteractive                               x
 x                                                                           x
 x                                                                           x
 x                    <Ok>                        <Cancel>                   x
 x                                                                           x
 +---------------------------------------------------------------------------+
 :
 :省略
 :
debconf: (Can't locate Term/ReadLine.pm in @INC (@INC contains: /etc/perl /usr/l
ocal/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5
/usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at /usr/share/
perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype

KUROBOX-PRO:/home/kuro#

リブートして起動確認

Etchが起動することを確認します。またバックアップ用にapt-get clean を実行しておきます。

Debian GNU/Linux 4.0
KUROBOX-PRO login: kuro
Password:
Last login: Thu May 17 09:17:46 2007 from 172.18.21.65 on pts/1
Linux KUROBOX-PRO 2.6.12.6-arm1 #2 Thu Feb 8 15:00:20 JST 2007 armv5tejl

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
kuro@KUROBOX-PRO:~$ su
Password:
KUROBOX-PRO:/home/kuro# mount /dev/sda2 /mnt
KUROBOX-PRO:/home/kuro# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda4              2929652    195152   2734500   7% /
tmpfs                    63164         0     63164   0% /lib/init/rw
tmpfs                    63164         0     63164   0% /dev/shm
/dev/sda2              2929652    195152   2734500   7% /mnt

KUROBOX-PRO:/home/kuro# apt-get clean

KUROBOX-PRO:/home/kuro# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda4              2929652    161672   2767980   6% /
tmpfs                    63164         0     63164   0% /lib/init/rw
tmpfs                    63164         0     63164   0% /dev/shm
/dev/sda2              2929652    161672   2767980   6% /mnt
KUROBOX-PRO:/home/kuro#

Debian etchをバックアップ

HDDブート環境に戻してUSB接続したDebian etchをバックアップします。

KUROUTOSHIKOU KUROBOX Series
KUROBOX-PRO login: root
Password:


BusyBox v1.1.1 (2006.11.29-02:37+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ # mount /dev/sdb2 /mnt/sdb2
~ # cd /mnt/sdb2
/mnt/sdb2 # time tar zcf /home/src/kpro_etch20070516.tar.gz *
tar: dev/log: socket ignored
real    17m 3.51s
user    15m 42.40s
sys     1m 11.51s
/mnt/sdb2 # cd /home/src
/home/src # ls -l kpro_etch20070516.tar.gz
-rw-r--r--    1 root   root   57091450 May 17 09:46 kpro_etch20070516.tar.gz

結構時間がかかりますが、がまん。


電源ボタンでのシャットダウンやファンコントロールはmiconapl互換コマンドの作成 を参考にして下さい。




ご意見・ご感想は,こちらの掲示板 まで.