Browse Source

fake:


			
			
				rocklinux
			
			
		
fake 20 years ago
parent
commit
94b9880c49
9 changed files with 114 additions and 95 deletions
  1. +5
    -0
      target/livecd/build_stage1.sh
  2. +2
    -0
      target/livecd/build_stage2.sh
  3. +2
    -1
      target/livecd/config.in
  4. +64
    -81
      target/livecd/fixedfiles/system
  5. +23
    -11
      target/livecd/linuxrc.c
  6. +0
    -1
      target/livecd/x86/build.sh
  7. +1
    -1
      target/livecd/x86/help0.txt
  8. +15
    -0
      target/livecd/x86/help1.txt
  9. +2
    -0
      target/livecd/x86/isolinux.cfg

+ 5
- 0
target/livecd/build_stage1.sh

@ -11,6 +11,11 @@ for d in etc home bin sbin opt usr tmp var lib ; do
ln -s /mnt/cowfs_ro/$d mnt/cowfs_rw/$d
done
#
if [ -L $disksdir/2nd_stage/lib64 ] ; then
ln -s /mnt/cowfs_rw/lib64 lib64
ln -s /mnt/cowfs_ro/lib64 mnt/cowfs_rw/lib64
fi
#
if [ -x ../../../usr/bin/diet ] ; then
export DIETHOME="../../../usr/dietlibc"
LXRCCC="../../../usr/bin/diet $CC";

+ 2
- 0
target/livecd/build_stage2.sh

@ -24,6 +24,8 @@ rm -rf usr/src
# TODO finish-package!!
echo_status "Running ldconfig to create links ..."
ldconfig -r .
echo_status "Running depmod for target system ..."
depmod -b $PWD -F ../boot/System.map `ls ../boot/vmlinuz_* | sed -e 's,\.\./boot/vmlinuz_,,'`
#
echo_status "replacing some vital files for live useage ..."
cp -f $base/target/$target/fixedfiles/inittab etc/inittab

+ 2
- 1
target/livecd/config.in

@ -68,4 +68,5 @@ pkgenable pseudonative-daemon
pkgenable tcp_wrappers
pkgenable portmap
pkgenable pcmcia-cs
pkgenable rockplug
pkgenable hotplug
pkgenable udev

+ 64
- 81
target/livecd/fixedfiles/system

@ -48,79 +48,68 @@ case "$1" in
title "Creating valid /etc/mtab ..."
grep -v "^rootfs " /proc/mounts > /etc/mtab || error=$?
status
if [ -f /etc/conf/hardware ] ; then
. /etc/conf/hardware
fi
if [ -f /etc/conf/devfs ] ; then
title "Configuring the /dev filesystem ..."
sh /etc/conf/devfs || error=$?
status
fi
title "Running depmod ..."
/sbin/depmod -a -n > /etc/modules.dep || error=$?
status
title "Mounting /sys, /dev/shm and /dev/pts."
mount -n /sys 2> /dev/null
mount -n /dev/shm || error=$?
mount -n /dev/pts 2> /dev/null
if [ -f /etc/conf/hardware ] ; then
. /etc/conf/hardware
fi
status
title "Configuring the /dev filesystem ..."
sh /etc/conf/devfs || error=$?
status
title "Configuring hardware by activating rockplug."
echo "/sbin/rockplug" > /proc/sys/kernel/hotplug
for file in /etc/rockplug/*.init ; do
[ -f $file ] && $file start
done
if [ -d /etc/hotplug ] ; then
title "Configuring hardware by activating hotplug."
[ -f /proc/sys/kernel/hotplug ] && \
echo "/sbin/hotplug" > /proc/sys/kernel/hotplug
for RC in /etc/hotplug/*.rc; do
echo -n "[$( basename ${RC%.rc} )] "
$RC start || error=$?;
done ; echo
mkdir -p /var/lock/subsys
touch /var/lock/subsys/hotplug
status
fi
title "Loading kernel modules and configuring the kernel."
sh /etc/conf/kernel || error=$?
if [ -f /etc/conf/kernel ] ; then
sh /etc/conf/kernel || error=$?
fi
[ -f /etc/conf/clock ] && . /etc/conf/clock
if [ "$clock_tz" = localtime ] ; then
status
[ -f /etc/conf/clock ] && . /etc/conf/clock
if [ "$clock_tz" = localtime ] ; then
status
title "Setting kernel clock to local time."
hwclock --hctosys --localtime || error=$?
fi
if [ "$clock_rtc" ] ; then
status
title "Setting kernel clock to local time."
hwclock --hctosys --localtime || error=$?
fi
status
title "Setting enhanced real time clock precision to $clock_rtc."
if [ -w /proc/sys/dev/rtc/max-user-freq ] ; then
echo $clock_rtc > /proc/sys/dev/rtc/max-user-freq || error=$?
else
echo "No /proc/sys/dev/rtc/max-user-freq found."
if [ "$clock_rtc" ] ; then
if [ -w /proc/sys/dev/rtc/max-user-freq ] ; then
title "Setting enhanced real time clock precision to $clock_rtc."
echo $clock_rtc > /proc/sys/dev/rtc/max-user-freq || error=$?
status
fi
fi
fi
status
title "Setting hostname to $(cat /etc/HOSTNAME)."
hostname "$(cat /etc/HOSTNAME)" || error=$?
status
title "Refresh utmp, delete lock and tmp files and other stuff."
find /var/lock /var/run /tmp -mindepth 1 -print0 2> /dev/null | xargs --null rm -rf
rm -f /etc/nologin /nologin /fastboot ; touch /var/run/utmp
chmod 664 /var/run/utmp ; chown root:tty /var/run/utmp
mkdir /tmp/.ICE-unix
chmod 1777 /tmp/.ICE-unix
status
title "Writing /var/log/boot.msg."
klogd -f /var/log/boot.msg -o ; dmesg -n 3
dmesg > /var/log/boot.msg || error=$?
status
title "Setting keyboard keymappings."
if [ -L /etc/default.keymap ] ; then
mapfile=$(ls -l /etc/default.keymap | sed 's,.* -> ,,')
if [ -e /etc/default.keymap ] ; then
title "Setting keyboard mappings."
mapfile=$( readlink -f /etc/default.keymap )
loadkeys $mapfile || error=$?
elif [ -f /etc/default.keymap ] ; then
loadkeys /etc/default.keymap || error=$?
else
echo "No /etc/default.keymap found."
status
fi
status
title "Setting keyboard repeat rate and delay time."
kbd_rate=30; kbd_delay=250
@ -128,16 +117,12 @@ case "$1" in
/usr/bin/kbdrate -r $kbd_rate -d $kbd_delay < /dev/console || error=$?
status
title "Setting console screen font."
if [ -L /etc/default.vcfont ] ; then
fontfile=$(ls -l /etc/default.vcfont | sed 's,.* -> ,,')
if [ -e /etc/default.vcfont ] ; then
title "Setting console screen font."
fontfile=$( readlink -f /etc/default.vcfont )
setfont $fontfile || error=$?
elif [ -f /etc/default.vcfont ] ; then
setfont /etc/default.vcfont || error=$?
else
echo "No /etc/default.vcfont found."
status
fi
status
title "Setting console terminal type and blank interval."
con_term=linux; con_blank=0
@ -156,15 +141,17 @@ case "$1" in
sysctl -w kernel.overflowgid=$(id -g nobody) > /dev/null || error=$?
status
title "Reading /etc/sysctl.conf file."
sysctl -p || error=$?
status
if [ -e /etc/sysctl.conf ] ; then
title "Reading /etc/sysctl.conf file."
sysctl -p || error=$?
status
fi
title "Initializing kernel random number generator."
if [ -e /var/state/random-seed ] ; then
title "Initializing kernel random number generator."
cat /var/state/random-seed >/dev/urandom || error=$?
status
fi
status
title "Setting mixer devices Master and PCM to 65%."
/usr/bin/amixer sset PCM 20 >/dev/null 2>&1 || error=$?
@ -172,23 +159,17 @@ case "$1" in
/usr/bin/amixer sset Master 20 >/dev/null 2>&1 || error=$?
/usr/bin/amixer sset Master unmute >/dev/null 2>&1 || error=$?
status
;;
stop)
title "Saving /var/log/init.msg and /var/log/boot.msg."
touch /var/log/init.msg /var/log/boot.msg || error=$?
mv /var/log/init.msg /var/log/init.old || error=$?
mv /var/log/boot.msg /var/log/boot.old || error=$?
status
title "Writing a wtmp record."
if [ "$RUNLEVEL" = 0 ] ; then halt -w || error=$?
else reboot -w || error=$? ; fi
status
title "Saving kernel random seed."
dd if=/dev/urandom of=/var/state/random-seed count=1 2> /dev/null
status
title "Unconfiguring hardware by de-activating hotplug."
for RC in /etc/hotplug/*.rc; do
echo -n "[$( basename ${RC%.rc} )] "
$RC stop || error=$?;
done ; echo
rm -f /var/lock/subsys/hotplug
status
title "Sending all processes a SIGTERM (15)."
killall5 -15 || error=$? ; sleep 5
@ -220,6 +201,7 @@ case "$1" in
mount -o remount,sync $dir
mount -o remount,ro $dir
umount -d $dir
bash
done
status
@ -247,8 +229,9 @@ case "$1" in
;;
*)
echo "Usage: $0 { start | stop }"
exit 1 ;;
echo "Usage: $0 { start | stop | restart }"
exit 1
;;
esac

+ 23
- 11
target/livecd/linuxrc.c

@ -56,6 +56,7 @@ char mod_dir[255];
char mod_suffix[3];
int mod_suffix_len=0;
int do_debug=0;
char init2[32] = "/sbin/init";
void debug(int line, const char* format, ...)
{
@ -140,15 +141,15 @@ int loop_mount(const char *device, const char* file)
void doboot()
{
DEBUG("doboot starting...");
if ( access("/sbin/init", R_OK) ) { perror("Can't find /sbin/init"); }
DEBUG("doboot starting - trying to exec %s",init2);
if ( access(init2, R_OK) ) { perror("Can't access 2nd stage init"); }
else {
/* not sure why, but i get 'bad address' if i don't wait a bit here... */
/* i get 'bad address' if i don't wait a bit here... */
sleep(1);
execlp("/sbin/init","init",NULL);
perror("execlp /sbin/init failed");
execlp(init2,init2,NULL);
perror("execlp init2 failed");
}
DEBUG("doboot returning - bad!");
DEBUG("doboot returning - oops!");
}
int trymount (const char* source, const char* target)
@ -442,11 +443,13 @@ int main(int argc, char** argv)
{
int args;
if(getenv("stage2init") != NULL)
snprintf(init2, 31, "%s", getenv("stage2init"));
if (argc > 1) {
do_debug = 1;
DEBUG("got an argument, switching debug mode on!");
for(args=1; args<argc; args++) {
DEBUG("Arg%d:%s",args,argv[args]);
for (args=1; args<argc; args++) {
if (strstr(argv[args],"linuxrc_debug") != NULL)
do_debug = 1;
}
}
@ -459,8 +462,17 @@ int main(int argc, char** argv)
if ( mount("none", "/proc", "proc", 0, NULL) && errno != EBUSY )
perror("Can't mount /proc");
if ( mount("none", "/dev/pts", "devpts", 0, NULL) && errno != EBUSY )
perror("Can't mount /dev/pts (not too fatal)");
if ( mount("none", "/dev/shm", "ramfs", 0, NULL) && errno != EBUSY )
perror("Can't mount /dev/shm (not fatal)");
/* Only print important stuff to console */
klogctl(8, NULL, 3);
if(do_debug == 0)
klogctl(8, NULL, 3);
else
klogctl(8, NULL, 7);
mod_load_info(mod_loader, mod_dir, mod_suffix);
mod_suffix_len = strlen(mod_suffix);

+ 0
- 1
target/livecd/x86/build.sh

@ -16,7 +16,6 @@ cp $base/target/$target/x86/isolinux.cfg isolinux/
cp $base/target/$target/x86/help?.txt isolinux/
#
echo_status "Copy images to isolinux directory."
cp boot/memtest86.bin isolinux/memtest86
cp initrd.gz boot/vmlinuz isolinux/
#
cat > ../isofs_arch.txt <<- EOT

+ 1
- 1
target/livecd/x86/help0.txt

@ -5,7 +5,7 @@
|_| \_\ ___/ \___|_|\_\ |____|_|_| |_|\___/|_/\_|
[============> http://www.rocklinux.org/ <============]
| L I V E CD |
+-------------+
+-------------+ [F1=Overview] [F2=Options]
Actions:
--------

+ 15
- 0
target/livecd/x86/help1.txt

@ -0,0 +1,15 @@
____ ___ ___ _ __ _
| _ \ / _ \ / __| |/ / | | _ _ __ _ _ _ _
| . _/| | | | | | '_/ | | |_| '_ \| | | | \/ |
| |\ \| |_| | |__| . \ | |__| | | | | `_' |> <
|_| \_\ ___/ \___|_|\_\ |____|_|_| |_|\___/|_/\_|
[============> http://www.rocklinux.org/ <============]
| L I V E CD |
+-------------+ [F1=Overview] [F2=Options]
Options:
--------
linuxrc_debug enable debug output from linuxrc and kernel
stage2init=<file> the program to exec after linuxrc finished

+ 2
- 0
target/livecd/x86/isolinux.cfg

@ -4,6 +4,8 @@ TIMEOUT 600
PROMPT 1
DISPLAY help0.txt
F1 help0.txt
F2 help1.txt
LABEL livecd
kernel vmlinuz

Loading…
Cancel
Save