initramfs init kodu

Aşağıdaki kodlar initrd nin merkezini barındırıyor.

Sadece Cdrom aygıtını bulup mount ediyor.

Disk bölümlerinden mount etme kısmı hala eklenecek halde :(

Biraz Tembelmiyim ne ?

1#!/bin/ash
# http://www.truvalinux.org.tr
# caylakpenguen
#
INIT=/sbin/init
CDLABEL="TRUVA"
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
# Mount /proc and /sys:
mount -n proc /proc -t proc
mount -n sysfs /sys -t sysfs
mount -n devtmpfs /dev -t devtmpfs

/bin/mdev -s

mount -n -t tmpfs tmpfs /newroot
cd /newroot/
mkdir -p dev mnt mnt/cdrom mnt/anatolya tmp sys proc media
# ROOTDEV=$(findfs LABEL=$CDLABEL)
ROOTDEV=$(cat /proc/sys/dev/cdrom/info | grep -i "drive name:" | cut -f3)
mount -o ro /dev/$ROOTDEV /newroot/mnt/cdrom
/bin/modprobe squashfs
cd /newroot
mount -t squashfs -o loop,ro /newroot/mnt/cdrom/anatolya.img /newroot/mnt/anatolya

cat /newroot/mnt/cdrom/test

ln -s mnt/anatolya/bin bin
ln -s mnt/anatolya/sbin sbin
ln -s mnt/anatolya/lib lib
ln -s mnt/anatolya/boot boot
ln -s mnt/anatolya/usr usr
ln -s mnt/anatolya/opt opt
#
cp -ra mnt/anatolya/etc .
cp -ra mnt/anatolya/root .
cp -ra mnt/anatolya/home .
cp -ra mnt/anatolya/var .
chmod 1777 tmp
echo 0x0100 > /proc/sys/kernel/real-root-dev
mount --bind /dev /newroot/dev
cd /newroot
rm -f etc/rc.d/rc.S
cp -a /etc/rc.S etc/rc.d/
echo "anatolya.truvalinux.org.tr" >etc/HOSTNAME
echo "127.0.0.1 localhost
127.0.0.1 anatolya.truvalinux.org.tr anatolya" > etc/hosts
umount -n /proc
umount -n /sys
exec /bin/switch_root -c /dev/console /newroot $INIT 3

Yorum Gönder

Emoticon
:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

Author Name

İletişim Formu

Ad

E-posta *

Mesaj *

Blogger tarafından desteklenmektedir.