開発環境のインストール
hackkit
C 言語で書かれたソースをコンパイルするためには
開発環境をインストールしておく必要があります。
ここでは、最低限の開発環境をインストールします。
開発環境のインストール
make, gcc, libc6-dev および
付随するパッケージをインストールします。
コンパイルするモノによって他にもパッケージが必要な場合があります。
slam:~# apt-get update
Get:1 http://ftp.jp.debian.org lenny Release.gpg [1032B]
Get:2 http://ftp.jp.debian.org lenny Release [73.6kB]
Ign http://ftp.jp.debian.org lenny/main Packages/DiffIndex
Ign http://ftp.jp.debian.org lenny/main Sources/DiffIndex
Get:3 http://security.debian.org lenny/updates Release.gpg [1032B]
Get:4 http://ftp.jp.debian.org lenny/main Packages [6706kB]
Get:5 http://security.debian.org lenny/updates Release [40.8kB]
Ign http://security.debian.org lenny/updates/main Packages/DiffIndex
Ign http://security.debian.org lenny/updates/main Sources/DiffIndex
Get:6 http://security.debian.org lenny/updates/main Packages [150kB]
Get:7 http://security.debian.org lenny/updates/main Sources [42.8kB]
Get:8 http://ftp.jp.debian.org lenny/main Sources [2980kB]
Fetched 9995kB in 26s (370kB/s)
Reading package lists... Done
slam:~# apt-get install make gcc libc6-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
binutils cpp cpp-4.3 gcc-4.3 libgmp3c2 libgomp1 libmpfr1ldbl linux-libc-dev
Suggested packages:
binutils-doc cpp-doc gcc-4.3-locales gcc-multilib manpages-dev autoconf
automake1.9 libtool flex bison gdb gcc-doc libmudflap0-4.3-dev gcc-4.3-doc
libgcc1-dbg libgomp1-dbg libmudflap0-dbg glibc-doc make-doc
The following NEW packages will be installed:
binutils cpp cpp-4.3 gcc gcc-4.3 libc6-dev libgmp3c2 libgomp1 libmpfr1ldbl
linux-libc-dev make
0 upgraded, 11 newly installed, 0 to remove and 15 not upgraded.
Need to get 10.2MB of archives.
After this operation, 31.6MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.jp.debian.org lenny/main binutils 2.18.1~cvs20080103-7 [2601kB]
Get:2 http://security.debian.org lenny/updates/main linux-libc-dev 2.6.26-15lenny3 [744kB]
Get:3 http://ftp.jp.debian.org lenny/main libgmp3c2 2:4.2.2+dfsg-3 [182kB]
Get:4 http://ftp.jp.debian.org lenny/main libmpfr1ldbl 2.3.1.dfsg.1-2 [340kB]
Get:5 http://ftp.jp.debian.org lenny/main cpp-4.3 4.3.2-1.1 [3026kB]
Get:6 http://ftp.jp.debian.org lenny/main cpp 4:4.3.2-2 [13.9kB]
Get:7 http://ftp.jp.debian.org lenny/main libgomp1 4.3.2-1.1 [13.9kB]
Get:8 http://ftp.jp.debian.org lenny/main gcc-4.3 4.3.2-1.1 [458kB]
Get:9 http://ftp.jp.debian.org lenny/main gcc 4:4.3.2-2 [5024B]
Get:10 http://ftp.jp.debian.org lenny/main libc6-dev 2.7-18 [2429kB]
Get:11 http://ftp.jp.debian.org lenny/main make 3.81-5 [385kB]
Fetched 10.2MB in 13s (736kB/s)
Selecting previously deselected package binutils.
(Reading database ... 10020 files and directories currently installed.)
Unpacking binutils (from .../binutils_2.18.1~cvs20080103-7_armel.deb) ...
Selecting previously deselected package libgmp3c2.
Unpacking libgmp3c2 (from .../libgmp3c2_2%3a4.2.2+dfsg-3_armel.deb) ...
Selecting previously deselected package libmpfr1ldbl.
Unpacking libmpfr1ldbl (from .../libmpfr1ldbl_2.3.1.dfsg.1-2_armel.deb) ...
Selecting previously deselected package cpp-4.3.
Unpacking cpp-4.3 (from .../cpp-4.3_4.3.2-1.1_armel.deb) ...
Selecting previously deselected package cpp.
Unpacking cpp (from .../cpp_4%3a4.3.2-2_armel.deb) ...
Selecting previously deselected package libgomp1.
Unpacking libgomp1 (from .../libgomp1_4.3.2-1.1_armel.deb) ...
Selecting previously deselected package gcc-4.3.
Unpacking gcc-4.3 (from .../gcc-4.3_4.3.2-1.1_armel.deb) ...
Selecting previously deselected package gcc.
Unpacking gcc (from .../gcc_4%3a4.3.2-2_armel.deb) ...
Selecting previously deselected package linux-libc-dev.
Unpacking linux-libc-dev (from .../linux-libc-dev_2.6.26-15lenny3_armel.deb) ...
Selecting previously deselected package libc6-dev.
Unpacking libc6-dev (from .../libc6-dev_2.7-18_armel.deb) ...
Selecting previously deselected package make.
Unpacking make (from .../archives/make_3.81-5_armel.deb) ...
Processing triggers for man-db ...
Setting up binutils (2.18.1~cvs20080103-7) ...
Setting up libgmp3c2 (2:4.2.2+dfsg-3) ...
Setting up libmpfr1ldbl (2.3.1.dfsg.1-2) ...
Setting up cpp-4.3 (4.3.2-1.1) ...
Setting up cpp (4:4.3.2-2) ...
Setting up libgomp1 (4.3.2-1.1) ...
Setting up gcc-4.3 (4.3.2-1.1) ...
Setting up gcc (4:4.3.2-2) ...
Setting up linux-libc-dev (2.6.26-15lenny3) ...
Setting up libc6-dev (2.7-18) ...
Setting up make (3.81-5) ...
slam:~#
確認
yasunari@slam:/tmp$ cd /tmp
yasunari@slam:/tmp$ echo 'main() { printf("Why DO NOT you hack HS-DHGL?\n");}'>a
.c
yasunari@slam:/tmp$ cc a.c
a.c: In function 'main':
a.c:1: warning: incompatible implicit declaration of built-in function 'printf'
yasunari@slam:/tmp$ ./a.out
Why DO NOT you hack HS-DHGL?
yasunari@slam:/tmp$
上のように"Why DO NOT you hack HS-DHGL?"と表示されればOKです。
第三世代 LinkStation/玄箱をハックしよう
LinkStation/玄箱をハックしよう
Copyright (C) 2008-2011 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市