Browse Source

Dimitar Zhekov <jimmy@is-vn.bg>:

Looking at lsof(1) output, it seems that unmounting of
/old_root/dev fails because of the kernel daemons keeping
/dev/console open, which doesn't seem very proper to me.
No matter, the right way to move a filesystem IMO is with
mount --move, not by umounting-then-mounting it. The only
drawback is that MS_MOVE has to be #defined [to 8192].

Mounting initrd's /bin as /usr/local/bin was quite dumb
of me I must admit. It's much easier, if needed, to leave
/old_root and put /old_root/bin in $PATH. That's not FHS
compliant, so s/old_root/local/g * if you wish.

2nd_stage_small.tar.gz is created with tar | gzip -9
because it's size is very near the limit (that is, with
mine linked as shared, which currently gives a sig11).
Using .bz2 will be better, if approved by Rene/Clifford.

2nd_stage_small (re)boots/shutdowns with no errors, mount
lists the filesystems mounted properly and /old_root can
be unmounted, so 2nd_stage full should not display errors
as well. Now if there was anybody willing to fix mine...


git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@1599 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc
rocklinux
Dimitar Zhekov 21 years ago
parent
commit
c967eef86b
4 changed files with 20 additions and 17 deletions
  1. +1
    -0
      Documentation/Developers/CHANGELOG-RENE
  2. +2
    -2
      target/bootdisk/build_stage2.sh
  3. +8
    -12
      target/bootdisk/linuxrc.c
  4. +9
    -3
      target/bootdisk/linuxrc2.sh

+ 1
- 0
Documentation/Developers/CHANGELOG-RENE

@ -3,6 +3,7 @@
- Alan Wylie: updated fetchmail
- Mathieu Doidy: updated lftp (2.6.8) and added liferea
- Dimitar Zhekov: bootdisk fixes
*) 2003-10-17 (2.0.0-rc2 - 2.0.0-rc3)

+ 2
- 2
target/bootdisk/build_stage2.sh

@ -95,7 +95,7 @@ tar -czf ../2nd_stage.tar.gz * ; cd ..
echo_header "Creating small 2nd stage filesystem:"
mkdir -p 2nd_stage_small ; cd 2nd_stage_small
mkdir -p dev proc tmp bin lib etc share local/bin
mkdir -p dev proc tmp bin lib etc share
mkdir -p mnt/source mnt/target
ln -s bin sbin ; ln -s . usr
@ -172,4 +172,4 @@ do
done < <( find -type f | xargs md5sum | sort )
#
echo_status "Creating 2nd_stage_small.tar.gz archive."
tar -czf ../2nd_stage_small.tar.gz * ; cd ..
tar -cvf- * | gzip -9 > ../2nd_stage_small.tar.gz ; cd ..

+ 8
- 12
target/bootdisk/linuxrc.c

@ -40,6 +40,10 @@
#include <fcntl.h>
#include <errno.h>
#ifndef MS_MOVE
# define MS_MOVE 8192
#endif
#ifndef STAGE_2_BIG_IMAGE
# define STAGE_2_BIG_IMAGE "2nd_stage.tar.gz"
#endif
@ -64,24 +68,16 @@ void doboot()
if ( access("/mnt_root/linuxrc", R_OK) )
{ printf("Can't find /mnt_root/linuxrc!\n"); exit_linuxrc=0; }
if ( mount("/bin", "/mnt_root/usr/local/bin", NULL, MS_BIND, NULL) ) {
perror("Can't mount /mnt_root/usr/local/bin");
if (access("/mnt_root/bin/gzip", R_OK)) {
perror("Can't find /mnt_root/bin/gzip");
exit_linuxrc=0;
}
}
if ( exit_linuxrc ) {
if ( pivot_root("/mnt_root", "/mnt_root/old_root") )
{ perror("Can't call pivot_root"); exit_linuxrc=0; }
chdir("/");
if ( mount("none", "/dev", "devfs", 0, NULL) )
perror("Can't mount /dev");
if ( mount("/old_root/dev", "/dev", NULL, MS_MOVE, NULL) )
perror("Can't remount /old_root/dev as /dev");
if ( mount("none", "/proc", "proc", 0, NULL) )
perror("Can't mount /proc");
if ( mount("/old_root/proc", "/proc", NULL, MS_MOVE, NULL) )
perror("Can't remount /old_root/proc as /proc");
} else {
if ( rmdir("/mnt_root/old_root") )
perror("Can't remove /mnt_root/old_root");

+ 9
- 3
target/bootdisk/linuxrc2.sh

@ -1,8 +1,14 @@
#!/bin/sh
exec < /dev/console > /dev/console 2> /dev/console ; cd /
export PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin"
umount /old_root/dev /old_root/proc /old_root ; rmdir /old_root
export PATH="/sbin:/bin:/usr/sbin:/usr/bin"
if type -p gzip > /dev/null ; then
umount /old_root ; rmdir /old_root
else
PATH="$PATH:/old_root/bin"
for x in /old_root/* ; do
rmdir $x 2> /dev/null || rm -f $x 2> /dev/null
done
fi
grep -v "^rootfs " /proc/mounts > /etc/mtab
freeramdisk /dev/rd/* 2> /dev/null

Loading…
Cancel
Save