0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

玄箱の debian 化メモ

Last updated at Posted at 2025-07-23

玄箱の Debian 化

訓練用に Debian 3.0 (woody) をログインできるところまで構築してみる。

作業環境

  • 玄箱(初代/HG)
    • ハードウェアの改造
      • シリアル コンソール使用可
    • U-Boot 化済み

玄箱の初期化

  1. EM モードで起動
  2. HDD の初期化
  3. 通常モードで起動

EM モードにする方法

  • 一旦 HDD を外す
  • 初期化スイッチ
  • echo -n "NGNG" > dev/fl3
  • U-Boot プロンプトで run writeng

など

アプリのインストール

玄箱にログイン
KURO-BOX login: root
Password: (kuro/kuroadmin)

以下、パスワードの変更やログイン操作は省略します。

■ 付属 CD にある開発環境をインストール

セットアップ ディスクの binray ディレクトリを玄箱にコピーした後

開発環境のインストール
# cd "binrayのパス"
# for f in *.tar.gz; do echo; echo $f; tar -C / -zxvf $f; done

以下、ビルド用の適当な作業ディレクトリを用意

■ GNU wget-1.5.3 (https://ftp.gnu.org/pub/gnu/wget/) をインストール

ソースコードは別 OS でダウンロードして持ってくる。

wget-1.5.3のビルド&インストール
# tar zxvf wget-1.5.3.tar.gz
# cd wget-1.5.3
# ./configure
# make
# make install

この wget は https 非対応です

■ GNU coreutils-5.2.1 をインストール

coreutils-5.2.1のビルド&インストール
# wget http://ftp.gnu.org/pub/gnu/coreutils/coreutils-5.2.1.tar.bz2
# tar jxvf coreutils-5.2.1.tar.bz2
# cd coreutils-5.2.1
# ./configure
# make
# make install

■ GNU gzip-1.2.4 をインストール

gzip-1.2.4のビルド&インストール
# wget http://ftp.gnu.org/pub/gnu/gzip/gzip-1.2.4.tar.gz
# tar zxvf gzip-1.2.4.tar.gz
# cd gzip-1.2.4
# ./configure
# make
# make install

Debian 3.0 (woody) の構築

debootstrapのインストールと実行
# cd /mnt
# wget http://archive.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.67_all.deb
# ar vx debootstrap_1.0.67_all.deb data.tar.gz
# tar -C / -zxvf data.tar.gz
# mkdir debian-root
# /usr/sbin/debootstrap --arch powerpc \
--include=less,ntpdate,pmac-fdisk,ssh,sudo,timezoneconf,xinetd \
--exclude=amiga-fdisk,mac-fdisk,openbsd-inetd,pcmcia-cs,yaboot \
woody debian-root http://archive.debian.org/debian
# cd debian-root

/mnt/debian-root以下を修正する。

ログイン可能なところまで

デバイス ファイル / カーネル モジュールの用意

カーネルはそのままなので幾つかそのまま使う。

モジュールなどをそのまま使う
# tar -C /lib/modules -cf - `uname -r` | tar -C /mnt/debian-root/lib/modules -xvf -
# tar -C / -cf - dev | tar -C /mnt/debian-root -xvf -
# tar -C /etc -cf - fstab inittab securetty modules modules.conf | tar -C /mnt/debian-root/etc -xvf -

etc/inittab 設定(シリアル コンソールでのログイン)

etc/inittab(差分)
-con:2345:respawn:/sbin/getty console
+T0:2345:respawn:/sbin/getty -L ttyS0 57600 vt100

ttyS1関係の設定

ppc_uartdをそのまま使う
# tar -C / -cf - usr/sbin/ppc_uartd | tar -C /mnt/debian-root -xvf -
# tar -C /etc -cf - init.d/ppc_uartd | tar -C /mnt/debian-root/etc -xvf -
# (cd /mnt/debian-root;\
(cd etc/rc0.d; ln -s ../init.d/ppc_uartd K95ppc_uartd);\
(cd etc/rc2.d; ln -s ../init.d/ppc_uartd S95ppc_uartd);\
(cd etc/rc6.d; ln -s ../init.d/ppc_uartd K95ppc_uartd);)

etc/init.d下のhalt,reboot を修正

shutdownコマンドでの電源切断対応

etc/init.d/halt(差分)
+echo -n "EEEE" > /dev/ttyS1
 halt -d -f -i -p $hddown

rebootコマンドで再起動対応

etc/init.d/reboot(差分)
 echo -n "Rebooting... "
+echo -n "CCCC" > /dev/ttyS1
 reboot -d -f -i

ネットワーク設定

ネットワーク環境に応じて修正が必要です。

etc/hostname
KURO-BOX
etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

動作テスト

とりあえず動かしてみる。

ルート パーティションを debian(woody) にする

EMモードにする
# echo -n "NGNG" > /dev/fl3
# sync; reboot
HDDのルートをwoodyに
# mke2fs -j /dev/hda1
# mount /dev/hda1 /mnt
# mount /dev/hda3 /mnt2
# tar -C /mnt2/debian-root -cf - . | tar -C /mnt -xvf -
通常モードにする
# echo -n "OKOK" > /dev/fl3
# sync; reboot
ログイン可(root:パスワードなし)
Debian GNU/Linux 3.0 (none) ttyS0

(none) login:

電源ボタンに反応しないなど問題があるが、Debian 3.0 として起動したので、apt-getなどが利用可。あとは好きにカスタマイズする。

セキュリティ関係は適切なものに変更してください


Debian 3.1 (sarge) でもほぼ同様

Debian 4.0/5.0/6.0 (etch/lenny/squeeze) ではカーネル 2.6 を使用

  • sarge のカーネルを 2.6 にしてから構築作業する
    • HDD のデバイス名が hda から sda になる
    • 作業領域(パーティションの取り回し)に注意する
  • etc/init.d下のhalt, rebootttyS1出力(パッチ)は不要
    • ppc_uartdも不使用
  • debootstrap--includeudevを追加

Debian 7.x (wheezy) ではカーネル 3.2 を使用

  • Debian 4/5/6 に加えて
    • rootではログインできないのでetc/shadowのパスワードを変更
      • ユーザーを追加したら/etc/shadowを戻す

Debian 8.x (jessie) ではカーネル 3.19 を使用

  • Debian 7 に加えて
    • debootstrapでは--includesystemdを追加

カーネルはこちらの方法でビルド

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?