Re: klibc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/9/06, H. Peter Anvin <[email protected]> wrote:
Followup to:  <[email protected]>
By author:    "Joshua Hudson" <[email protected]>
In newsgroup: linux.dev.kernel
>
> Once again. Loopback mount requires a clean unmount of root and
> host filesystem. After remounting root read-only, host is still read-write
> and cannot be remounted read-only.
>
> It is necessary to provide access to the rootfs tree somewhere else
> or use pivot_root, like the initrd solution below:
>
> initrd: /linuxrc
> #!/bin/sh
> mount /dev/hda1 -o rw -t ntfs /host
> mount /host/linux/root.img -o loop,ro -t ext3 /root
> pivot_root /root /root/initrd
> exec /initrd/bin/init
>
> root:/etc/rc.d/rc.halt:
> #!/bin/sh
> pivot_root /initrd /initrd/root
> cd /
> exec /stop $RUNLEVEL
>
> initrd:/stop
> #!/bin/sh
> kill -SIGUSR1 1
> umount /root
> umount /host
> case $1 in
> 0) poweroff -f ;;
> *) reboot -f ;;
> esac
>
> This requires static binaries of init, sh, mount, umount, an extant /etc, and a
> few nodes in /dev.

Another solution is to leave a process with its cwd parked in the
rootfs.  Look at run_linuxrc() in usr/kinit/initrd.c of any klibc tree
to see how this can be used.  (That is there to support old-style
/linuxrc, but should be applicable here, too.)

        -hpa
Should work if the following is true:
  if pwd is /, mount / followed by ls . retunrs the contents of initramfs.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux