#!/bin/sh # script to start and stop cloop devices # and mount and umount cloop filesystems # # chkconfig: 35 60 20 # description: Starts, stops cloop modules # # set the maximum number of cloop device # refer to the MAX_CLOOP in compressed_loop.c MAX_CLOOP=8 CLOOP_DEV[0]=/dev/cloop0 CLOOP_FIL[0]=/tmp/a.cloop CLOOP_DIR[0]=/tmp/a #CLOOP_DEV[1]=/dev/cloop1 #CLOOP_FIL[1]=/dummy1 #CLOOP_DIR[1]=/dummy1 #CLOOP_DEV[2]=/dev/cloop2 #CLOOP_FIL[2]=/dummyr2 #CLOOP_DIR[2]=/dummy2 #CLOOP_DEV[3]=/dev/cloop3 #CLOOP_FIL[3]=/dummy3 #CLOOP_DIR[3]=/dummy3 # Source function library. . /etc/init.d/functions function abend(){ echo ERROR: $@ failure exit 1 } function load_cloop_module(){ lsmod |grep cloop > /dev/null [ $? -eq 0 ] && (echo "cloop has already been loaded.";return ) modprobe cloop [ $? -ne 0 ] && abend can not load the cloop module. i=0; FLAG=FALSE while [ $i -lt 10 ] do sleep 1 if [ -b "/dev/cloop`expr $MAX_CLOOP - 1`" ] then FLAG=TRUE; break fi i=`expr $i + 1` done [ "$FLAG" != TRUE ] && abend not found the maximum cloop device. } function bind_and_mount(){ # check a cloop device [ -b $1 ] || abend $1 is a invalid cloop device. # check a cloop file [ -f $2 ] || abend not found $2 file. head -3 $2 | grep cloop 2>&1 > /dev/null [ $? -eq 0 ] || abend $2 is a invalid cloop file. # check mount directory [ -d $3 ] || abend $3 is not directory. losetup $1 $2 || abend can not bind $2 file to $1 device. mount -r -t iso9660 $1 $3 || abend can not mount $1 on $3. } function start(){ load_cloop_module i=0 while [ -n "${CLOOP_DEV[$i]}" -a \ -n "${CLOOP_FIL[$i]}" -a \ -n "${CLOOP_DIR[$i]}" ] do bind_and_mount ${CLOOP_DEV[$i]} ${CLOOP_FIL[$i]} ${CLOOP_DIR[$i]} i=`expr $i + 1` done success touch /var/lock/subsys/cloop } function stop(){ i=0 while [ -n "${CLOOP_DEV[$i]}" -a \ -n "${CLOOP_FIL[$i]}" -a \ -n "${CLOOP_DIR[$i]}" ] do umount ${CLOOP_DIR[$i]} losetup -d ${CLOOP_DEV[$i]} i=`expr $i + 1` done modprobe -r cloop success rm -f /var/lock/subsys/cloop } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|reload) stop start ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit 0 |
| # vi /etc/init.d/cloop # chown root:root /etc/init.d/cloop # chmod 755 /etc/init.d/cloop |
| # chkconfig --add cloop # chkconfig --list|grep cloop |
| # chkconfig: 35 60 20 # description: Starts, stops cloop modules |
| # yum install global # yum update global |
| $ tar -zxvf global-5.4.1.tar.gz $ cd global-5.4.1 $ ./configure $ make $ su # make install |
| $ cd <Âоݥ½¡¼¥¹¤Î¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê> $ gtags |
| $ htags -anFt¡¡HTML¤Î¥¿¥¤¥È¥ë |
| /boot/grub/grub.conf¤ÎÊÔ½¸ÆâÍÆ ¡GRUB¤òtextɽ¼¨¤Ë¤¹¤ë¤¿¤á¡¢splashimage¤ò¥³¥á¥ó¥È¥¢¥¦¥È¤¹¤ë¡£ # splashimage=(hd0,0)/grub/splash.xpm.gz ¢¥·¥ê¥¢¥ë¥Ý¡¼¥È¤ÎÄÌ¿®ÀßÄê¤ò¹Ô¤¦ serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 £¥°¥é¥Õ¥£¥Ã¥¯¤È¥·¥ê¥¢¥ë¤ÎξÊý¤¬»ÈÍѤǤ¤ë¤è¤¦ÀßÄê terminal --timeout=3 serial console ¡¡¡¡¢¨3ÉÃ°ÊÆâ¤Ë¥¡¼ÆþÎϤ¬¤¢¤Ã¤¿¾ì¹ç¤ÏserialÀܳ¡¢ ¡¡¡¡¡¡¡¡Ìµ¤¤¾ì¹ç¤Ï¡¢¥°¥é¥Õ¥£¥Ã¥¯Àܳ¡£ ¡¡¡¡¡¡¡¡É¬¤ºserialÀܳ¤Ë¤¹¤ë¾ì¹ç¤Ï¡¢"terminal serial" |
| # grub-install /dev/hda |
| /boot/grub/grub.conf¤ÎÊÔ½¸ÆâÍÆ ¥«¡¼¥Í¥ë¥ª¥×¥·¥ç¥ó¤Ë¡¢"console=tty0 console=ttyS0,115200n8r"¤òÄɲ乤롣 kernel /vmlinuz-2.6.19-1.2288.2.1.fc5 ro root=LABEL=/ |
| # grub-install /dev/hda |
| /etc/inittab¤Ë°Ê²¼¤ÎÀßÄê¤òÄɲà co:2345:respawn:/sbin/agetty -h 115200 ttyS0 vt100 |
| # init q |
| console vc/1 ¡¡¡ãÃæÎ¬¡ä tty10 tty11 ttyS0 <- Äɲà |
| NOZEROCONF=yes |
| alias net-pf-10 off alias ipv6 off |
| $ ifconfig eth0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX inet addr:192.168.1.10 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::240:63ff:feea:7bed/64 Scope:Link <°Ê²¼Î¬> |
| $ ifconfig eth0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX inet addr:192.168.1.10 Bcast:192.168.0.255 Mask:255.255.255.0 <°Ê²¼Î¬> |
| # rpm -q zlib-devel |
| # yum install zlib-devel |
| $ cd /tmp $ tar -zxvf cloop_2.05~20060829-1.tar.gz $ cd cloop-2.05~20060829/ |
| $ vi compressed_loop.c 29¹ÔÌܤÎ"REDHAT_KERNEL"¤Îdefine¤Î¥³¥á¥ó¥È¤ò¤Ï¤º¤¹¡£ before: 29: /* #define REDHAT_KERNEL */ after: 29: #define REDHAT_KERNEL |
| $ vi compressed_loop.c 26¹ÔÌܤÎ"CLOOP_MAX"¤ÎÃͤòɬÍפ˱þ¤¸Êѹ¹¤¹¤ë¡£ before: 26 #define CLOOP_MAX 8 after: 26 #define CLOOP_MAX 16 |
| # make KERNEL_DIR=/usr/src/redhat/BUILD/kernel-2.6.19/linux-2.6.19.i686/ |
| # mkdir -p /lib/modules/`uname -r`/misc && \ cp cloop.ko /lib/modules/`uname -r`/misc; # depmod -a |
| # modinfo cloop filename: /lib/modules/2.6.19-1.2288.2.1.fc5/misc/cloop.ko description: Transparently decompressing loopback block device author: Klaus Knopper (Kernel 2.4 and up, Knoppix version), Paul Russel (initial version) <°Ê²¼Î¬> |
| # modprobe cloop # lsmod|grep cloop cloop 15264 0¡¡<-ɽ¼¨¤µ¤ì¤ë¤³¤È¤ò³Îǧ |
| # ls /dev/cloop* /dev/cloop0 ¡¦¡¦¡¦¡¡<-ɽ¼¨¤µ¤ì¤ë¤³¤È¤ò³Îǧ |
| # install -m0755 create_compressed_fs /usr/local/bin/ # install -m0755 extract_compressed_fs /usr/local/bin/ |
| # mkisofs -r datadir | \ create_compressed_fs - 65536 > datadir.iso.compressed ; datadir : Âоݥǡ¼¥¿¤Î¥Ç¥£¥ì¥¯¥È¥ê̾ datadir.iso.compressed : cloop¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¥Õ¥¡¥¤¥ë̾ |
| <Îã:cloop0¥Ç¥Ð¥¤¥¹¤Ë¡¢iso.compressed¥Õ¥¡¥¤¥ë¤ò³ç¤êÉÕ¤±¤ë> # losetup /dev/cloop0 /tmp/datadir.iso.compressed |
| # mount -o ro -t whatever /dev/cloop0 /mnt/compressed |
| # yum install yum-utils |
| # yumdownloader --source kernel.i686 |
| # rpm -ivh /tmp/kernel-2.6.19-1.2288.2.1.fc5.src.rpm |
| #cd /tmp # rpm -ivh ./kernel-2.6.19-1.2288.2.1.fc5.src.rpm |
| /usr/src/redhat/ ¡¡¨§/SOURCES¡¡ ¡¦¡¦¡¦¥½¡¼¥¹¥³¡¼¥É&¥½¡¼¥¹¤Îº¹Ê¬¥Ñ¥Ã¥Á ¡¡¨¢¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¢ª¥Ç¥£¥ì¥¯¥È¥êľ²¼¤Ë¿Î̤Υե¡¥¤¥ë¤¬À¸À® ¡¡¨¦/SPECS¡¡¡¡¡¦¡¦¡¦RPM¤ÈSRPM¤ÎÀ¸À®¼ê½ç¥Õ¥¡¥¤¥ë ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¢ªkernel-2.6.spec¥Õ¥¡¥¤¥ë¤¬À¸À® |
| (a) ¤½¤Î£±¡§²£Ãå¤Ë¤ä¤ëÊýË¡ | |||
| ¡¡ | ¡¡SRPM¤«¤é¥Ð¥¤¥Ê¥ê¡¼¤òÀ¸À®¤·¤Æ¤·¤Þ¤¤¡¢¤½¤Î²áÄø¤Çversion.h¤Ê¤É¤òÀ¸À®¤·¤Æ¤·¤Þ¤¦¡£ ¡¡¥½¡¼¥¹¥³¡¼¥É¤òÀ¸À®¤¹¤ë¤À¤±¤Ç¤¢¤ì¤Ð¡¢bzImage¤Îmake¤¬³«»Ï¤µ¤ì¤¿»þÅÀ¤Ç¶¯À©½ªÎ»¤·¤Æ¤·¤Þ¤Ã¤Æ¤â²Ä¡£
# ¥½¡¼¥¹¥³¡¼¥É¤Ï¡¢/usr/src/redhat/BUILD°Ê²¼¤Ë³ÊǼ¡£ | ||
| (b) ¤½¤Î£²¡§ÃúÇ«¤Ë¤ä¤ëÊýË¡ | |||
| ¡¡ | ¡¡SRPM¤«¤é¥½¡¼¥¹¥³¡¼¥É¤òÀ¸À®¤¹¤ë¡£¤½¤Î¸å¼êư¤Ç¡¢version.h¤Ê¤É¤ÎÀ¸À®¤ò¹Ô¤¦¡£(¤Ç¤âkernel¤òbuild¤¹¤ë(a)¤¬³Î¼Â¤È»×¤ï¤ì¤ë¡£) ¡¡(i)¥½¡¼¥¹¥³¡¼¥É¤ÎŸ³«¤È¥Ñ¥Ã¥Á¤ÎŬÍÑ
¡¡(ii)¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤òÀßÄꤷɬÍפʥե¡¥¤¥ë¤òÀ¸À®¤¹¤ë
| ||