root fs の書込み

SheevaPlug

SheevaPlug_DocumentationPackage1.2.zip を展開してできた SheevaPlug Development Kit - Writing Jaunty Filesystem on the NAND flash-Rev1.2.pdf の
3. Writing jffs2 image to NAND Flash:
の 5. 以降に準じて進める

5. /proc/mtd の確認

-sh-3.2# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00200000 00020000 "uImage"
mtd2: 1fd00000 00020000 "root"
-sh-3.2#
3つある。
先日は2つ、ブートしているのは、同じカーネルのはずなのに。

6. コマンドの確認

-sh-3.2# which flash_eraseall
/usr/sbin/flash_eraseall
-sh-3.2# which nandwrite
/usr/sbin/nandwrite
-sh-3.2#

7. パーティションを消す

mtd2 だけ消す
-sh-3.2# flash_eraseall -j /dev/mtd2
Erasing 128 Kibyte @ 1f20000 --  6 % complete. Cleanmarker written at 1f20000.
Skipping bad block at 0x01f40000
Erasing 128 Kibyte @ 4b40000 -- 14 % complete. Cleanmarker written at 4b40000.
Skipping bad block at 0x04b60000
Erasing 128 Kibyte @ 4fc0000 -- 15 % complete. Cleanmarker written at 4fc0000.
Skipping bad block at 0x04fe0000
Erasing 128 Kibyte @ 76e0000 -- 23 % complete. Cleanmarker written at 76e0000.
Skipping bad block at 0x07700000
Erasing 128 Kibyte @ bee0000 -- 37 % complete. Cleanmarker written at bee0000.
Skipping bad block at 0x0bf00000
Erasing 128 Kibyte @ cc00000 -- 40 % complete. Cleanmarker written at cc00000.
Skipping bad block at 0x0cc20000

Skipping bad block at 0x0cc40000
Erasing 128 Kibyte @ 12960000 -- 58 % complete. Cleanmarker written at 12960000.
Skipping bad block at 0x12980000
Erasing 128 Kibyte @ 131a0000 -- 60 % complete. Cleanmarker written at 131a0000.
Skipping bad block at 0x131c0000
Erasing 128 Kibyte @ 13720000 -- 61 % complete. Cleanmarker written at 13720000.
Skipping bad block at 0x13740000
Erasing 128 Kibyte @ 14ce0000 -- 65 % complete. Cleanmarker written at 14ce0000.
Skipping bad block at 0x14d00000
Erasing 128 Kibyte @ 14d20000 -- 65 % complete. Cleanmarker written at 14d20000.
Skipping bad block at 0x14d40000
Erasing 128 Kibyte @ 14f40000 -- 65 % complete. Cleanmarker written at 14f40000.
Skipping bad block at 0x14f60000
Erasing 128 Kibyte @ 151e0000 -- 66 % complete. Cleanmarker written at 151e0000.
Skipping bad block at 0x15200000
Erasing 128 Kibyte @ 15740000 -- 67 % complete. Cleanmarker written at 15740000.
Skipping bad block at 0x15760000
Erasing 128 Kibyte @ 15880000 -- 67 % complete. Cleanmarker written at 15880000.
Skipping bad block at 0x158a0000
Erasing 128 Kibyte @ 178c0000 -- 74 % complete. Cleanmarker written at 178c0000.
Skipping bad block at 0x178e0000
Erasing 128 Kibyte @ 1ae80000 -- 84 % complete. Cleanmarker written at 1ae80000.
Skipping bad block at 0x1aea0000
Erasing 128 Kibyte @ 1fce0000 -- 99 % complete. Cleanmarker written at 1fce0000.
-sh-3.2#
相変わらず気持ち悪い

8. uImage の書込み

スキップ

9. jffs2 image の書込み

ubuntu-9.0.5.Release.jffs2 ってどこにある?
NFS サーバの LS-GL 側で探す。
yasunari@ude:~$ cd /srv/nfs/rootfsv1.0/
yasunari@ude:/srv/nfs/rootfsv1.0$ find . -name 'ubuntu-9*' -print
yasunari@ude:/srv/nfs/rootfsv1.0$
ないやん。
こういうことがこのマニュアルは駄目。

SheevaPlug_FileSystem1.2.zip を解く。

yasunari@ude:/srv/nfs/rootfsv1.0$ cd /tmp/
yasunari@ude:/tmp$ ls /mnt/SheevaPlug/1.2/SheevaPlug_FileSystem1.2.zip
/mnt/SheevaPlug/1.2/SheevaPlug_FileSystem1.2.zip
yasunari@ude:/tmp$ unzip !$
unzip /mnt/SheevaPlug/1.2/SheevaPlug_FileSystem1.2.zip
Archive:  /mnt/SheevaPlug/1.2/SheevaPlug_FileSystem1.2.zip
  inflating: SheevaPlug_Filesystem/ubuntu-9.0.5.Release.jffs2
yasunari@ude:/tmp$
NFS root に置く。
yasunari@ude:/tmp$ su
Password:
ude:/tmp# mv SheevaPlug_Filesystem/ubuntu-9.0.5.Release.jffs2 /srv/nfs/rootfsv1.0/
ude:/tmp# exit
exit
yasunari@ude:/tmp$

SheevaPlug 側で

-sh-3.2# ls
bin                         mnt
dev                         proc
etc                         sbin
lib                         ubuntu-9.0.5.Release.jffs2
linuxrc                     usr
-sh-3.2# nandwrite -p /dev/mtd2 ubuntu-9.0.5.Release.jffs2
Writing data to block 0
Writing data to block 20000
Writing data to block 40000
Writing data to block 60000
	:
	:
Writing data to block 87c0000
Writing data to block 87e0000
Writing data to block 8800000
Writing data to block 8820000
Writing data to block 8840000
-sh-3.2#
できたかな。

10 ?

目的が書いてないが、確認?
-sh-3.2# mkdir /mnt1
-sh-3.2# mount -t jffs2 /dev/mtdblock2 /mnt1
うんともすんとも
-sh-3.2#
しばらくして、プロンプトが帰ってきた。
-sh-3.2# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock2          521216    152560    368656  29% /mnt1
-sh-3.2# ls /mnt1
bin      etc      media    proc     selinux  tmp
boot     home     mnt      root     srv      usr
dev      lib      opt      sbin     sys      var
-sh-3.2#

リスタート

-sh-3.2# shutdown -r now
-sh: shutdown: command not found
-sh-3.2# 
shutdown は無い
-sh-3.2# reboot
The system is going down NOW!
Sending SIGTERM to all processes
Terminated
Requesting system reboot
md: stopping all md devices.
Restarting system.
Reseting !!

         設_  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_
| | | |___|  _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
 \___/    |____/ \___/ \___/ \__|
 ** MARVELL BOARD: SHEEVA PLUG LE

U-Boot 1.1.4 (Apr  9 2009 - 12:23:12) Marvell version: 3.4.16

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CEE60

Soc: 88F6281 A0 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz

DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000   size 256MB
DRAM CS[1] base 0x10000000   size 256MB
DRAM Total size 512MB  16bit width
Flash:  0 kB
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:512 MB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME], egiga1
Hit any key to stop autoboot:  0
Marvell>>

環境変数の復元

bootargs を戻す
Marvell>> setenv bootargs 'console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=10.4.50.4:10.4.50.5:10.4.50.5:255.255.255.0:DB88FXX81:eth0:none'
Marvell>> printenv bootargs
bootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=10.4.50.4:10.4.50.5:10.4.50.5:255.255.255.0:DB88FXX81:eth0:none
Marvell>>
保存する
Marvell>> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
Marvell>>

reboot

Marvell>> reset
	:
	:
P-Config: Complete:
      device=eth0, addr=10.4.50.4, mask=255.255.255.0, gw=10.4.50.5,
     host=DB88FXX81, domain=, nis-domain=(none),
     bootserver=10.4.50.5, rootserver=10.4.50.5, rootpath=
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
eth0: link up, full duplex, speed 1 Gbps
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 124K
Warning: unable to open an initial console.
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.



←(前のページ)
NFS boot(2)
当月のハックの記録
SheevaPlug/玄柴(KURO-SHEEVA)をハックしよう トップ
(次のページ)→
root fs の書込み(2)

Copyright (C) 2003-2009 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市