lkml.org 
[lkml]   [2006]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: klibc
On 6/9/06, H. Peter Anvin <hpa@zytor.com> wrote:
> Followup to: <bda6d13a0606091528h4e85265du8651818c73827b7d@mail.gmail.com>
> By author: "Joshua Hudson" <joshudson@gmail.com>
> 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-10 01:15    [W:2.870 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site