[lfs-dev] [lfs-book] r10440 - in trunk/BOOK: . chapter01 chapter06

Bruce Dubbs bruce.dubbs at gmail.com
Fri Jan 17 08:48:55 PST 2014


xinglp wrote:
> 2014/1/17 Bruce Dubbs <bruce.dubbs at gmail.com>:
>> xinglp wrote:
>>> 2014/1/17 Bruce Dubbs <bruce.dubbs at gmail.com>:
>>>> Armin K. wrote:
>>>>> On 01/17/2014 05:03 AM, Bruce Dubbs wrote:
>>>>>> Moving to -dev.

>>> Or use "mount -o bind /run $LFS/run", which is better?
>>
>> I haven't finished testing yet as I'm also working on a util-linux
>> integration with udev problem, but why would we want to bind mount /run?
>>    The only place /run is used in the book is for the tests in
>> util-linux.  Mounting a tmpfs is fairly painless.  I don't think a bind
>> mount would be appropriate because of the potential of interfering with
>> the host system.
>
> We also bind /dev to $LFS/dev, and mounting {devpts,sysfs.procfs} to
> $LFS/xxx is same as bind.
> Use "mount -o bind xxx" make the the guest similar to host system, but
> as you say, may interfer the host system.
> I was use bind when I build blfs without reboot into it.

I use:

$ cat ~/mount-virt.sh
#!/bin/bash

function mountbind
{
    if ! mountpoint $LFS/$1 >/dev/null; then
      $SUDO mount --bind /$1 $LFS/$1
      echo $LFS/$1 mounted
    else
      echo $LFS/$1 already mounted
    fi
}

function mounttype
{
    if ! mountpoint $LFS/$1 >/dev/null; then
      $SUDO mount -t $2 $3 $4 $5 $LFS/$1
      echo $LFS/$1 mounted
    else
      echo $LFS/$1 already mounted
    fi
}

if [ $EUID -ne 0 ]; then
   SUDO=sudo
else
   SUDO=""
fi

if [ x$LFS == x ]; then
   echo "LFS not set"
   exit 1
fi


mountbind dev
mounttype dev/pts devpts devpts -o gid=5,mode=620
mounttype proc    proc   proc
mounttype sys     sysfs  sysfs
mounttype run     tmpfs  shm
mountbind /usr/src
########

I also have umount-virt.sh.


> Since /run is special than others, it may be changed by guest system
> while building.

Correct.

> We should use tmpfs, but do the same work as bootscript do.
> http://www.linuxfromscratch.org/lfs/view/development/scripts/apds04.html
>
>        mkdir -p /run/var /run/lock /run/shm
>        chmod 1777 /run/shm

In LFS, the only process that uses /run at all is the tests for 
util-linux.  Otherwise it wouldn't be needed to do anything to run, at 
least for LFS.

   -- Bruce




More information about the lfs-dev mailing list