wok diff busybox-boot/receipt @ rev 17049

busyboot-boot: use devtmpfs
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Aug 20 16:27:39 2014 +0200 (2014-08-20)
parents 6bc472de003f
children d303e26dcea3
line diff
     1.1 --- a/busybox-boot/receipt	Tue Aug 19 17:47:01 2014 +0200
     1.2 +++ b/busybox-boot/receipt	Wed Aug 20 16:27:39 2014 +0200
     1.3 @@ -38,7 +38,7 @@
     1.4  		mknod -m 660 $fs/usr/share/boot/dev/ttyS0 c 4 64
     1.5  	fi
     1.6  	cat > $fs/usr/share/boot/init <<EOT
     1.7 -#!/bin/sh
     1.8 +#!/bin/busybox sh
     1.9  
    1.10  export PATH=/bin
    1.11  export HOME=/
    1.12 @@ -58,21 +58,7 @@
    1.13  
    1.14  mkdir /tmp /mnt /proc /etc
    1.15  mount -t proc none /proc
    1.16 -while read name major minor ; do
    1.17 -	for i in '' 1 2 3 4 5 6 7 8 9 ; do
    1.18 -		mknod -m 644 /dev/\$name\$i b \$major \$((\$i + \$minor))
    1.19 -	done
    1.20 -done <<EOM
    1.21 -loop	7	0
    1.22 -hda	3	0
    1.23 -hdb	3	64
    1.24 -hdc	22	0
    1.25 -hdd	22	64
    1.26 -sda	8	0
    1.27 -sdb	8	16
    1.28 -sdc	8	32
    1.29 -sdd	8	48
    1.30 -EOM
    1.31 +mount -t devtmpfs none /dev
    1.32  
    1.33  arg()
    1.34  {
    1.35 @@ -85,22 +71,20 @@
    1.36  [ -n "\$(sed 's/\$/ /;s/^/ /;/ ro /!d' /proc/cmdline)" ] && ro="-o ro"
    1.37  [ -n "\$(sed 's/\$/ /;s/^/ /;/ rw /!d' /proc/cmdline)" ] && ro="-o rw"
    1.38  arg root && root="\$(echo \$root | sed 's|/|\\\\/|g')" &&
    1.39 -	mount \$ro \$(busybox blkid | sed "s/\"//g;/\$root/!d;s/:.*//;q") /mnt
    1.40 -arg loopfs && busybox losetup /dev/loop /mnt/\$root && mount /dev/loop /mnt
    1.41 +	root="\$(busybox blkid | sed "s/\"//g;/\$root/!d;s/:.*//;q")" &&
    1.42 +	[ -n "\$root" ] && mount \$ro \$root /mnt
    1.43 +arg loopfs && busybox losetup /dev/loop0 /mnt/\$root && mount /dev/loop0 /mnt
    1.44  arg subroot && cp /bin/busybox /mnt/\$root/dev/shm &&
    1.45  	chroot="\$root/dev/shm/busybox chroot \$root"
    1.46 -busybox [ -x /mnt/\$root/\$init ] && exec busybox switch_root mnt \$chroot \$init
    1.47 -
    1.48 -for i in \$(busybox --list) ; do ln /bin/busybox /bin/\$i 2> /dev/null ; done
    1.49 +busybox [ -x /mnt/\$root/\$init ] && umount /dev && umount /proc && exec busybox switch_root mnt \$chroot \$init
    1.50  
    1.51  [ -d /proc/bus/usb ] && mount -t usbfs usbfs /proc/bus/usb
    1.52  while read type dir ; do
    1.53  	grep -qs \$type /proc/filesystems || continue
    1.54 -	mkdir \$dir
    1.55 +	[ -d "\$dir" ] || mkdir \$dir
    1.56  	mount -t \$type none \$dir
    1.57  done <<EOM
    1.58  sysfs		/sys
    1.59 -devtmpfs	/dev
    1.60  devpts		/dev/pts
    1.61  EOM
    1.62  
    1.63 @@ -110,14 +94,10 @@
    1.64  	$jslinux && echo 'stty -F $TTY rows 30 2>/dev/null' >> $fs/usr/share/boot/init
    1.65  	cat >> $fs/usr/share/boot/init <<EOT
    1.66  
    1.67 -[ -x /bin/udhcpc ] && udhcpc -b -s /init
    1.68 +udhcpc -b -s /init
    1.69  while true; do
    1.70  	busybox | sed '/Current/,\$!d'
    1.71 -	if [ -x /bin/setsid ]; then
    1.72 -		setsid sh -c "exec sh <\$TTY >\$TTY 2>&1"
    1.73 -	else
    1.74 -		sh <\$TTY >\$TTY 2>&1
    1.75 -	fi
    1.76 +	setsid sh -c "exec sh <\$TTY >\$TTY 2>&1"
    1.77  done
    1.78  EOT
    1.79  	chmod +x $fs/usr/share/boot/init