ude:~# dmesg | tail -20 usb 2-1: new high speed USB device using ehci_platform and address 2 usb 2-1: configuration #1 chosen from 1 choice scsi2 : SCSI emulation for USB Mass Storage devices usb-storage: device found at 2 usb-storage: waiting for device to settle before scanning Vendor: ST310212 Model: A Rev: 0811 Type: Direct-Access ANSI SCSI revision: 00 SCSI device sdb: 20005650 512-byte hdwr sectors (10243 MB) sdb: test WP failed, assume Write Enabled sdb: assuming drive cache: write through SCSI device sdb: 20005650 512-byte hdwr sectors (10243 MB) sdb: test WP failed, assume Write Enabled sdb: assuming drive cache: write through sdb: sdb1 sdb2 sdb4 < sdb5 sdb6 > sd 2:0:0:0: Attached scsi disk sdb sd 2:0:0:0: Attached scsi generic sg1 type 0 usb-storage: device scan complete ude:~#認識された /dev/sdb1 を /tmp/boot にマウントする。
ude:~# mkdir /tmp/boot ude:~# mount /dev/sdb1 /tmp/boot ude:~# ls /tmp/boot conf_save.tgz initrd.gz u-boot.buffalo uImage.buffalo_2.6.13_NG hack log.tgz uImage.buffalo uImage.buffalo_2.6.23.fake_2.6.12.6-arm1 initrd.buffalo lost+found uImage.buffalo.orig initrd.buffalo.orig patch.buffalo.zip uImage.buffalo_2.6.12.6 ude:~#ゴミいっぱい。
ude:~# mkdir /mnt/ls-lgl/boot mkdir: cannot create directory `/mnt/ls-lgl/boot': File exists ude:~# (cd /tmp/boot/; tar cf - initrd.buffalo u-boot.buffalo uImage.buffalo uImage.buffalo_2.6.23.fake_2.6.12.6-arm1) |(cd /mnt/ls-lgl/boot/; tar xvf -) initrd.buffalo u-boot.buffalo uImage.buffalo uImage.buffalo_2.6.23.fake_2.6.12.6-arm1 ude:~# ls -l /mnt/ls-lgl/boot total 4216 -rw-r--r-- 1 root root 1486692 Dec 27 2007 initrd.buffalo -rw-r--r-- 1 root root 257356 Oct 26 2007 u-boot.buffalo -rw-r--r-- 2 root root 1284112 Jan 12 11:37 uImage.buffalo -rw-r--r-- 2 root root 1284112 Jan 12 11:37 uImage.buffalo_2.6.23.fake_2.6.12.6-arm1 ude:~#
ude:~# umount /tmp/boot ude:~#物理的にも抜く
ude:/mnt# cp LS-HGL_hackkit_1.00.sh LS-LGL_hackkit_1.00.sh ude:/mnt#
ude:/mnt# vi LS-LGL_hackkit_1.00.sh : : ude:/mnt# diff -u LS-HGL_hackkit_1.00.sh LS-LGL_hackkit_1.00.sh |less --- LS-HGL_hackkit_1.00.sh 2008-03-20 09:37:38.000000000 +0900 +++ LS-LGL_hackkit_1.00.sh 2008-06-28 14:14:25.350469597 +0900 @@ -1,6 +1,6 @@ #! /bin/sh -x -ADDRESS=192.168.2.44 +ADDRESS=192.168.2.41 NETWORK=192.168.2.0 NETMASK=255.255.255.0 BROADCAST=192.168.2.255 @@ -8,11 +8,11 @@ NAMESERVER=192.168.1.2 HOSTNAME=hackkit -MOUNTPOINT=/mnt/debinst -JAIL=$MOUNTPOINT/usr/local/buffalo -WORK=/mnt/disk1/share/debian +MOUNTPOINT=/mnt/tmp/debinst +JAIL=$MOUNTPOINT +BOOT=/mnt/ls-lgl/boot -HACKKIT=$WORK/LS-HGL_hackkit_1.00.tar.gz +HACKKIT=/mnt/debinst_080628.tar.gz #--------------------------------------------------------- # format @@ -51,17 +51,17 @@ mkdir $MOUNTPOINT/boot || exit fi mount -t ext3 /dev/sdb1 $MOUNTPOINT/boot || exit - (cd /boot ; tar cf - uImage.buffalo)|(cd $MOUNTPOINT/boot; tar xvf -) - dd if=/boot/initrd.buffalo of=/boot/initrd.gz bs=64 skip=1 - echo gunziping /boot/initrd.gz ... - gunzip /boot/initrd.gz + (cd $BOOT ; tar cf - uImage.buffalo)|(cd $MOUNTPOINT/boot; tar xvf -) + + dd if=$BOOT/initrd.buffalo of=$BOOT/initrd.gz bs=64 skip=1 + echo gunziping $BOOT/initrd.gz ... + gunzip $BOOT/initrd.gz if [ ! -d /tmp/root ] then mkdir /tmp/root || exit fi - (cd $MOUNTPOINT/dev; tar cf - loop*)|(cd /dev; tar xvf -) - mount -o loop /boot/initrd /tmp/root || exit + mount -o loop $BOOT/initrd /tmp/root || exit mv /tmp/root/linuxrc /tmp/root/linuxrc.orig cat > /tmp/root/linuxrc <こんなもんかなぁ。。。$JAIL/etc/ld.so.conf - chroot $JAIL ldconfig - - mkdir $JAIL/var - mkdir $JAIL/var/lock } #---------------------------------------------------------
Jun 28 16:36:04 ude kernel: usb 2-1: new high speed USB device using ehci_platform and address 3 Jun 28 16:36:04 ude kernel: usb 2-1: configuration #1 chosen from 1 choice Jun 28 16:36:04 ude kernel: scsi3 : SCSI emulation for USB Mass Storage devices Jun 28 16:36:09 ude kernel: Vendor: Maxtor 6 Model: J6QE Rev: 11W0 Jun 28 16:36:09 ude kernel: Type: Direct-Access ANSI SCSI revision: 02 Jun 28 16:36:09 ude kernel: SCSI device sdb: 320173056 512-byte hdwr sectors (163929 MB) Jun 28 16:36:09 ude kernel: sdb: Write Protect is off Jun 28 16:36:09 ude kernel: SCSI device sdb: 320173056 512-byte hdwr sectors (163929 MB) Jun 28 16:36:09 ude kernel: sdb: Write Protect is off Jun 28 16:36:09 ude kernel: sdb: unknown partition table Jun 28 16:36:09 ude kernel: sd 3:0:0:0: Attached scsi disk sdb Jun 28 16:36:09 ude kernel: sd 3:0:0:0: Attached scsi generic sg1 type 0
ude:/mnt# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. The number of cylinders for this disk is set to 19929. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help):パーティションを見る
Command (m for help): p Disk /dev/sdb: 163.9 GB, 163928604672 bytes 255 heads, 63 sectors/track, 19929 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System Command (m for help):ない。
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-19929, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-19929, default 19929): +200M Command (m for help):続いて /
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (26-19929, default 26): Using default value 26 Last cylinder or +size or +sizeM or +sizeK (26-19929, default 19929): +2048M Command (m for help):続いて swap
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (276-19929, default 276): Using default value 276 Last cylinder or +size or +sizeM or +sizeK (276-19929, default 19929): +256M Command (m for help):最後に残り全部
Command (m for help): n Command action e extended p primary partition (1-4) p Selected partition 4 First cylinder (308-19929, default 308): Using default value 308 Last cylinder or +size or +sizeM or +sizeK (308-19929, default 19929): Using default value 19929 Command (m for help):sdb3 を swap にする。
Command (m for help): p Disk /dev/sdb: 163.9 GB, 163928604672 bytes 255 heads, 63 sectors/track, 19929 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 25 200781 83 Linux /dev/sdb2 26 275 2008125 83 Linux /dev/sdb3 276 307 257040 83 Linux /dev/sdb4 308 19929 157613715 83 Linux 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: 163.9 GB, 163928604672 bytes 255 heads, 63 sectors/track, 19929 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 25 200781 83 Linux /dev/sdb2 26 275 2008125 83 Linux /dev/sdb3 276 307 257040 82 Linux swap / Solaris /dev/sdb4 308 19929 157613715 83 Linux Command (m for help):パーティションを書込んで終了
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. ude:/mnt#
ude:/mnt# sh -x LS-LGL_hackkit_1.00.sh + ADDRESS=192.168.2.41 + NETWORK=192.168.2.0 + NETMASK=255.255.255.0 + BROADCAST=192.168.2.255 + GATEWAY=192.168.2.1 + NAMESERVER=192.168.1.2 + HOSTNAME=hackkit + MOUNTPOINT=/mnt/tmp/debinst + JAIL=/mnt/tmp/debinst + BOOT=/mnt/ls-lgl/boot + HACKKIT=/mnt/debinst_080628.tar.gz : : + chroot /mnt/tmp/debinst /usr/local/sbin/mkimage -A ARM -O Linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initrd -d /tmp/initrd.gz /mnt/ls-lgl/boot/initrd.buffalo chroot: cannot run command `/usr/local/sbin/mkimage': No such file or directory : : + umount /mnt/tmp/debinst ude:/mnt#mkimage を置くの忘れてた。
ude:/mnt# which mkimage /usr/local/sbin/mkimage ude:/mnt#LS-GL セルフの mkimage を使うようスクリプトを修正
ude:/mnt# mv LS-LGL_hackkit_1.00.sh{,.old} ude:/mnt# cp LS-LGL_hackkit_1.00.sh{.old,} ude:/mnt# vi LS-LGL_hackkit_1.00.sh : : ude:/mnt# diff -u LS-LGL_hackkit_1.00.sh.old LS-LGL_hackkit_1.00.sh --- LS-LGL_hackkit_1.00.sh.old 2008-06-28 14:14:25.350469597 +0900 +++ LS-LGL_hackkit_1.00.sh 2008-06-28 17:03:10.428722432 +0900 @@ -77,9 +77,9 @@ umount /tmp/root echo gziping $BOOT/initrd ... gzip $BOOT/initrd - mv $BOOT/initrd.gz $MOUNTPOINT/tmp - chroot $MOUNTPOINT /usr/local/sbin/mkimage -A ARM -O Linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initrd -d /tmp/initrd.gz $BOOT/initrd.buffalo - rm $MOUNTPOINT/tmp/initrd.gz + /usr/local/sbin/mkimage -A ARM -O Linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initrd -d $BOOT/initrd.gz $BOOT/initrd.buffalo + mv $BOOT/initrd.buffalo $MOUNTPOINT/boot + rm $BOOT/initrd.gz sync umount $MOUNTPOINT/boot ude:/mnt#再度実行
ude:/mnt# sh -x LS-LGL_hackkit_1.00.sh + ADDRESS=192.168.2.41 + NETWORK=192.168.2.0 + NETMASK=255.255.255.0 : + sync + cd / + umount /mnt/tmp/debinst ude:/mnt#今度はできたか?
マウントして確認する。
ude:/mnt# mount /dev/sdb2 /tmp/root ude:/mnt# mount /dev/sdb1 /tmp/root/boot ude:/mnt# ls !$ ls /tmp/root/boot initrd.buffalo lost+found uImage.buffalo ude:/mnt# ls -l !$ ls -l /tmp/root/boot total 2732 -rw-r--r-- 1 root root 1486321 Jun 28 17:05 initrd.buffalo drwx------ 2 root root 12288 Jun 28 17:03 lost+found -rw-r--r-- 1 root root 1284112 Jan 12 11:37 uImage.buffalo ude:/mnt#ま、ここまで来るのに、スクリプトを何度か直したことは内緒である。
アンマウントする。
ude:/mnt# umount /tmp/root/boot/ ude:/mnt# umount /tmp/root ude:/mnt#
: : RAMDISK: Compressed image found at block 0 EXT2-fs warning: checktime reached, running e2fsck is recommended VFS: Mounted root (ext2 filesystem). ---- in modified linuxrc --- XFS mounting filesystem sda2 Starting XFS recovery on filesystem: sda2 (dev: sda2) Ending XFS recovery on filesystem: sda2 (dev: sda2) VFS: Mounted root (xfs filesystem). Trying to move old root to /initrd ... failed Unmounting old root Trying to free ramdisk memory ... okay Freeing init memory: 96K Mount failed for selinuxfs on /selinux: No such file or directory INIT: version 2.86 booting Setting the system clock. Cannot access the Hardware Clock via any known method. Use the --debug option to see the details of our search for an access method. * Unable to set System Clock to: Sat Jun 28 17:18:58 UTC 2008 Activating swap...done. Setting the system clock. Cannot access the Hardware Clock via any known method. Use the --debug option to see the details of our search for an access method. * Unable to set System Clock to: Sat Jun 28 17:18:59 UTC 2008 Cleaning up ifupdown.... Loading kernel modules...FATAL: Could not load /lib/modules/2.6.23.fake_2.6.12.6-arm1/modules.dep: No such file or directory Checking file systems...fsck 1.40.11 (17-June-2008) done. Setting kernel variables (/etc/sysctl.conf)...Unknown HZ value! (0) Assume 100. done. Mounting local filesystems...done. Activating swapfile swap...done. Setting up networking.... Configuring network interfaces...eth0: link down done. eth0: link up<5>, full duplex<5>, speed 100 Mbps<5> eth0: link down eth0: link up<5>, full duplex<5>, speed 100 Mbps<5> INIT: Entering runlevel: 2 Starting system log daemon.... Starting kernel log daemon.... Starting periodic command scheduler: crond.ここで止まってしまった。
また長い「ほったらかし状態」に入りそっ
|
← EABI で debootstrap 再チャレンジ(2)構想 |
ハックの記録 LinkStation/玄箱 をハックしよう |
→ オープンソースカンファレンス 2008 Kansai |