wok rev 13895

busybox-boot: clean /dev
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jan 18 18:38:13 2013 +0100 (2013-01-18)
parents 7e002bedebe8
children 10008d8037c4
files busybox-boot/receipt
line diff
     1.1 --- a/busybox-boot/receipt	Fri Jan 18 11:15:15 2013 +0100
     1.2 +++ b/busybox-boot/receipt	Fri Jan 18 18:38:13 2013 +0100
     1.3 @@ -14,28 +14,16 @@
     1.4  genpkg_rules()
     1.5  {
     1.6  	jslinux=false
     1.7 -	mkdir -p $fs/bin $fs/sbin $fs/dev/pts $fs/proc $fs/sys $fs/tmp $fs/mnt
     1.8 +	mkdir $fs/bin $fs/sbin $fs/dev $fs/proc
     1.9  	cp -a $src/busybox-static $fs/bin/busybox
    1.10  	mknod -m 660 $fs/dev/console c 5 1
    1.11  	mknod -m 771 $fs/dev/null c 1 3
    1.12  	mknod -m 660 $fs/dev/tty c 5 0
    1.13 -	mknod -m 660 $fs/dev/loop0 b 7 0
    1.14 -	mknod -m 660 $fs/dev/loop1 b 7 1
    1.15 -	while read name major minor ; do
    1.16 -		for i in '' 1 2 3 4 5 6 7 8 9 ; do
    1.17 -			mknod -m 644 $fs/dev/$name$i b $major $(($i + $minor))
    1.18 -		done
    1.19 -	done <<EOT
    1.20 -hda	3	0
    1.21 -hdb	3	64
    1.22 -sda	8	0
    1.23 -sdb	8	16
    1.24 -EOT
    1.25 +	mknod -m 660 $fs/dev/tty1 c 4 1
    1.26  	if $jslinux; then
    1.27  		mknod -m 644 $fs/dev/clipboard c 10 231
    1.28  		mknod -m 660 $fs/dev/ttyS0 c 4 64
    1.29  	fi
    1.30 -	mknod -m 660 $fs/dev/tty1 c 4 1
    1.31  	cat > $fs/init <<EOT
    1.32  #!/bin/busybox sh
    1.33  
    1.34 @@ -46,6 +34,18 @@
    1.35  export TERM=vt100
    1.36  
    1.37  mount -t proc none /proc
    1.38 +mkdir /tmp /mnt
    1.39 +while read name major minor ; do
    1.40 +	for i in '' 1 2 3 4 5 6 7 8 9 ; do
    1.41 +		mknod -m 644 /dev/\$name\$i b \$major \$((\$i + \$minor))
    1.42 +	done
    1.43 +done <<EOM
    1.44 +loop	7	0
    1.45 +hda	3	0
    1.46 +hdb	3	64
    1.47 +sda	8	0
    1.48 +sdb	8	16
    1.49 +EOM
    1.50  
    1.51  arg()
    1.52  {
    1.53 @@ -53,21 +53,24 @@
    1.54  }
    1.55  
    1.56  arg mount && mount \$root /mnt
    1.57 -arg loopfs && losetup /dev/loop0 /mnt/\$root && mount /dev/loop0 /mnt
    1.58 +arg loopfs && losetup /dev/loop /mnt/\$root && mount /dev/loop /mnt
    1.59  arg subroot && cp /bin/busybox /mnt/\$root/dev/shm &&
    1.60  exec switch_root mnt \$root/dev/shm/busybox chroot \$root /sbin/init
    1.61  arg loopfs && exec switch_root mnt /sbin/init
    1.62  
    1.63  [ -d /proc/bus/usb ] && mount -t usbfs usbfs /proc/bus/usb
    1.64 -mount -t sysfs none /sys
    1.65 -mount -t devpts none /dev/pts
    1.66 +while read type dir ; do
    1.67 +	grep -qs \$type /proc/filesystems &&
    1.68 +	mkdir \$dir && mount -t \$type none \$dir
    1.69 +done <<EOM
    1.70 +sysfs	/sys
    1.71 +devpts	/dev/pts
    1.72 +EOM
    1.73  
    1.74  TTY=\$(tty 2>/dev/null)
    1.75  TTY=\${TTY:-/dev/tty1}
    1.76  EOT
    1.77 -	$jslinux && cat >> $fs/init <<EOT
    1.78 -stty -F \$TTY rows 30 2>/dev/null
    1.79 -EOT
    1.80 +	$jslinux && echo 'stty -F $TTY rows 30 2>/dev/null' >> $fs/init
    1.81  	cat >> $fs/init <<EOT
    1.82  
    1.83  busybox | sed '/Current/,\$!d'