mini2440にDebian環境をインストール environment installed Debian on mini2440

[| ]最終更新: 2010/07/25 11:28:31 [|] Last modified: 2010/07/25 11:28:31    origin page: http://www.mech.tohoku-gakuin.ac.jp/rde/contents/tech/mini2440/install_s.html

はじめに Introduction

このページではmini2440ボードに最低限のLinux環境をインストール します。 This page is the minimum Board mini2440 install Linux environment.

mini2440 ボードはオンボードに64M(最近のモデルではより大量)のFlashメモリを積んでいて、ここをファイルシステムとして使えます。 Board on board mini2440 64M (recent mass models than) the Flash memory they loaded, you can use this as a file system. それと同時 にオンボードでSDカードのスロットがあり、こちらもLinuxから利用可能です。 At the same time there is on-board SD card slot, also is available on Linux.
コンパクト な固定のシステムを作る場合には、当然オンボードで動作させた方が部品も少なくいいのですが、デバッグしたり、更新したりすることを考えると、最初から SDカードに詰めてしまった方がいろいろと便利です。 If you make a compact system fixed, I hope those parts less obviously operating at board or debugging, or to update considering that, from the beginning had packed SD card It is more convenient for everything.
というわけ で、SDカード上にカーネルをインストールし、ファイルシステムを構築します。 So, SD card and install a kernel and file system.

主に、 Mainly

を行いま す。 Performed.

なお、以下 の記述はほぼ、 project4funmini2440 Bootstrap Lenny for your ARM boardの解説をもとに、実際に確認した手順をまとめています。 The following description is almost, Project4Fun and mini2440 Bootstrap Lenny for your ARM board based on the commentary summarizes the steps to actually see.
また、ツー ル類は開 発環境の準備でインストールしたものを使用しています。 The tools are ready development environment was used to install.

また、イン ストールするのはDebian/Ubuntu系のarmelアーキテクチャのセットですが、Ubuntuはバージョンが進むにつれ、最適化されている ARMの種類が上がるようです。 Also, install the Debian / Ubuntu system is a set of architecture armel, Ubuntu is the version progresses, which is optimized for the ARM as the kind of rise. mini2440 のARM9(ARM920T)はARMv4アーキテクチャで、それに対応するのがDebian 5(lenny)の模様です。 mini2440 the ARM9 (ARM920T) ARMv4 architecture is that of the corresponding Debian 5 (lenny) is a pattern. Ubuntu になると、後続のARMv5,6,7になるため、mini2440の関連情報を探すとlennyになっているようです。 Ubuntu and a subsequent ARMv5, 6,7 to become, mini2440 lenny to look for relevant information seems to become.


ブートローダ U-Bootの構築 Construction of U-Boot bootloader

基本的に、FriendryARM提供のU-Bootで動作するので、ボードに インストールするため のU-Bootは不要ですが、カーネルイメージをU-Boot用に変換するために、ビルドします。 Basically, FriendryARM offer to work with U-Boot so, for installing U-Boot board is not required, the kernel image to convert the U-Boot for the building.

まず、 mini2440用に調整されているらしい、u-bootのソースを取得します。 First, mini2440 seems to be tuned for, u-boot to get the source.

$ mkdir uboot ; cd uboot 
$ git clone git://repo.or.cz/u-boot-openmoko/mini2440.git
$ ls
mini2440
$ tar cvzof uboot-mini2440_git_orig.tar.gz mini2440
$ cd mini2440
$ export CROSS_COMPILE=arm-linux-
$ make mini2440_config moment these days in PC flow Whoops mat for a few minutes
$ make mini2440_config 一瞬$ make all 今時のPCでざーっと流れて2,3分$ make all
$


2010/07/19 現在でgitで持ってきたもの.tar.gz↑ 2010/07/19, brought in git now. http://www.mech.tohoku-gakuin.ac.jp/rde/contents/tech/mini2440/archive/uboot-mini2440_git_orig.tar.gz 

念のための 確認として、コンパイル時には arm-linux-gccが呼ばれているはずです。 As a check, just in case the compiler arm-linux-gcc should have been called. 生成される ファイルはu-boot.bin(バイナリ) u-boot(ELF binary) u-boot.srec(モトローラS形式)です。 The generated files u-boot.bin (binary) u-boot (ELF binary) u-boot.srec (Motorola S format).
※最終的に どれを書き込むのかは不明。 I write the final ※ which is unknown.



カーネルの 取得と構築 And build a kernel from

まず、mini2440用に調整されているらしい、カーネルソースを取得しま す。 First, mini2440 seems to be tailored to get the kernel source.

$ mkdir kernel ; cd kernel
$ git clone git://repo.or.cz/linux-2.6/mini2440.git fairly slow to get
$ ls
mini2440
$ tar cvzof kernel-2.6.32_mini2440_git_orig.tar.gz mini2440
$

2010/07/19, brought in git now. http://www.mech.tohoku-gakuin.ac.jp/rde/contents/tech/mini2440/archive/kernel-2.6.32_mini2440_git_orig.tar.gz

つぎにビル ドの準備をします。 Prepare for the next build.
その際、 カーネルソースの一部を書き換えます。 In doing so, rewrite the part of the kernel source.

$ cd 2440 $ cd 2440
$ EDIT drivers/video/fbmem.c $ EDIT drivers/video/fbmem.c
書き換えポ イント(fbmem.c, 1050行付近、FBIOPUTでサーチ) Rewriting points (fbmem.c, near line 1050, FBIOPUT search in)
 case FBIOPUT_VSCREENINFO:
return 0; - insert this line;
if(copy_from_user(&var...))
return -EFAULT;
もと情報に よれば、どうも X をfbdevで動かすために必要な改造の模様です。 According to the original information, thanks to the fbdev X is a design need to move on reshuffle.
(改造の必 要性については未検証) (Not verified the need for remodeling)

また、 7inchの液晶を使う場合(後述)、そのままでは画面が点滅する問題が起きました。 In addition, 7inch LCD if you use (see below), as is the screen flashing problem occurred.
データシー トと照合すると誤植のようです。 Like a typo to match the data sheet. 以下の修正 で点滅が見られなくなりました。 Fix flash no longer seen below.
arch/arm/mach -s3c2440/mach-mini2440.cの250行目付近、mini2440+7"TFTに関する構造体の設定: arch/arm/mach-s3c2440/mach-mini2440.c near line 250, mini2440 +7 "TFT in the structure of:

 480, 29, 3, 3, /* y timing */
50), /* refresh rate */

480, 29, 13, 3, /* y timing */
60), /* refresh rate */
に (※refresh rateはタイミング的に可能に思われる) in (※ rate refresh timing is likely feasible)
N35の場 合は不要です。 If the N35 is not required. A70でも ロットによって違ったりするかもしれませんので、いきなり書き換えない方がいいかもしれません。 A70 and it might be different depending on the lot, but suddenly could rewrite better.
(一度以下 の手順を済ませて点滅した場合、ソース修正、uImage作成までやって、SDのvfatパーティションに書けばOK) (If you blink once finished the following steps, modify the source, uImage to do to create, SD の vfat partition, you can write OK)

続いて、 カーネルのクロス構築を行います。 Then, and builds cross-kernel.

$ mkdir -p ../kernel-bin
$ CROSS_COMPILE=arm-linux- ARCH=arm make O=../kernel-bin/ mini2440_defconfig
すぐに終わります$ CROSS_COMPILE=arm-linux- ARCH=arm make O=../kernel-bin/ (End soon )
$ CROSS_COMPILE=arm-linux- ARCH=arm make O=../kernel-bin/
カーネルビルドなのでかなりかかります$ ../../uboot/mini2440/tools/mkimage -A arm -O linux -T kernel -C none \ (Kernel build takes so much)
 
$ ../../uboot/mini2440/tools/mkimage -A arm -O linux -T kernel -C none \
-a 0x30008000 -e 0x30008000 -d ../kernel-bin/arch/arm/boot/zImage uImage
これでu-boot対応カーネルイメージが出来る$ ls -l uImage (This can be u-boot)
 
$ ls -l uImage
... 2040148 uImage
$ CROSS_COMPILE=arm-linux- ARCH=arm make O=../kernel-bin/ \
INSTALL_MOD_PATH=../kernel-modules modules_install
これで mini2440ディレクトリ内にuImageと、../kernel-modules内に附属するモジュールが生成されます。This directory mini2440 and uImage, .. / kernel-modules are generated in a module attached to.

注意点は ubootのビルドパスです。 Notice that it's build uboot.

 開発用ディレクトリ uboot development directory
uboot
 mini2440 mini2440
kernel kernel
mini2440 mini2440
とuboot とkernelは並列に並んでいるような相対パス表記になっています。 Uboot and the kernel and has been written by a relative path are arranged in parallel.

なお、もし カーネルの設定を変えたい場合は、 However, if you change the kernel settings if the

$ mkdir -p ../kernel-bin
$ CROSS_COMPILE=arm-linux- ARCH=arm make O=../kernel-bin/ mini2440_defconfig
$ CROSS_COMPILE=arm-linux- ARCH=arm make O=../kernel-bin/ menuconfig
$ CROSS_COMPILE=arm-linux- ARCH=arm make O=../kernel-bin/
$ ../../uboot/mini2440/tools/mkimage -A arm -O linux -T kernel -C none \
-a 0x30008000 -e 0x30008000 -d ../kernel-bin/arch/arm/boot/zImage uImage_A70
$ ls -l uImage
... 2040148 uImage
$ CROSS_COMPILE=arm-linux- ARCH=arm make O=../kernel-bin/ \
INSTALL_MOD_PATH=../kernel-modules_A70 modules_install

とmake menuconfigを追加します。 Make menuconfig           and add.
make menuconfig には ncursesが必要です。 is required to make menuconfig   ncurses. そのためには So
$ sudo apt-get install libncurse5-dev
が必要です (ぐぐって調べるのに若干面倒だった)。 Is required (it was somewhat annoying to find out Gugutte).

mini2440へのU-Bootのインストール mini2440 to install U-Boot

作業の概要 Task Overview

mini2440 ボードには2系統のフラッシュROMが乗っています。 mini2440 The board has 2 ROM flash on board systems. 両者は基板上の音声出力コネクタ横のスライドスイッチで切り替えられ、一方は最 低限のBIOS的内 容、もう一方はOSなどを入れたりする主たるストレージです。 Both are switched on next slide switch audio output connector on the board, while the minimum contents of BIOS, the OS is the other main storage, etc. or place.
本来は、こ のストレージの方にブートローダ、カーネル、ファイルシステムなど一式を全部詰め込むのですが、初期型が64Mしかないのですぐに一杯になります。 Originally, the storage loader toward the kernel, I set all the file systems and other stuff, the initial model will be filled quickly because 64M only. 最新版は1Gあるようで十分な容量で、今後はそこに入れることも検討しますが、 ハード的に壊すとおし まいなのと、入れ換えたりするのが面倒なので、ここではSDカードをメインのストレージにします。 The latest version 1G enough space in such a future, but also consider putting there, and a That's to break the terms of hardware, because it's inconvenient or swapped, where the SD storage and the main card Masu.
そのSD カードから起動できるようなブートローダとして、U-Bootをインストールします。 Such as the boot loader that can boot from SD card, U-Boot installed.

手順は: Procedure:

  1. 接続などの チェック Check connections, such as
  2. 今はいって いる内容のバックアップ(USB接続の確認兼用、無しでも良いかもしれない) Now what are going back (USB connection combined check, maybe even without)
  3. U-Boot の書き込み Write U-Boot
を行いま す。 Performed.

必要なもの Need

Friendry ARM:Downloads : Friendly ARM:Downloads: :


インストール前のチェック Pre-installation check

  1. まず動作確 認をする。 First to confirm the operation.
    ボードに手 を加える前に電源をいれて、Qtopiaが起動することを確認する。 Put your hand before applying power to the board, Qtopia to make sure that you start.
    ROM切り 替えスイッチ(音声出力コネクタ横のスライドスイッチ)が奥(というか基板角の反対)側であることを確認して、電源(ACアダプタ側のスイッチ)を入れ る。 ROM switch (slide switch next to the audio output connector) is back (or rather the opposite corner of the substrate) to ensure that the power supply (AC adapter side switch), put.

    手っ取り早 い例としては、「ビデオ」のところに「なにか」入っているかもしれない(笑)。 A quick example, the "video" just "something" might have included (laughs). イヤホンを 挿すと音も出るけど音量の大きさに注意。 Note that the size of the volume, but to insert the earphones and the sound out. なお、この ビデオアプリ、何故か応答無しになることがある。 The Bideoapuri this may be why no reply.

    ちなみに、 正しい電源の切り方は知らないから、Qtopiaのときはぶちっと切っている。 By the way, know how to cut the power from the right, Qtopia is a bit off when the Habu.

  2. つぎにシリ アルポートの実験をする。 Next to the serial port test.
    ボードの電 源を落とし、PCの(USB経由の)シリアルポートとボードのDsub9pinを接続する(クロスケーブル)。 Power down the board, PC's (USB over) Dsub9pin board serial port to connect (crossover cable).
    PC側で適 切なポートを開き、通信条件を 115200bps (標準:8bit 1スタート1ストップ)に設定する。 Appropriate to open a port on the PC, the communication conditions 115200bps (Standard: 8bit start a one-stop) setting.
    この状態で 電源をいれる。 Put the power in this state.

VIVI version 0.1.4 (root@russell-work-pc) (gcc version 2.95.3 
20010315 (release)) #0.1.4 Tue Jun 16 15:20:37 CST 2009
MMU table base address = 0x33DFC000
Succeed memory mapping.
DIVN_UPLL0
MPLLVal [M:7fh,P:2h,S:1h]
CLKDIVN:5h

+---------------------------------------------+
| S3C2440A USB Downloader ver R0.03 2004 Jan |
+---------------------------------------------+
USB: IN_ENDPOINT:1 OUT_ENDPOINT:3
FORMAT: +++
NOTE: Power off/on or press the reset button for 1 sec
in order to get a valid USB device address.

NAND device: Manufacture ID: 0xec, Chip ID: 0x76 (Samsung K9D1208V0M)
Could not found stored vivi parameters. Use default vivi parameters.
Press Return to start the LINUX/Wince now, any other key for vivi
Copy linux kernel from 0x00050000 to 0x30008000, size = 0x00200000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc
console=ttySAC0"
MACH_TYPE = 782
NOW, Booting Linux......
Uncompressing Linux............................................................
Linux version 2.6.29.4-FriendlyARM (root@russell-work-pc)
(gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #4 Tue Jun 9 16:32:08 CST 2009
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: FriendlyARM Mini2440 development board
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
:
hwclock: settimeofday() failed: Invalid argument
[19/Dec/2003:06:17:30 +0000] boa: server version Boa/0.94.13
[19/Dec/2003:06:17:30 +0000] boa: server built Mar 26 2009 at 15:28:42.
[19/Dec/2003:06:17:30 +0000] boa: starting server pid=498, port 80

Try to bring eth0 interface up......eth0: link down
Done

Please press Enter to activate this console

というよう な感じで、ブートシーケンスが流れる。 Something like that through the boot sequence. ここで、 Enterすると、rootのシェルがひらかれる。 Now, Enter then, root's shell that opens up. 手元のものでディスク容量は64M中50Mほど使っていて余裕の少ない状態。 64M disk space on hand in the room where much of 50M so you're using.

既存イメージの吸い出し Existing image rip

元に戻せる ように、いまのイメージをPCに吸い出しておきます。 Get back to the original image to leave right now sucking Ni PC. そのためには、USB接続をします。 To do so, USB connection to.

usb-downloaddr -setup-.zipを展開して、インストーラを実行。1. usb-downloaddr-setup-.zip to develop and run the installer. 読めない文字が出てくるけど、適当にボタンを押せば入る。 I read the letter out, press the enter button as appropriate.
電源を切っ たボードのUSB-BコネクタとPCを接続する。2. Power off the board and the USB-B connector to connect the PC.
ROM切り 替えスイッチ(音声ジャック横)を角側にスライドさせる。3. Switch ROM (audio jack side) and slide the side of the square.
シリアル ポート、USBの接続を確認して電源をいれる。4. Serial port, USB connection to put the power of the Check.
USB接続 が認識されて、ドライバの組み込みが行われる。 USB connection is recognized, the driver is done.
ターミナル には、 To Terminal
##### FriendlyARM BIOS for 2440 #####
[x] bon part 0 320k 2368k
[v] Download vivi
[k] Download linux kernel
[y] Download root_yaffs image
:
[s] Set the boot parameters
[t] Print the TOC struct of wince
[u] Backup NAND Flash to HOST through USB(upload)
[r] Restore NAND Flash from HOST through USB
[q] Goto shell of vivi
Enter your selection:
な感じで表 示される。 The feeling appears.
そのまま dnw.zipを展開して出てくる、dnw.exeを実行する。5. dnw.zip just come out to expand, dnw.exe run.
バックアッ プを行う。6. To back up.
先ほどの ターミナルで、「u」を入力。 Terminal earlier, "u" Enter.
Enter your selection: u
Backup Information:
Start Addr : 0x0
End Addr : 0x4000000
bBackupOOB : 1
bCheckBad : 1
dwBackupTotalLen : 0x4200000
dwReservedBlks : 20
dwEPInPktSize : 32
Use dnw.exe to receive backup.
という表示 が出るので、dnw.exeのメニュー[USB Port]→[Backup Nand Flash to File]を実行すると、保存ファイルを聞かれるので、適当な名前で保存する。So that the display appears, dnw.exe menu [USB Port] → [Backup Nand Flash to File] to run, you will be prompted to save the file, save the name appropriate.
なお、書き 戻しは、[r]を選択の上、[USB Port]→[Transmit/Restore] The write-back, [r] on the Select, [USB Port] → [Transmit / Restore]

U-Bootのインストール Installing U-Boot

あとは、U -Bootを書き込みます。 After that, U-Boot writes. ただし、参 考文献にしたがって、少し念入りな手順にします(本来は書き込むだけでOKと思われる) However, according to the paper, and a little careful steps (originally written in only seems to be OK)

  1. ROMス イッチ角側で起動。 Entering the ROM at the switch angle. BIOSメ ニューを出す。 BIOS menu issue.
  2. ターミナル で[q]を選択した後、以下のloadコマンドを実行 Terminal [q] after selecting the following load command
  3. DNWで [USB Port]→[Transmit/Restore]してダウンロード済みのu-boot---.zipのなかの、u-boot-v132.bin を選択する。 The DNW [USB Port] → [Transmit / Restore] already downloaded to the Some u-boot --- .zip, u-boot-v132.bin selected.
    ##### FriendlyARM BIOS for 2440 #####
    [x] bon part 0 320k 2368k
    [v] Download vivi
    :
    [r] Restore NAND Flash from HOST through USB
    [q] Goto shell of vivi
    Enter your selection: q ※ [q]
    Supervivi> load flash 0 246164 u ※ コマンド入力
    USB host is connected. Waiting a download.

    Now, Downloading [ADDRESS:30000000h,TOTAL:246174]
    RECEIVED FILE SIZE: 246174 (240KB/S, 1S)
    Downloaded file at 0x30000000, size = 246164 bytes
    Found block size = 0x00040000
    Erasing... ... done
    Writing... ... done
    Written 246164 bytes
    Supervivi>
  4. なお、 load の引数は、開始番地と転送するバイト数(u-boot.binの大きさ)と推定される。In addition, load argument is the start address and number of bytes transferred (u-boot.bin size) is estimated.
  5. 一度電源を 切り、ROMスイッチを奥側に切り替え、起動し直す。 Turn off the power once, ROM switched to the switch back and re-start.
    (USBの 認識がされないと警告が出た) (USB is not out to recognize the warning)
    U-Boot 1.3.2-mini2440 (May 25 2010 - 19:15:21)

    I2C: ready
    DRAM: 64 MB
    Flash: 2 MB
    NAND: Bad block table not found for chip 0
    Bad block table not found for chip 0
    64 MiB
    *** Warning - bad CRC or NAND, using default environment

    USB: S3C2410 USB Deviced
    In: serial
    Out: serial
    Err: serial
    MAC: 08:08:11:18:12:27
    Hit any key to stop autoboot: 0
    MINI2440 #

  6. 続けて、メ モリのチェックを行う。 , Followed by checking memory.
    nand scrub, nand createbbt を実行し、yで答える(エコーバック無しでEnter必要) nand scrub, nand createbbt run, y reply (with no echo back Enter required)
    MINI2440 # nand scrub ※入力

    NAND scrub: device 0 whole chip
    Warning: scrub option will erase all factory set bad blocks!
    There is no reliable way to recover them.
    Use this command only for testing purposes if you
    are sure of what you are doing!

    Really scrub this NAND flash? ※ [y]、[Enter]を押す。
    Erasing at 0x2850000 -- 63% complete.
    NAND 64MiB 3,3V 8-bit: MTD Erase failure: -5
    Erasing at 0x3ffc000 -- 100% complete.
    Bad block table not found for chip 0
    Bad block table not found for chip 0
    OK
    MINI2440 # nand createbbt ※入力
    Create BBT and erase everything ? ※ [y]、[Enter]を押す。
    Skipping bad block at 0x0287c000
    Skipping bad block at 0x03ff0000
    Skipping bad block at 0x03ff4000
    Skipping bad block at 0x03ff8000
    Skipping bad block at 0x03ffc000

    Creating BBT. Please wait ...Bad block table not found for chip 0
    Bad block table not found for chip 0
    (2,30秒はかかるのでしばらく待つ)
    Bad block table written to 0x03ffc000, version 0x01
    Bad block table written to 0x03ff8000, version 0x01

    MINI2440 #

  7. このコマン ドを実行すると、u-bootもろとも消してしまうので、先ほどのu-bootのインストール手順をもう一度行う。 When you run this command, u-boot and it would be edged out of the u-boot earlier to do the installation procedure again.
    すなわち、 1:スイッチを角側に切り替えて電源投入、2:[q]→"Supervivi> load flash 0 246164 u"、DNWでu-boot--.binをダウンロード をする。 That is, one: the power switch is switched to the corner, 2: [q] → "Supervivi> load flash 0 246164 u", DNW in the u-boot - .bin to download.
  8. スイッチを 奥側に切り替えて電源投入。 The power switch to switch back.
    依然とし て、"*** Warning - bad CRC or NAND, using default environment"がでる。 Still ,"*** Warning - bad CRC or NAND, using default environment "is'm.
    以下の2コ マンドを実行する(dynenv set 40000, saveenv)。 The following two commands (dynenv set 40000, saveenv).
    MINI2440 # dynenv set 40000
    device 0 offset 0x40000, size 0x3fc0000
    45 4e 56 30 - 00 00 04 00
    MINI2440 # saveenv
    Saving Environment to NAND...
    Erasing Nand...Writing to Nand... done

  9. 電源を入れ 直すと、今度はWarningがでない。 Cycling the power will not turn Warning.
    U-Boot 1.3.2-mini2440 (May 25 2010 - 19:15:21)

    I2C: ready
    DRAM: 64 MB
    Flash: 2 MB
    NAND: 64 MiB
    Found Environment offset in OOB..
    USB: S3C2410 USB Deviced
    In: serial
    Out: serial
    Err: serial
    MAC: 08:08:11:18:12:27
    Hit any key to stop autoboot: 0
    MINI2440 #
以上で、U -Bootのインストールは終了です。Above, U-Boot installation is completed. SDカード へのカーネルなどのインストール後、追加の設定をします。 After installing the kernel, such as SD card, and additional settings.
なお、 USBケーブルは使いませんが、シリアルはまだつかいます。 However, USB cables are not used, serial Tsukaimasu yet.

SDカードへのインストール Installing to SD card

Ubuntu 環境を使って、SDカード上にファイルシステムを作ります。 Ubuntu environment using, SD card creates a file system.

手順: Procedure:

  1. 初期のイン ストールファイルを取得 Get the initial installation files
  2. SDカード のパーティションわけ、フォーマット、コピー Not Partition SD card format, a copy
  3. mini2440 で起動確認 Check mini2440 start

ファイル類の準備 Preparing the file type

debootstrap コマンド(apt-get必要)で初期のインストールに必要なファイルを取得します。 debootstrap command (apt-get necessary) to get the files needed for the initial installation.

$ (sudo apt-get install debootstrap)
$ mkdir armel-rootfs
$ sudo debootstrap --arch=armel \ ※ sudo required
--include=ifupdown,udev,procps,netbase,vim-tiny,module-init-tools,\
(切らずに続く)wget,openssh-server,screen,apmd \ (Continued cutting) wget,openssh-server,screen,apmd \
--foreign lenny ./armel-rootfs http://ftp.de.debian.org/debian -- Foreign lenny ./armel-rootfs http://ftp.de.debian.org/debian
--foreign lenny ./armel-rootfs http://ftp.de.debian.org/debian
[sudo] password for
I: Retrieving Release
I: Retrieving Packages
I: Validating Packages
:
I: Extracting mount...
I: Extracting util-linux...
I: Extracting zlib1g...

$ cd armel-rootfs
$ sudo tar cfjv ../armel-rootfs.tar.bz2 * ※ sudo would be a good idea to keep.
$ cd .. $ cd ..
$ ls -l $ ls-l
drwxr-xr-x 18 root root 4096 2008-04-06 15:51 armel-rootfs drwxr-xr-x 18 root root 4096 2008-04-06 15:51 armel-rootfs
-rw-r--r-- 1 root root 71904114 2010-07-20 22:23 armel-rootfs.tar.bz2 -rw-r - r - 1 root root 71904114 2010-07-20 22:23 armel-rootfs.tar.bz2
これで、 ファイル類の取得と、一式固めができます。 This kind of acquisition and the file can be set compaction. 2010/7/20時点のarmel-rootfs.tar.bz2 2010/7/20 at the armel-rootfs.tar.bz2

SDカードのパーティションとフォーマット Partition and format the SD card

次に、SD カードをフォーマットします。 Then, SD card format. Ubuntu インストールのSDカードリーダライタのところで確認したSDカードリーダライタをつかいます。 Installing Ubuntu on the SD card reader writer was confirmed at the SD card reader writer Tsukaimasu.
また、中を 壊しても良い2GのSDカード(フォーマットからするので)を用意します。 May also break during the 2G SD card (because the format) available.
※1Gでも 2G以上でも可のはず ※ 1G 2G but at least it should be possible

  1. SDカード を挿す。 Insert the SD card. 買ってきたばかりならデスクトップに何らかのアイコンが出るとともに、ファイル ブラウザが開く。 Comes with some desktop icons just bought you open the file browser.
  2. dmesg コマンドで念のため、どのデバイスで認識されたか確認する。 dmesg command just in case, make sure you are aware of any device.
    $ dmesg | tail $ dmesg | tail
    sd 7:0:0:0: [sdb] 3842048 512-byte logical blocks: (1.96 GB/1.83 GiB) sd 7:0:0:0: [sdb] 512 3842048-byte logical blocks: (1.96 GB/1.83 GiB)
    sd 7:0:0:0: [sdb] Assuming drive cache: write through sd 7:0:0:0: [sdb] Assuming drive cache: write through
    sd 7:0:0:0: [sdb] Assuming drive cache: write through sd 7:0:0:0: [sdb] Assuming drive cache: write through
    sdb: sdb1 sdb: sdb1
    ここから、 SDカードは /dev/sdb でアクセスすることがわかる。 Here, SD card  /dev/sdb can be seen that access. 「sdb」の部分は環境に依存する。 "sdb" part depends on the environment. 間違うと、いろいろ吹き飛ばすので注意。 An incorrect, note that many blows.
  3. デスクトッ プ上のブラウザは閉じ、自動マウントされたのを解除する。 Close the browser on the desktop, to remove the auto-mounted.
    $ df -k
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/sda1 19737268 6335036 12399636 34% /
    none 509008 336 508672 1% /dev
    none 513232 208 513024 1% /dev/shm
    none 513232 100 513132 1% /var/run
    none 513232 0 513232 0% /var/lock
    none 513232 0 513232 0% /lib/init/rw
    /dev/sdb1 1920704 0 1920704 0% /media/41A3-D996
    $ sudo umount /media/41A3-D996 ※ Usable analogies that ※ umount
    $ 問題なければ、df -k してでてこない$ And if you are, df-k does not come in to
  4. パーティ ションを切る。 Cut partition.
    パーティ ションは Partition
    /dev/sdb1 type 0C 100M (Kernel Image 等)
    /dev/sdb2 type 83 700M (main rootfs)
    /dev/sdb3 type 82 128M (swap
    程度とす る。 Be around. 2GのSDを使うと1G程度あまりがでるが、放置しておく。 Of the 1G SD 2G With the'm very much, you leave. あとで容量 的に不足してから、/optなり/homeなりとしてパーティションを追加して使う。 Lack of capacity and then later, / opt and / home and use a partition to add.
    最初から大 きく確保しないのは、この後行う、インストール確認後の丸ごとバックアップをする際に無駄に大きくなりすぎないため。 The first is not far from secure, then do this, too large for backup when the whole waste after confirmation of the installation.

    以下、操作 の例: The following example operation:

    $ sudo fdisk /dev/sdb

    WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
    switch off the mode (command 'c') and change display units to
    sectors (command 'u').

    Command (m for help): 【p

    Disk /dev/sdb: 1967 MB, 1967128576 bytes
    57 heads, 56 sectors/track, 1203 cylinders
    Units = cylinders of 3192 * 512 = 1634304 bytes
    sSector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Device Boot Start End Blocks Id System
    /dev/sdb1 1 1204 1920955+ 6 FAT16

    Command (m for help): 【d
    Selected partition 1

    Command (m for help): 【n
    Command action
    e extended
    p primary partition (1-4)
    p
    Partition number (1-4): 【1
    First cylinder (1-1203, default 1):【Enter
    Using default value 1
    Last cylinder, +cylinders or +size{K,M,G} (1-1203, default 1203): 【+100M

    Command (m for help): 【t
    Selected partition 1
    Hex code (type L to list codes): 【0c
    Changed system type of partition 1 to c (W95 FAT32 (LBA))

    Command (m for help): 【n
    Command action
    e extended
    p primary partition (1-4)
    p
    Partition number (1-4): 【2
    First cylinder (66-1203, default 66):【Enter】
    Using default value 66
    Last cylinder, +cylinders or +size{K,M,G} (66-1203, default 1203): 【+700M

    Command (m for help): 【n
    Command action
    e extended
    p primary partition (1-4)
    p
    Partition number (1-4): 【3
    First cylinder (516-1203, default 516):【Enter
    Using default value 516
    Last cylinder, +cylinders or +size{K,M,G} (516-1203, default 1203): 【+128M

    Command (m for help): 【t
    Partition number (1-4): 【3
    Hex code (type L to list codes): 【82
    Changed system type of partition 3 to 82 (Linux swap / Solaris)

    Command (m for help): 【p

    Disk /dev/sdb: 1967 MB, 1967128576 bytes
    57 heads, 56 sectors/track, 1203 cylinders
    Units = cylinders of 3192 * 512 = 1634304 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Device Boot Start End Blocks Id System
    /dev/sdb1 1 65 103712 c W95 FAT32 (LBA)
    /dev/sdb2 66 515 718200 83 Linux
    /dev/sdb3 516 598 132468 82 Linux swap / Solaris

    Command (m for help): 【w
    The partition table has been altered!

    Calling ioctl() to re-read partition table.

    WARNING: If you have created or modified any DOS 6.x
    partitions, please see the fdisk manual page for additional
    information.
    Syncing disks.
    $



    最後の 【w】の入力でテーブルを書き出して終了。 [W] Last Exit to export the table in the input. もし、途中 で削除を思いとどまったり、パーティションの切り分けに失敗しても w しなければ問題なし。 If you remove 思Itodomatsu on the way, even if it fails to be okay w partitions to isolate.
    なお、一覧 の Start, End, 操作途中で聞かれる先頭シリンダ番号は、SDカードによって(少なくともKingstonとSunDiskで)異なる。 The list of Start, End, the first number to be heard in the middle of the cylinder operation, SD card by (and Kingston SunDisk at least) different. これは1シリンダ当たりの容量が異なるため(57 heads, 56 sectors/track, 1203 cylinders // Units = cylinders of 3192 * 512 = 1634304 bytes の部分で heads,sectors/trackの違い)。 This is different cylinder capacity per 1 (57 heads, 56 sectors / track, 1203 cylinders / / Units = cylinders of 3192 * 512 = 1634304 bytes in the part of heads, sectors / track differences.)


  5. 確認のた め、SDカードを抜いて、挿し直して、dmesgをする。 For confirmation, SD card and disconnect, re-inserted, dmesg you.
    $ dmesg | tail $ dmesg | tail
    [59182.583513] sdb: sdb1 sdb2 sdb3 [59182.583513] sdb: sdb1 sdb2 sdb3
    [59473.953582] sd 8:0:0:0: [sdb] 3842048 512-byte logical blocks: (1.96 GB/1.83 GiB) [59473.953582] sd 8:0:0:0: [sdb] 512 3842048-byte logical blocks: (1.96 GB/1.83 GiB)
    [59473.958898] sd 8:0:0:0: [sdb] Assuming drive cache: write through [59473.958898] sd 8:0:0:0: [sdb] Assuming drive cache: write through
    [59473.968929] sd 8:0:0:0: [sdb] Assuming drive cache: write through [59473.968929] sd 8:0:0:0: [sdb] Assuming drive cache: write through
    sdbが sdb1~sdb3になっている。 The sdb sdb1 ~ sdb3 Shows. なお、ファ イルシステムが無いため、たぶんファイルブラウザは出てこないし、df -kで確認しても自動マウントされていない。 However, because there is no file system, file browser probably will not come out, df-k does not even check the auto-mounted.
  6. ファイルシ ステムを作る。 Create a file system. 以下の手順 で、FAT32(vfat), ext3 をつくる。 The following procedure, FAT32 (vfat), ext3 making.
    $ sudo mkfs.vfat /dev/sdb1
    mkfs.vfat 3.0.7 (24 Dec 2009)
    $ sudo mkfs.ext3 /dev/sdb2
    mke2fs 1.41.11 (14-Mar-2010)
    Filesystem label=
    OS type: Linux
    :
    This filesystem will be automatically checked every 25 mounts or
    180 days, whichever comes first. Use tune2fs -c or -i to override.
    $

以上で、 SDカードにファイルシステムが出来ました。 Above, SD card file system is able.


SDカードのへのコピー Copy to SD card

次に用意し ていたファイル類をSDカードにコピーします。 The kind I have prepared the following files to the SD card copy.

  1. まずカーネ ルをコピーする。 First, copy the kernel.
    SDカード を抜いて挿し直すと、自動マウントされるので、umountする。 Unplug and re-insert the SD card so that automounted, umount that.
    $ df -k
    Filesystem 1K-blocks Used Available Use% Mounted on
    :
    /dev/sdb1 103492 0 103492 0% /media/2165-6558
    /dev/sdb2 706888 17116 653864 3% /media/9f1842b3-48ac-479d-8d5d-f5bd4e40c7ec
    $ umount /media/2165-6558/
    $ umount /media/9f1842b3-48ac-479d-8d5d-f5bd4e40c7ec

    次にマウン トしてコピーする Then copy and mount
    $ cd kernel/mini2440 ※カーネルを構築したディレクトリに移行$ sudo mkdir /mnt/tmp ※ubuntuインストール後、最初の1回のみ$ sudo mount /dev/sdb1 /mnt/tmp ※sdbかは環境依存$ df -k$ cd kernel/mini2440 transition to kernel build directory ※ 
    $ sudo mkdir /mnt/tmp ※ ubuntu after installation, once the initial
    $ sudo mount /dev/sdb1 /mnt/tmp ※ sdb environment depends on whether
    $ df -k
    Filesystem 1K-blocks Used Available Use% Mounted on
    :
    /dev/sdb1 103492 0 103492 0% /mnt/tmp
    $ sudo cp uImage /mnt/tmp/
    $ ls -l /mnt/tmp/
    total 1994
    -rwxr-xr-x 1 root root 2040148 2010-07-20 23:07 uImage
    $ sudo umount /mnt/tmp
  2. つぎに必要 なファイルをルートファイルシステムにコピーする。 To copy the files needed for the next root. 途中の /mnt/tmpへのcdを確実にする。 Intermediate /mnt /tmp cd to make sure.
以上で、開 発環境側での基本的なファイルのコピーは終了です。Ubuntu broken and the development environment will almost certainly fail. 他も、相対パスになっているところに注意すること。
Anyone else, be careful where is a relative path.
一度操作の意味を考えてから実行すべし。 We should consider the meaning of the operations performed once.
$ sudo mount /dev/sdb2 /mnt/tmp
$ cd /mnt/tmp over Kaname Shigeru
$ ls -al
total 16
drwx------ 2 root root 16384 2010-07-20 22:57 lost+found
$ sudo tar xvjfp (full path /)armel-rootfs.tar.bz2

var/log/fsck/
var/local/

/mnt/tmp$ sudo cp -Rp (full path /)kernel-modules/lib/* lib/
(Take some time)
$ sudo /bin/bash
The current directory is ※ /mnt/tmp reaffirmed that the /mnt/ tmp
/mnt/tmp# echo "proc /proc proc none 0 0" >> etc/fstab
/mnt/tmp# echo "mini2440" > etc/hostname
/mnt/tmp# echo '127.0.0.1 localhost.localdomain localhost' > etc/hosts
/mnt/tmp# mknod dev/console c 5 1
mknod: `dev/console': File exists   Resources 不要Rashii had
/mnt/tmp# echo 'deb http://ftp.de.debian.org/debian lenny main' > etc/apt/sources.list
/mnt/tmp# exit
/mnt/tmp$ cd /
$ sudo umount /mnt/tmp $ sudo umount/mnt/tmp
な お、途中で'sudo /bin/bash'するのはその後のファイルのへの記述追加をするのに'echo'にsudoが効かないため。直接viな どで書き換えたいときは'sudo vi'でよい。 In the middle of 'sudo /bin/bash', but to add to the description of the file and then 'echo' for the sudo does not work. When the rewrite in such a direct vi 'sudo vi' may be.
以上で、開 発環境側での基本的なファイルのコピーは終了です。 You have a basic file copy of the development is completed.


ボードでの起動実験 Starting the test board.

まず、 mini2440ボードとシリアルポートの接続を行います。 First, mini2440 serial port provides connection to the board.
そのまま電 源を入れてみれば、U-Bootが立ち上がるので、確認出来ます(ROMのスイッチは奥側)。次に先ほど のSDカードを挿して、DHCPの可能なネットワークケーブルを繋いで、電源をいれます。 As it were without power, U-Boot is up so You can see (ROM back side of the switch.)
Then earlier the SD card inserted, DHCP possible by connecting the network cable and puts the power.

U-Boot 1.3.2-mini2440 (May 25 2010 - 19:15:21) U-Boot 1.3.2-mini2440 (May 2010 25 - 19:15:21)

I2C: ready I2C: ready
DRAM: 64 MB DRAM: 64 MB
Flash: 2 MB Flash: 2 MB
NAND: 64 MiB NAND: 64 MiB
Found Environment offset in OOB.. Found Environment offset in OOB ..
USB: S3C2410 USB Deviced USB: S3C2410 USB Deviced
In: serial In: serial
Out: serial Out: serial
Err: serial Err: serial
MAC: 08:08:11:18:12:27 MAC: 08:08:11:18:12:27
Hit any key to stop autoboot: 0 Hit any key to stop autoboot: 0
MINI2440 # MINI2440 #

次に、以下 のコマンドをプロンプトに入力します。 Next, enter the following command prompt.

MINI2440 # setenv bootcmd 'mmcinit ; fatload mmc 0:1 0x31000000 uimage ; bootm 0x31000000' MINI2440 # setenv bootcmd 'mmcinit; fatload mmc 0:1 0x31000000 uimage ; bootm 0x31000000'
MINI2440 # setenv bootargs (空白おいて続けて一行で) MINI2440 # setenv bootargs (leave a space followed by one line)
'console=ttySAC0,115200 noinitrd root=/dev/mmcblk0p2 rootwait=4 rw ip=dhcp init=/bin/sh'
MINI2440 # boot
う まくいけ ば、Linuxが起動します。Hopefully, Linux will start.

MINI2440 # boot
mmc: Probing for SDHC ...
mmc: SD 2.0 or later card found
trying to detect SD Card...
Manufacturer: 0x02, OEM "TM"
Product name: "SD02G", revision 6.0
Serial number: 2716765588
Manufacturing date: 5/2010
CRC: 0x68, b0 = 1
READ_BL_LEN=15, C_SIZE_MULT=7, C_SIZE=365
size = 1642070016
SD Card detected RCA: 0xafd8 type: SD
reading uimage

2040148 bytes read
## Booting kernel from Legacy Image at 31000000 ...
Image Name:
Created: 2010-07-19 4:23:49 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2040084 Bytes = 1.9 MB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...
Uncompressing Linux.......................... done, booting the kernel.
Linux version 2.6.32-rc8 (kumagai@UbuntuCrossTest)
(gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #1 Mon Jul 19 00:15:15 EDT 2010
:
s3c2410-rtc s3c2410-rtc: setting system clock to 2140-01-26 12:04:30 UTC (1071898574)
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
s3c-sdi s3c2440-sdi: running at 16875kHz (requested: 25000kHz).
s3c-sdi s3c2440-sdi: running at 16875kHz (requested: 25000kHz).
mmc0: new SD card at address afd8
(DHCP でIPアドレス取得を試みる)
kjournald starting. Commit interval 5 seconds
EXT3 FS on mmcblk0p2, internal journal
EXT3-fs: recovery complete.
EXT3-fs: mounted filesystem with writeback data mode.
VFS: Mounted root (ext3 filesystem) on device 179:2.
Freeing init memory: 132K
sh-3.2#
Next, make the second half of the installation files.


sh-3.2# mount /proc /proc -t proc
sh-3.2# export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
sh-3.2# /debootstrap/debootstrap --second-stage
:
:
I: Configuring tasksel...
I: Base system installed successfully.
sh-3.2#





この、 debootstrapのsecond stageはかなり時間がかかるので(手元で40分)、しばらく放置します。 This, debootstrap the second stage because it takes quite some time (40 minutes by hand), leave it for a while.
なお、SD カード側にLEDが4個並んでいます。 In addition, SD Card LED side by side to side four. 外から2番 目がSDカードのアクセスランプになっていて、アクセス具合はわかります。 The second they turned out SD card access lamp, see the access condition.

追加の作業 をします。 The additional work.

sh-3.2# mknod dev/ttySAC0 c 204 64
sh-3.2# echo ttySAC0 >> /etc/securetty
sh-3.2# printf "T0:123:respawn:/sbin/getty 115200 ttySAC0\n" >> /etc/inittab
sh-3.2# printf "auto lo\niface lo inet loopback\n" >> /etc/network/interfaces
sh-3.2# printf "auto eth0\niface eth0 inet dhcp\n" >> /etc/network/interfaces
sh-3.2# printf "nameserver 192.168.1.1" >> /etc/resolv.conf
最後の nameserverは環境に応じて適宜設定して下さい(ここでは自環境のブロードバンドルータを指 Please set the last nameserver is appropriate for your environment (in this case given the broadband environment itself.)

最後に再起 動をして、自動的にU-BootからLinuxがあがるようにします。 For the last reboot automatically as the U-Boot from Linux will be raised. ここではま だ 'shutdown -r now'は使えないようなので、syncしてexitあたりで。 We still 'shutdown-r now' seems to be useless, sync around to exit. なお、電源 側にリセットスイッチがあります。 The reset switch is located on the supply.
U-Boot のプロンプトで、 U-Boot prompt,

MINI2440 # setenv bootcmd 'mmcinit ; fatload mmc 0:1 0x31000000 uimage ; bootm 0x31000000'
MINI2440 # setenv bootargs (leave a space followed by one line)
'console=ttySAC0,115200n8 rootdelay=3 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait'
MINI2440 # saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
MINI2440 # boot
先ほどに比 較し、'saveenv'が増えています。 Compared to the earlier, 'saveenv' has increased.
Debian GNU/Linux 5.0 mini2440 ttySAC0

mini2440 login: root (no password for root)
Linux mini2440 2.6.32-rc8 #1 Mon Jul 19 00:15:15 EDT 2010 armv4tl

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.
mini2440:~#
時間がひど いことになっている場合は、設定した方がいいかもしれません。 If it is a bad time, you might be better set.
mini2440:~# date
Sat Dec 20 06:41:58 UTC 2003
mini2440:~# date 072100432010
Wed Jul 21 00:43:00 UTC 2010
また、 swapを使う場合の準備として、swapをつくっておきます。 In addition, swap in preparation of using, swap making a leave.
mini2440:~# mkswap /dev/mmcblk0p3
Setting up swapspace version 1, size = 135540 kB
no label, UUID=c9b6d9d6-fb6f-4400-b28d-93557695f288
mini2440:~# swapon /dev/mmcblk0p3
Adding 132360k swap on /dev/mmcblk0p3. Priority:-1 extents:1 across:132360k SS
swapを 使うのはあまり実用的ではありませんが、メモリがどうしても足りないとき(大きなコンパイルをしたい場合など)、swaponしておくと役に立つことがあ ります。 The swap is very practical to use, but if memory is really short (for example, if you want heavy compilation), swapon and may be useful to you.

もう一度再 起動して、今度は自動でカーネルが起動するかを確認します。 Reboot again, this time to verify whether the kernel starts automatically. なお、まが りなりにもLinuxが動いているので、"shutdown -h now / shutdown -r now"などを使うべきでしょう。 However, somehow it is running Linux, "shutdown-h now / shutdown-r now" and you should use.

この起動の 設定で、カーネルのモードが変わります。 In setting this boot a kernel-mode changes. bootargs で以下の変更が有効なことを確認しました。 bootargs confirmed that the following changes take effect.

MINI2440 # setenv bootargsMINI2440 # setenv bootargs 'console=ttySAC0,115200n8 rootdelay=3 root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait mini2440=1tb fbcon=font:VGA8x8'
なお、試し た後はsaveenvしたほうがいいでしょう(saveenvせずにbootすると1回のみ)。 The post would be better tried saveenv (saveenv without boot then once.) また、再設 定は、シリアルポートで繋いで、起動直後にEnterです。 The reconfiguration, by connecting the serial port, it immediately starts Enter. 以上で、 SDカードで最低限のUbuntu Linux (armel lenny)が動くようになりました。 Above, SD card minimum Ubuntu Linux (armel lenny) now works.

SDカードのバックアップ SD card backup

ここまでで、一通り、「起動するLinux環境」ができたので、このあといじる ことを考えて、バック アップします。 Now, one way, "Starting the Linux environment," Now that we have, then we can tweak this back up.

バックアッ プにはいろいろな手がありますが、ここでは、一番力任せな「パーティションを丸ごとバックアップ」でいきます。 There are hands in a variety of backup, here is a most brute force "backup entire partition" will in. なお、バックアップとリストアを行うと、カードのコピーができます。 However, doing backups and restores, you can copy the card. いろいろ試 すときにコピーをつくるといいでしょう。 You should try and make a lot when you copy.

SDカードのバックアップ SD card backup

まず、SD カードをUbuntuに繋ぎます。 First, SD card with Ubuntu. Connect.
自動的にマ ウントされてファイルブラウザも開くと思うので、安全のため、umountします。 I also want to open the file browser automatically mounted for safety, umount the.

$ df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 19737268 6344636 12390036 34% /
:
/dev/sdb1 103492 3988 99504 4% /media/2165-6558
/dev/sdb2 706888 257384 413596 39% /media/9f1842b3-...
$ sudo umount /media/2165-6558/
[sudo] password for
$ sudo umount /media/9f1842b3-48ac-479d-8d5d-f5bd4e40c7ec/
$ dk -k check
つぎに、 ddコマンドを使ってバックアップを作ります。 Then, dd command to make backups. if=と of=を間違うと(ファイルがすでにあると)上書き破壊を起こすので、気をつけて下さい。 An incorrect if = and of = (and the file already exists) because it causes damage to overwrite, please be careful.
$ mkdir image; cd image
$ sudo dd bs=1M if=/dev/sdb1 of=FASD_orig_sdb1.vfat
101+1 records in
101+1 records out
106201088 bytes (106 MB) copied, 41.7631 s, 2.5 MB/s
$ sudo dd bs=1M if=/dev/sdb2 of=FASD_orig_sdb2.ext
3
701+1 records in
701+1 records out
735436800 bytes (735 MB) copied, 80.4732 s, 9.1 MB/s
of=で ファイル名を指定できます。 of = file names can be specified. 拡張子を含 め自由なので、わからなくならないように好きにつければいいです。 Including the extension, so free, I mean, I like to be confused. それぞれ、 fdiskで確保したのとだいたい同じような容量のファイルができます。 Respectively, fdisk files can be pretty much the same capacity allocated to that. なお、 101+1, 701+1は、指定した(bs=1M)入出力の単位で101,701回の読み書きと半端なの1回分という表記で、SDカードの1シリンダ当たりの容量に よっては、ファイルのバイト数共々異なる数字になり得ます。 The 101 +1 701 +1 is given (bs = 1M) output of 101,701 units in the representation of odd minutes one time to read and write, SD card by the amount of one per cylinder, the size of the file together could be a few different numbers.

SDカードへのリストア(既存パーティション) Restore to SD card (existing partition)

もし、すっ かり同じパーティション構成のSDカードがあれば、書き戻しは簡単です。 If all of the same partition scheme if you have SD card is easy to write back.
同じように umountした上で、 Similarly on the umount,

$ mkdir image; cd image
$ sudo dd bs=1M if=FASD_orig_sdb1.vfat of=/dev/sdb1
$ sudo dd bs=1M if=FASD_orig_sdb2.ext of=/dev/sdb2
と、ifと ofを逆にするだけです。 And, if and only of reverse. (ファイル の側はchmod -wしておいたほうが無難か)。 (Chmod-w file either side always better idea to keep.) 書き込み後、起動確認をしてください。 After writing, please check the start.

SDカードへのリストア(新規SD) Restoring to a SD card (New SD)

コピーを作 る場合などに新規のSDカードに書き込む場合は、パーティションの作成から必要です。 If you make a new copy and write to the SD card, you must create a partition from.
基本的には 上のファイルシステム構築と一緒ですが、ブランドが異なるメディアを使う場合は容量の指定に注意が必要です。 It is basically built with the file system on, if you use a different media brand should be careful to specify the amount.

$ $ ls -lk (サイズはキロバイト単位) $ ls -lk (size in kilobytes)
total 1646436 total 1646436
-r--r--r-- 1 root root 103712 2010-07-22 22:53 FASD_orig_sdb1.vfat -R - r - r - 1 root root 103712 2010-07-22 22:53 FASD_orig_sdb1.vfat
-r--r--r-- 1 root root 718200 2010-07-22 22:55 FASD_orig_sdb2.ext3 -R - r - r - 1 root root 718200 2010-07-22 22:55 FASD_orig_sdb2.ext3
$ sudo fdisk /dev/sdb
中身を消す。 Erase the contents.
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): p
Disk /dev/sdb: 1977 MB, 1977614336 bytes
61 heads, 62 sectors/track, 1021 cylinders
Units = cylinders of 3782 * 512 = 1936384 bytes

メーカが異なるため、この数値が最初の例と異なる※同じメーカーでも異なる場合ありCommand (m for help): n Due to different manufacturers, as manufacturers also vary in different ※ This number is the first example
Command (m for help): n
 Command action
e extended e extended
p primary partition (1-4) p primary partition (1-4)
pp
Partition number (1-4): 1
First cylinder (1-1021, default 1): Enter
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1021, default 1021): +103712K

※ここで、前例の+100Mではなく、イメージのサイズをキロバイト表示した値、 Here ※, +100 M, not unprecedented, the size of the image displayed in kilobytes,
※+103712K を指定。 ※ +103712 K specified.

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (57-1021, default 57): Enter
Using default value 57
Last cylinder, +cylinders or +size{K,M,G} (57-1021, default 1021): +718200K

※同じく、+700Mではなく、+718200Kを使用Command (m for help): n Also ※, +700 M instead, +718200 K using
Command (m for help): n

Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (438-1021, default 438): Enter
Using default value 438
Last cylinder, +cylinders or +size{K,M,G} (438-1021, default 1021): +128M

※swapは適当でいいので、適当に128M ※ swap so good appropriate, suitable 128M

Command (m for help): t Command (m for help): t
Partition number (1-4): 1 Partition number (1-4): 1
Hex code (type L to list codes): c Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA)) Changed system type of partition 1 to c (W95 FAT32 (LBA))
Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 82
Changed system type of partition 3 to 82 (Linux swap / Solaris)
※忘れずにパーティションタイプを設定Command (m for help): p Do not forget to set the partition ※

Command (m for help): p
Disk /dev/sdb: 1977 MB, 1977614336 bytes
61 heads, 62 sectors/track, 1021 cylinders
Units = cylinders of 3782 * 512 = 1936384 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 56 105865 c W95 FAT32 (LBA)
/dev/sdb2 57 437 720471 83 Linux
/dev/sdb3 438 507 132370 82 Linux swap / Solaris

Command (m for help): w
The partition table has been altered!
ここで、以 下の最初の例と比べてみます。 Now, try the following compared with the first example.
Disk /dev/sdb: 1967 MB, 1967128576 bytes
57 heads, 56 sectors/track, 1203 cylinders
Units = cylinders of 3192 * 512 = 1634304 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 65 103712 c W95 FAT32 (LBA)
/dev/sdb2 66 515 718200 83 Linux
/dev/sdb3 516 598 132468 82 Linux swap / Solaris
1シリンダ 当たり(Units)が前より大きくなり、結果、シリンダ数(start-end)が小さくなりました。 Per cylinder 1 (Units) larger than the previous result, the number of cylinders (start-end) is now smaller.
一方、 Blocks(1Kバイト単位)は前より大きくなりました。 On the other hand, Blocks (1K bytes) are now greater than before.
つまり、必 要な容量を確保した上で、Units単位に切り上げた領域、が確保されます。 In other words, after securing the necessary capacity, Units units rounded up to the area will be secured.
(このバッ クアップ・リストアを繰り返すと、いずれはだんだん領域だけが大きくなる危険性があるので注意。 mkfsでつくったファイルシステムそのものは大きくならず、後ろにゴミがついていくだけ。) (Repeating to restore this backup, because one is aware there is a danger only increases gradually area. Mkfs file system itself is not made in large, just to keep up with junk after.)

なお、この 方法だと、head, sectorsが同じでも、余裕を見てEndを1個うしろにずらす場合があります(もしかすると必ず)。 Note that in this way, head, sectors with the same, you may see End time behind a single shift (possibly always).
もし、pで みて、headとsector(上では57-56)が一致するなら、そのままstart-endの値をつかってすっかり同じテーブルを作った方が、容量的 にはぴったりになります。 If, p - consider, head and sector (on 57-56) if the match, as it made a better start-end Tsukatsu to the same table all the values, and is the perfect size. 最終的に Blocksが「未満」にならなければOKです。 Blocks are ultimately "less" is OK if you avoided.
(たとえ ば、同じメーカの同じ銘柄のSDカードなら同じことが期待される) (For example, the same manufacturer as the brand is expected to be the same if the SD card)

最後に、イ メージの書き戻しをします。 Finally, write-back of the image.

$ sudo dd bs=1M if=FASD_orig_sdb1.vfat of=/dev/sdb1
101+1 records in
101+1 records out
106201088 bytes (106 MB) copied, 26.0068 s, 4.1 MB/s
$ sudo dd bs=1M if=FASD_orig_sdb2.ext3 of=/dev/sdb2
701+1 records in
701+1 records out
735436800 bytes (735 MB) copied, 143.268 s, 5.1 MB/s
あとは、こ のSDをmini2440に差し込んで確認です。 After that, this is a confirmation mini2440 plugged in the SD. 新しくパーティションから作った場合は、mkswapもしておきましょう。 If the newly created partition, mkswap if you let. (mkswap /dev/mmcblk0p3) (mkswap /dev/mmcblk0p3)


熊谷正朗 [→連絡] Akira Akira Kumagai [Contact →]
東北学院大学 工学部 機械知能工学科 RDE Tohoku Gakuin University Faculty of Mechanical Engineering and Intelligent RDE
[| ] [|]