> fastmem > 日誌 > 我的日誌 > [EeePC] full ramdisk linux

帳號: fastmem

暱稱: fastmem

我的書籤

沒有資料

日誌月曆
載入月曆中..
廣告看板

[EeePC] cpu 降速 » « [EeePC] battery

2007/10/29 [EeePC] full ramdisk linux
Let system works in ramdisk. (all changes dispear after reboot)
ctrl-alt-t
# sudo su

# fdisk -lu /dev/sda

Disk /dev/sda: 4001 MB, 4001292288 bytes
255 heads, 63 sectors/track, 486 cylinders, total 7815024 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63     4819499     2409718+  83  Linux
/dev/sda2         4819500     7775459     1477980   83  Linux
/dev/sda3         7775460     7791524        8032+   c  W95 FAT32 (LBA)
/dev/sda4         7791525     7807589        8032+  ef  EFI (FAT-12/16/32)

# eeepc-server:/home/user> mkdir /s2
# eeepc-server:/home/user> mount /dev/sda2 -o loop,ro /s2
# cd /s2
# find | more
./var/tmp/.wh.17919.3
./var/tmp/.wh.27628.3
./var/tmp/.wh.05571.1
./var/tmp/.wh.11618.2

====
# cd /tmp
# mkdir work
# cd work
# cat /boot/initramfs-eeepc.img | gzip -dc | cpio -i
932 blocks

# mv init init.old
# cp /tmp/init3 .
# mv init3 init

====
# eeepc-server:/tmp/work> diff -u init.old  init
--- init.old    2007-10-29 18:14:56.651221809 +0800
+++ init        2007-10-29 18:16:24.232542953 +0800
@@ -8,6 +8,7 @@

 ROOT=`cat /proc/cmdline | sed 's/.*root=// ; s/ .*//'`
 #VERSION=`cat /proc/version | cut -f3 -d" "`
+ROOT=/dev/sda1

 mount -t ext2 -o ro $ROOT /mnt-system
 if [ $? -ne 0 ] ; then
@@ -41,14 +42,26 @@
 #insmod /mnt-system/lib/modules/$VERSION/kernel/fs/unionfs/unionfs.ko >
 #/dev/null

-mount -t unionfs -o dirs=/mnt-user=rw:/mnt-system=ro unionfs /mnt
+mkdir /mnt-user2; mount -t tmpfs none /mnt-user2
+
+# mount -t unionfs -o dirs=/mnt-user2=rw:/mnt-system=ro unionfs /mnt
+mount -t unionfs -o dirs=/mnt-user2=rw:/mnt-user=ro:/mnt-system=ro unionfs
/mnt
+
 if [ $? -ne 0 ]; then
     echo Could not mount unionfs. Starting debugging shell....
     /bin/busybox sh
 fi

+
+
+# mount -t unionfs -o dirs=/mnt-user2=rw:/mnt=ro unionfs /mnt0
+# if [ $? -ne 0 ]; then
+#     echo Could not mount unionfs. Starting debugging shell....
+#     /bin/busybox sh
+# fi
+
 mount --move /mnt-system /mnt/mnt
-umount -l /mnt-user
+# umount -l /mnt-user

 umount /proc


====
# eeepc-server:/tmp/work> find ./ | cpio -H newc -o > ../myram.cpio
937 blocks

# cd ..
# gzip -9 myram.cpio
# eeepc-server:/tmp> mv myram.cpio.gz  myramfs2.img

# mkdir /s1
# mount /dev/sda1 /s1 -o loop -t ext2
# cp myramfs2.img /s1/boot
# cd /s1/boot/grub
# cp menu.lst menu.lst.orig
#  diff -u menu.lst.orig2 menu.lst
--- menu.lst.orig2      2007-07-11 03:38:28.000000000 +0800
+++ menu.lst    2007-10-29 18:24:01.000000000 +0800
@@ -1,16 +1,31 @@
 #
 # Configured by Xandros Configuration system.
 #
-hiddenmenu
+# hiddenmenu
 # default boot entry
 default=0

-# Boot automatically after 1 second.
-timeout=0
+# Boot automatically after 100 second.
+timeout=100

 # Fallback to Configure.
 fallback=2

+title EeePC in ramdisk
+        root (0x80,0)
+       kernel /boot/vmlinuz-2.6.21.4-eeepc nosplash=y rw vga=785 irqpoll
root=/dev/sda1
+       initrd /boot/myramfs2.img
+
+title my Normal Boot
+        root (0x80,0)
+        kernel /boot/vmlinuz-2.6.21.4-eeepc nosplash=y rw vga=785 irqpoll
root=/dev/sda1
+        initrd /boot/myramfs.img
+title my Normal Boot tty
+        root (0x80,0)
+        kernel /boot/vmlinuz-2.6.21.4-eeepc nosplash=y rw vga=785 irqpoll
load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=4096 root=/dev/ram0
+        initrd /boot/filesys
+
+
 title Normal Boot
        root (0x80,0)
        kernel /boot/vmlinuz-2.6.21.4-eeepc quiet rw vga=785 irqpoll
        root=/dev/sda1

====
# cd /
# umount /s1

==
# reboot

# eeepc-server:/home/user> unionctl.static --list /
        /mnt-user2 (rw-)
        /mnt-user (r--)
        / (r--)
# eeepc-server:/home/user> mount
rootfs on / type rootfs (rw)
/dev/sda1 on / type ext2 (ro)
/dev/sda2 on /mnt-user type ext3 (ro,data=ordered)
none on /mnt-user2 type tmpfs (rw)
unionfs on / type unionfs (rw,dirs=/mnt-user2=rw:/mnt-user=ro:/=ro)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw)
tmpfs on /dev/shm type tmpfs (rw)
tmpfs on /tmp type tmpfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
eeepc-server:/home/user>

標籤:
19:10 [ 我的日誌 / 本日人氣 (1) / 累積人氣 (749) / 文章引用 (0) / 發表意見 ]  
文章引用
站內引用 / 引用網址: http://api.mw.net.tw/trackback.php?aid=70403&c=045703 複製