基本的には、
Debian 7.1 のインストール(1)ディレクトリツリーの作成
と同じ。
ただし、使うのは、LS410D + 標準ファーム
[root@LS410D06E ~]# which ar /usr/bin/ar [root@LS410D06E ~]# which wget /usr/bin/wget [root@LS410D06E ~]# ls -l /usr/bin/ar lrwxrwxrwx 1 root root 17 Jul 4 22:55 /usr/bin/ar -> ../../bin/busybox* [root@LS410D06E ~]# ls -l /usr/bin/wget -rwxr-xr-x 1 root root 328016 Jul 5 00:42 /usr/bin/wget* [root@LS410D06E ~]#あるある。
[root@LS410D06E ~]# cd /tmp [root@LS410D06E tmp]# wget http://ftp.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.55_all.deb --2013-10-28 23:51:13-- http://ftp.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.55_all.deb Resolving ftp.debian.org... 130.89.148.12, 2001:610:1908:b000::148:12 Connecting to ftp.debian.org|130.89.148.12|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 55628 (54K) [application/x-debian-package] Saving to: `debootstrap_1.0.55_all.deb' 100%[======================================>] 55,628 92.4K/s in 0.6s 2013-10-28 23:51:14 (92.4 KB/s) - `debootstrap_1.0.55_all.deb' saved [55628/55628] [root@LS410D06E tmp]#
[root@LS410D06E tmp]# ar -x debootstrap_1.0.55_all.deb [root@LS410D06E tmp]# cd / [root@LS410D06E /]# zcat /tmp/data.tar.xz | tar tv zcat: invalid magic tar: This does not look like a tar archive tar: Exiting with failure status due to previous errors [root@LS410D06E /]#がー。xz やん。
ところで、標準ファームに xz ってあるの?
[root@LS410D06E /]# which xz /usr/bin/xz [root@LS410D06E /]# ls -l /usr/bin/xz -rwxr-xr-x 1 root root 56340 Jul 5 00:42 /usr/bin/xz* [root@LS410D06E /]#ある!
[root@LS410D06E /]# xz -dv /tmp/data.tar.xz /tmp/data.tar.xz (1/1) 100 % 53.0 KiB / 220.0 KiB = 0.241 [root@LS410D06E /]# tar xvf /tmp/data.tar ./ ./usr/ ./usr/share/ ./usr/share/man/ : : ./usr/share/debootstrap/scripts/stable ./usr/share/debootstrap/scripts/jessie ./usr/share/debootstrap/scripts/trusty [root@LS410D06E /]#
[root@LS410D06E ~]# vi makehackkit_131030.sh
:
:
[root@LS410D06E ~]# cat !$
cat makehackkit_131030.sh
#!/bin/sh
#
# Copyright (C) 2013 Yasunari YAMASHITA. All Rights Reserved.
#
set -x
DEBINST=/mnt/disk1/debinst
ARCH=armhf
VERSION=wheezy
# make working directory
rm -fr $DEBINST
mkdir -p $DEBINST
# exec debootstrap
cd /
date
/usr/sbin/debootstrap --arch $ARCH $VERSION $DEBINST http://ftp.jp.debian.org/debian
date
# copy /dev
(cd / ; tar cf - dev)|(cd $DEBINST; tar xvf -)
# mount /proc
chroot $DEBINST mount -t proc /proc proc
# reconfigure TimeZone
chroot $DEBINST dpkg-reconfigure tzdata
# edit /etc/apt/sources.list
(
echo deb-src http://ftp.jp.debian.org/debian $VERSION main
echo
echo deb http://security.debian.org/ $VERSION/updates main
echo deb-src http://security.debian.org/ $VERSION/updates main
) >> $DEBINST/etc/apt/sources.list
# update package lists
chroot $DEBINST apt-get update
chroot $DEBINST apt-get -y -f install
chroot $DEBINST apt-get -y upgrade
# install & reconfigure locales
chroot $DEBINST apt-get install locales
chroot $DEBINST dpkg-reconfigure locales
# install ssh
chroot $DEBINST apt-get install ssh
# update password of root
chroot $DEBINST passwd root
# install some packages
chroot $DEBINST apt-get -y install xfsprogs psmisc sudo inetutils-telnetd
# edit /etc/inetd.conf
TARGETFILE=$DEBINST/etc/inetd.conf
mv $TARGETFILE{,.orig}
sed \
-e 's/^## telnet/telnet/' \
$TARGETFILE.orig > $TARGETFILE
rm $TARGETFILE.orig
# add guest user
chroot $DEBINST adduser --gecos "" guest
rm -fr $DEBINST/home/guest
# create /initrd
mkdir $DEBINST/initrd
# edit /etc/inittab
TARGETFILE=$DEBINST/etc/inittab
mv $TARGETFILE{,.orig}
sed \
-e 's/^\([0-9]:[0-9]*:respawn:.*\)$/#\1/' \
-e '/^#T1/aT0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100' \
$TARGETFILE.orig > $TARGETFILE
rm $TARGETFILE.orig
# clean up
chroot $DEBINST apt-get clean
[root@LS410D06E ~]#
実行する。
[root@LS410D06E ~]# sh !$ sh makehackkit_131030.sh + DEBINST=/mnt/disk1/debinst + ARCH=armhf + VERSION=wheezy + rm -fr /mnt/disk1/debinst + mkdir -p /mnt/disk1/debinst + cd / + date Thu Oct 31 00:09:58 JST 2013 + /usr/sbin/debootstrap --arch armhf wheezy /mnt/disk1/debinst http://ftp.jp.debian.org/debian I: Retrieving Release W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg I: Retrieving Packages I: Validating Packages I: Resolving dependencies of required packages... : : I: Base system installed successfully. + date Thu Oct 31 00:27:37 JST 2013 : : + chroot /mnt/disk1/debinst dpkg-reconfigure tzdata Package configuration lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring tzdata tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x Please select the geographic area in which you live. Subsequent configuration questions will narrow x x this down by presenting a list of cities, representing the time zones in which they are located. x x x x Geographic area: x x x x Africa x x America x x Antarctica x x Australia x x Arctic Ocean x x Asia x x Atlantic Ocean x x Europe x x Indian Ocean x x Pacific Ocean x x System V timezones x x US x x None of the above x x x x x x <Ok> <Cancel> x x x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjAsia を選ぶ
Package configuration
lqqqqqqqqqqqqqqqqqqqqqqqu Configuring tzdata tqqqqqqqqqqqqqqqqqqqqqqqk
x Please select the city or region corresponding to your time zone. x
x x
x Time zone: x
x x
x Pyongyang x
x Qatar a x
x Qyzylorda a x
x Rangoon a x
x Riyadh a x
x Riyadh87 a x
x Riyadh88 a x
x Riyadh89 a x
x Sakhalin a x
x Samarkand a x
x Seoul a x
x Shanghai a x
x Singapore a x
x Taipei a x
x Tashkent a x
x Tbilisi a x
x Tehran a x
x Tel Aviv a x
x Thimphu a x
x Tokyo a x
x Ujung Pandang a x
x Ulaanbaatar a x
x Urumqi a x
x Ust-Nera a x
x Vientiane x
x Vladivostok a x
x Yakutsk a x
x Yekaterinburg a x
x Yerevan x
x x
x x
x <Ok> <Cancel> x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
Tokyo を選ぶ
Current default time zone: 'Asia/Tokyo'
Local time is now: Thu Oct 31 00:28:44 JST 2013.
Universal Time is now: Wed Oct 30 15:28:44 UTC 2013.
+ echo deb-src http://ftp.jp.debian.org/debian wheezy main
+ echo
+ echo deb http://security.debian.org/ wheezy/updates main
+ echo deb-src http://security.debian.org/ wheezy/updates main
+ chroot /mnt/disk1/debinst apt-get update
Get:1 http://ftp.jp.debian.org wheezy Release.gpg [1672 B]
Hit http://ftp.jp.debian.org wheezy Release
:
:
Selecting previously unselected package locales.
(Reading database ... 9298 files and directories currently installed.)
Unpacking locales (from .../locales_2.13-38_all.deb) ...
Processing triggers for man-db ...
Setting up locales (2.13-38) ...
Generating locales (this might take a while)...
Generation complete.
+ chroot /mnt/disk1/debinst dpkg-reconfigure locales
Package configuration
lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring locales tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Locales are a framework to switch between multiple languages and allow users to use their language, x
x country, characters, collation order, etc. x
x x
x Please choose which locales to generate. UTF-8 locales should be chosen by default, particularly for x
x new installations. Other character sets may be useful for backwards compatibility with older systems x
x 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 a x
x [ ] iw_IL.UTF-8 UTF-8 ` x
x [*] ja_JP.EUC-JP EUC-JP a x
x [*] ja_JP.UTF-8 UTF-8 a x
x [ ] ka_GE GEORGIAN-PS ↓ x
x x
x x
x <Ok> <Cancel> x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
ja_JP.EUC-JP EUC-JPとja_JP.UTF-8 UTF-8とをインストールしておく
Package configuration lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Configuring locales tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x Many packages in Debian use locales to display text in the correct language for the user. You can x x choose a default locale for the system from the generated locales. x x x x This will select the default language for the entire system. If this system is a multi-user system x x where not all users are able to speak the 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 <Ok> <Cancel> x x x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjデフォルトは ja_JP.UTF-8 にする
Generating locales (this might take a while)... ja_JP.EUC-JP... done ja_JP.UTF-8... done Generation complete. : : Setting up tcpd (7.6.q-24) ... Setting up xauth (1:1.0.7-1) ... Setting up ssh (1:6.0p1-4) ... + chroot /mnt/disk1/debinst passwd root Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully : : in auto mode Setting up libfile-copy-recursive-perl (0.38-1) ... Setting up update-inetd (4.43) ... Setting up inetutils-inetd (2:1.9-2) ... [warn] Not starting internet superserver: no services enabled. ... (warning). Setting up inetutils-telnetd (2:1.9-2) ... + TARGETFILE=/mnt/disk1/debinst/etc/inetd.conf + mv /mnt/disk1/debinst/etc/inetd.conf /mnt/disk1/debinst/etc/inetd.conf.orig + sed -e 's/^#<off># telnet/telnet/' /mnt/disk1/debinst/etc/inetd.conf.orig + rm /mnt/disk1/debinst/etc/inetd.conf.orig + chroot /mnt/disk1/debinst adduser --gecos '' 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 + rm -fr /mnt/disk1/debinst/home/guest + mkdir /mnt/disk1/debinst/initrd + TARGETFILE=/mnt/disk1/debinst/etc/inittab + mv /mnt/disk1/debinst/etc/inittab /mnt/disk1/debinst/etc/inittab.orig + sed -e 's/^\([0-9]:[0-9]*:respawn:.*\)$/#\1/' -e '/^#T1/aT0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100' /mnt/disk1/debinst/etc/inittab.orig + rm /mnt/disk1/debinst/etc/inittab.orig + chroot /mnt/disk1/debinst apt-get clean [root@LS410D06E ~]#
[root@LS410D06E ~]# cat /mnt/disk1/debinst/etc/adjtime cat: can't open '/mnt/disk1/debinst/etc/adjtime': No such file or directory [root@LS410D06E ~]#がー。ない。
/etc/init.d/hwclock.sh を見る
[root@LS410D06E ~]# less /mnt/disk1/debinst/etc/init.d/hwclock.sh : : # 2012-02-16 Roger Leighないなら、作ればよいらしい。# - Use the UTC/LOCAL setting in /etc/adjtime rather than # the UTC setting in /etc/default/rcS. Additionally # source /etc/default/hwclock to permit configuration. : : if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; t hen printf "0.0 0 0.0\n0\nUTC" > /etc/adjtime fi : [root@LS410D06E ~]#
[root@LS410D06E ~]# echo 0.0 0 0.0 > /mnt/disk1/debinst/etc/adjtime [root@LS410D06E ~]# echo 0 >> /mnt/disk1/debinst/etc/adjtime [root@LS410D06E ~]# echo LOCAL >> /mnt/disk1/debinst/etc/adjtime [root@LS410D06E ~]# cat !$ cat /mnt/disk1/debinst/etc/adjtime 0.0 0 0.0 0 LOCAL [root@LS410D06E ~]#さて、これで、できたかな。
[root@LS410D06E ~]# cat !$
cat makehackkit_131031.sh
#!/bin/sh
#
# Copyright (C) 2013 Yasunari YAMASHITA. All Rights Reserved.
#
set -x
DEBINST=/mnt/disk1/debinst
ARCH=armhf
VERSION=wheezy
# make working directory
rm -fr $DEBINST
mkdir -p $DEBINST
# exec debootstrap
cd /
date
/usr/sbin/debootstrap --arch $ARCH $VERSION $DEBINST http://ftp.jp.debian.org/debian
date
# copy /dev
(cd / ; tar cf - dev)|(cd $DEBINST; tar xvf -)
# mount /proc
chroot $DEBINST mount -t proc /proc proc
# reconfigure TimeZone
chroot $DEBINST dpkg-reconfigure tzdata
# edit /etc/apt/sources.list
(
echo deb-src http://ftp.jp.debian.org/debian $VERSION main
echo
echo deb http://security.debian.org/ $VERSION/updates main
echo deb-src http://security.debian.org/ $VERSION/updates main
) >> $DEBINST/etc/apt/sources.list
# update package lists
chroot $DEBINST apt-get update
chroot $DEBINST apt-get -y -f install
chroot $DEBINST apt-get -y upgrade
# install & reconfigure locales
chroot $DEBINST apt-get install locales
chroot $DEBINST dpkg-reconfigure locales
# install ssh
chroot $DEBINST apt-get install ssh
# update password of root
chroot $DEBINST passwd root
# install some packages
chroot $DEBINST apt-get -y install xfsprogs psmisc sudo inetutils-telnetd
# edit /etc/inetd.conf
TARGETFILE=$DEBINST/etc/inetd.conf
mv $TARGETFILE{,.orig}
sed \
-e 's/^## telnet/telnet/' \
$TARGETFILE.orig > $TARGETFILE
rm $TARGETFILE.orig
# add guest user
chroot $DEBINST adduser --gecos "" guest
rm -fr $DEBINST/home/guest
# create /initrd
mkdir $DEBINST/initrd
# edit /etc/inittab
TARGETFILE=$DEBINST/etc/inittab
mv $TARGETFILE{,.orig}
sed \
-e 's/^\([0-9]:[0-9]*:respawn:.*\)$/#\1/' \
-e '/^#T1/aT0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100' \
$TARGETFILE.orig > $TARGETFILE
rm $TARGETFILE.orig
# clean up
chroot $DEBINST apt-get clean
# create /etc/adjtime
(
echo 0.0 0 0.0
echo 0
echo LOCAL
) > /mnt/disk1/debinst/etc/adjtime
# umount /proc
chroot $DEBINST umount /proc
# make archive
cd $DEBINST
tar zcvf /mnt/disk1/share/hackkit/hackkit_"$VERSION"_"$ARCH"_`date +%y%m%d`.tar.gz .
[root@LS410D06E ~]#
こんなところか??
|
|
← 最初の設定~ftp サーバ、開発環境のインストール |
ハックの記録 LinkStation/玄箱 をハックしよう |
→ armhf でハックキット(2)インストール |
Copyright (C) 2003-2013 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市