# mkdir /tmp/root mkdir: Cannot create directory `/tmp/root': File exists # mount /dev/sdc2 /tmp/root XFS mounting filesystem sdc2 # ls /tmp/root/boot # mount /dev/sdc1 /tmp/root/boot #
# cd /tmp/root/boot # ls conf_save.tgz initrd.gz conf_save.tgz.orig log.tgz hddrootfs.buffalo.updated.done lost+found initrd.buffalo uImage.buffalo initrd.buffalo.orig #initrd の root のパスワードをつぶしたときのが残っていた。
gunzip のみ実行
# gunzip initrd.gz #
# ls /dev/loop* ls: /dev/loop*: No such file or directoryloop は残ってないのね。
# mknod /dev/loop0 b 7 0 # mkdir /tmp/initrd # mount -o loop initrd /tmp/initrd # ls /tmp/initrd/ bin lib lost+found root sys var dev libexec mnt rootfs tmp etc linuxrc proc sbin usr #
# cd /tmp/initrd/ # ls bin lib lost+found root sys var dev libexec mnt rootfs tmp etc linuxrc proc sbin usr # mv linuxrc linuxrc.orig # cp linuxrc.orig linuxrc # vi linuxrc : :いきなりにしては、ちょっとビシバシ消しすぎたかも。
# diff -c linuxrc.orig linuxrc -sh: diff: not found #がー、diff がない。
# cat linuxrc #!/bin/sh export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin echo "---- in modified linuxrc ---" mount proc /proc -t proc mount sysfs /sys -t sysfs . /usr/local/bin/libbuffalo . /usr/local/lib/libsys . /usr/local/lib/libmsg fsck_disks() { PadPrint "Starting :fsck_disks(boot) ... " fsck.ext3 -pyf /dev/${DEV_BOOT} > /dev/null 2>&1 > /dev/null if [ $? -ne 0 ] ; then echo "[Failed. ]" else echo "[Success.]" fi PadPrint "Starting :fsck_disks(rootfs) ... " case ${ROOTFS_FS} in ext3) FsckEXT3 /dev/${DEV_ROOTFS1} > /dev/null 2>&1 > /dev/null RET=$? ;; *) FsckXFS /dev/${DEV_ROOTFS1} > /dev/null 2>&1 > /dev/null RET=$? ;; esac if [ ${RET} -ne 0 ] ; then echo "[Failed. ]" else echo "[Success.]" fi } AssembleSysMd() { /etc/init.d/startSysMd.sh $1 } HddRoot() { echo "-HddRoot-" AssembleSysMd boot fsck_disks AssembleSysMd echo "0x901" > /proc/sys/kernel/real-root-dev } RamdiskRoot() { echo "-RamdiskRoot-" echo "0x100" >/proc/sys/kernel/real-root-dev } CommandMode() { echo "-CommandMode-" mount -a /sbin/getty -L ttyS0 115200 vt100 ##/bin/sh } reset_date() { TMP=`date "+%s"` if [ ${TMP} -lt 1133362800 ] || [ ${TMP} -ge 1606748400 ] ; then date ${INITIAL_DATE} if [ -L "${HW_CLOCK}" ] ; then hwclock --systohc --localtime else hwclock -w fi fi } # set the system time from the hardware clock HW_CLOCK=`which hwclock` if [ -L "${HW_CLOCK}" ] ; then # not busybox hwclock version hwclock --hctosys --localtime else # busybox hwclock version hwclock -s fi reset_date date ldconfig depmod ## Setup Micon communication port and send flash-boot complete message. miconapl -b -a boot_flash_ok > /dev/null echo "linuxrc:choose operation (timeout 4[s])" echo -n " 1:RamRoot other:HddRoot ? " ## timeout is 4[s] ANSWER=`/usr/local/bin/keyinput -t 4` case "$ANSWER" in 1) RamdiskRoot ;; 9) CommandMode ;; *) HddRoot ;; esac umount /sys umount /proc umount -a exit 0 #
# cd / # umount /tmp/initrd #
# cd /tmp/root/boot # ls -l -rw-r--r-- 1 root root 23914 Nov 1 00:51 conf_save.tgz -rw-r--r-- 1 root root 23832 Nov 1 00:44 conf_save.tgz.orig -rw-r--r-- 1 root root 104734676 Jul 22 2008 hddrootfs.buffalo.updated.done -rw-r--r-- 1 root root 16777216 Nov 1 01:13 initrd -rw-r--r-- 1 root root 5596134 Mar 2 2008 initrd.buffalo -rw-r--r-- 1 root root 5622690 Jul 22 2008 initrd.buffalo.orig -rw-r--r-- 1 root root 151403 Nov 1 00:51 log.tgz drwxr-xr-x 2 root root 4096 Nov 1 01:10 lost+found -rw-r--r-- 1 root root 1757556 Nov 1 2007 uImage.buffalo # gzip initrd # ls -l -rw-r--r-- 1 root root 23914 Nov 1 00:51 conf_save.tgz -rw-r--r-- 1 root root 23832 Nov 1 00:44 conf_save.tgz.orig -rw-r--r-- 1 root root 104734676 Jul 22 2008 hddrootfs.buffalo.updated.done -rw-r--r-- 1 root root 5596134 Mar 2 2008 initrd.buffalo -rw-r--r-- 1 root root 5622690 Jul 22 2008 initrd.buffalo.orig -rw-r--r-- 1 root root 5597818 Nov 1 01:25 initrd.gz -rw-r--r-- 1 root root 151403 Nov 1 00:51 log.tgz drwxr-xr-x 2 root root 4096 Nov 1 01:10 lost+found -rw-r--r-- 1 root root 1757556 Nov 1 2007 uImage.buffalo #
# chroot /tmp/root sh-3.1# which mkimage /usr/local/sbin/mkimage sh-3.1# cd /boot sh-3.1# ls -l total 120776 -rw-r--r-- 1 root root 23914 Nov 1 00:51 conf_save.tgz -rw-r--r-- 1 root root 23832 Nov 1 00:44 conf_save.tgz.orig -rw-r--r-- 1 root root 104734676 Jul 22 2008 hddrootfs.buffalo.updated.done -rw-r--r-- 1 root root 5596134 Mar 2 2008 initrd.buffalo -rw-r--r-- 1 root root 5622690 Jul 22 2008 initrd.buffalo.orig -rw-r--r-- 1 root root 5597818 Nov 1 01:25 initrd.gz -rw-r--r-- 1 root root 151403 Nov 1 00:51 log.tgz drwxr-xr-x 2 root root 4096 Nov 1 01:10 lost+found -rw-r--r-- 1 root root 1757556 Nov 1 2007 uImage.buffalo sh-3.1# /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 Image Name: initrd Created: Thu Nov 1 01:27:15 2007 Image Type: ARM Linux RAMDisk Image (gzip compressed) Data Size: 5597818 Bytes = 5466.62 kB = 5.34 MB Load Address: 0x00000000 Entry Point: 0x00000000 sh-3.1# ls -l total 120776 -rw-r--r-- 1 root root 23914 Nov 1 00:51 conf_save.tgz -rw-r--r-- 1 root root 23832 Nov 1 00:44 conf_save.tgz.orig -rw-r--r-- 1 root root 104734676 Jul 22 2008 hddrootfs.buffalo.updated.done -rw-r--r-- 1 root root 5597882 Nov 1 01:27 initrd.buffalo -rw-r--r-- 1 root root 5622690 Jul 22 2008 initrd.buffalo.orig -rw-r--r-- 1 root root 5597818 Nov 1 01:25 initrd.gz -rw-r--r-- 1 root root 151403 Nov 1 00:51 log.tgz drwxr-xr-x 2 root root 4096 Nov 1 01:10 lost+found -rw-r--r-- 1 root root 1757556 Nov 1 2007 uImage.buffalo sh-3.1# exit exit #でけた。
|
← debian 化(6)debian ディレクトリツリーの展開 |
ハックの記録 LinkStation/玄箱 をハックしよう |
→ debian 化(8)おっと危ない |