mirror of https://github.com/fspc/gbootroot.git
freesource
23 years ago
3 changed files with 1078 additions and 0 deletions
@ -0,0 +1,546 @@ |
|||
#!/usr/bin/perl -w |
|||
|
|||
# BootRoot 0.4 by freesource 4.14.2000 Copyright (C) 2000 |
|||
# Jonathan Rosenbaum - mttrader@access.mountain.net |
|||
# http://the.netpedia.net/bootroot.html |
|||
|
|||
# This program is free software; you can redistribute it and/or modify |
|||
# it under the terms of the GNU General Public License as published by |
|||
# the Free Software Foundation; either version 2 of the License, or |
|||
# (at your option) any later version. |
|||
|
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU General Public License for more details. |
|||
|
|||
# You should have received a copy of the GNU General Public License |
|||
# along with this program; if not, write to the Free Software |
|||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|||
|
|||
|
|||
# CHANGES |
|||
# |
|||
# 0.4 - 4.14.2000 |
|||
# * copy over bzip2 only if specified in configuration |
|||
# * check and adjust the size of the initrd image, thanks |
|||
# to Magnus Holmberg for reporting the bug when stuff |
|||
# didn't fit the old default size for his setup, also |
|||
# will make a leaner boot if the reverse is true. |
|||
# * add a new question by Magnus to the FAQ |
|||
# |
|||
# 0.3 - 3.17.2000 |
|||
# * added more error checking |
|||
# |
|||
# 0.2 - 3.16.2000 |
|||
# * beta .. works nicely |
|||
# * automatic y when mke2fs on loop device |
|||
# * extra cleanup for aborted attempt |
|||
# * removed init from boot |
|||
# * size check - will abort if cp or mkdir fail and |
|||
# output to find out how much space is left. |
|||
# * added normalboot to lilo for booting from normal disk - |
|||
# requires root=device otherwise will default to /dev/hda1 |
|||
# * added a message with lilo |
|||
|
|||
# 0.1 - 3.12.2000 |
|||
# * initial alpha release, will implement size test |
|||
# in next version. |
|||
# |
|||
|
|||
# What are the REQUIREMENTS? |
|||
# |
|||
# Check to make sure you have thes things, in these directories or the |
|||
# program won't work correctly: |
|||
# /bin/{ash,gzip,mount,umount} |
|||
# /sbin/init (you better have this! .. only used for a test.) |
|||
# /usr/bin/bzip2 (optional) |
|||
|
|||
# What does this program do? |
|||
# |
|||
# BootRoot creates a boot disk with lilo, a kernel and an initrd image. |
|||
# The initrd script mounts another root disk with a compressed (gzip or |
|||
# bzip2) filesystem. |
|||
# |
|||
# The root filesystem isn't made by this program. This program is |
|||
# patterned after mkrboot, but unlike mkrboot it creates an unique bootdisk |
|||
# and a separate root disk. |
|||
|
|||
# What's the advantage of using this program? |
|||
# |
|||
# You can use a bzip2 compressed filesystem, this program is |
|||
# easy to use, and it provides a framework showing a simple initrd method |
|||
# which you can freely modify. Run a search for HEREDOC. I wrote this |
|||
# program as a solution to help oster at EE (www.experts-exchange.com) |
|||
# create separate boot and root floppies for an emergency system for his |
|||
# customers. |
|||
# |
|||
# If you make a cool change to this program, or if this program helps you |
|||
# I'd love to know, that's better than receiving pizza :) |
|||
|
|||
# How can I test BootRoot? |
|||
# |
|||
# Get SETUP.GZ as the filesystem from looplinux at |
|||
# http://www.tux.org/pub/people/kent-robotti/index.htm. |
|||
# This filesystem works with 2.2 kernels. |
|||
# |
|||
# [Ctrl] ([Tab] to see available images) |
|||
# boot: bootdisk single [Enter] |
|||
# ( now filesystem is single user mode) |
|||
# exit [Enter] |
|||
# (now you are in multi user mode) |
|||
# |
|||
# Better yet, do [Ctrl] |
|||
# boot: bootdisk 2 [Enter] |
|||
# |
|||
# This works nicely with a compressed root filesystems made with yard |
|||
# without "single" .. but looplinux comes with mc (mcedit) |
|||
|
|||
# Why doesn't looplinux work as "bootdisk 1?" |
|||
# |
|||
# There is a difference between "1" and "single." Looplinux was written |
|||
# in a way that runlevel 1 doesn't work properly in relation to BootRoot |
|||
# unless single is used. And you thought they were the same thing. |
|||
# BootRoot proves otherwise. |
|||
|
|||
# What sort of configuration can I do? |
|||
# |
|||
# Edit the variable $compress to either gzip (default) or bzip2. |
|||
|
|||
# How do I use the program? |
|||
# |
|||
# program_name lilo linux-kernel compressed-filesystem |
|||
# |
|||
# "lilo" is the only method supported at the present. |
|||
# |
|||
# For instance .. "linux-kernel" could be: /boot/vmlinuz-2.2.14 |
|||
# "compressed-filesystem": /home/createit/my_creation.gz |
|||
# (if found in same directory when running the program) |
|||
# "linux-kernel could be": vmlinuz-2.2.14 |
|||
# "compressed-filesystem": my_creation.gz |
|||
# |
|||
# "device" could be /dev/fd0 (default) or /dev/fd1 .. etc. |
|||
# "size" is usually 1440 (default) |
|||
|
|||
# Edit to "gzip" or "bzip2" |
|||
$compress = "gzip"; |
|||
|
|||
####################################################################### |
|||
# Don't edit from here, but you can if you want to change the here docs |
|||
# and/or the contents of initrd (in which case you need to make sure the |
|||
# right libraries are copied over to initrd). |
|||
|
|||
# I need to remember to edit this |
|||
$version = "v0.4"; |
|||
$date = "4.14.2000"; |
|||
|
|||
$device = "/dev/fd0"; |
|||
$size = 1440; |
|||
$initrd = "initrd_image"; |
|||
$pwd = `pwd`; chomp $pwd; |
|||
use File::Basename; |
|||
$compress eq "gzip" ? ($compress = "gzip") : ($compress = "bzip2"); |
|||
|
|||
if ($#ARGV == -1) { |
|||
print "boot_root - Make a separate boot and root disk\n"; |
|||
print "-----------------------------------------------\n"; |
|||
print "boot_root <method> [ <linux-kernel > [ <root-image> [ <device> [ <size> ]]]]\n"; |
|||
print "\nMethods available:\n\nlilo -> Generates a separate boot and root disk for lilo\n\n"; |
|||
exit; |
|||
} |
|||
if ($ARGV[0] ne "lilo") { |
|||
die "Please supply a method\n"; |
|||
} |
|||
$method = $ARGV[0]; |
|||
if (defined $ARGV[1] && -e $ARGV[1] && !-d $ARGV[1]) { |
|||
$kernel = $ARGV[1]; |
|||
} |
|||
else { |
|||
die "boot_root: ERROR: Kernel not found\n"; |
|||
} |
|||
if (defined $ARGV[2] && -e $ARGV[1] && !-d $ARGV[1] ) { |
|||
$root_image = $ARGV[2]; |
|||
} |
|||
else { |
|||
die "boot_root: ERROR: Rootimage not found\n"; |
|||
} |
|||
$device = $ARGV[3] if defined $ARGV[3]; |
|||
$size = $ARGV[4] if defined $ARGV[4]; |
|||
|
|||
# lilo method |
|||
if ($method eq "lilo") { |
|||
|
|||
|
|||
# Do a little cleanup just in case |
|||
system "rm /tmp/initrd_image.gz 2> /dev/null; rmdir /tmp/initrd_mnt 2> /dev/null"; |
|||
|
|||
initrd(); |
|||
mtab(); |
|||
|
|||
|
|||
print "Making ext2 filesystem\n"; |
|||
system "mke2fs -m0 -i8192 $device $size"; |
|||
die "boot_root: ERROR: You need to insert a disk\n" if $? != 0; |
|||
print "Mounting the device\n"; |
|||
errm(system "mount -t ext2 $device /mnt"); |
|||
|
|||
# Time to do a little calculations |
|||
$device_size = (split(/\s+/,`df /mnt`))[8]; |
|||
$boot_size = (stat($kernel))[12]/2 + (stat("/tmp/$initrd"))[12]/2; |
|||
$root_image_size = (stat($root_image))[12]/2; |
|||
$enough_boot = $device_size - $boot_size; |
|||
$enough_root = $device_size - $root_image_size; |
|||
$remain_boot = $device_size - $boot_size; |
|||
$remain_root = $device_size - $root_image_size; |
|||
|
|||
# A little output |
|||
$enough_boot =~ /^-+\d+$/ ? |
|||
die "boot_root: ERROR: Not enough room: boot stuff = $boot_size k, device = $device_size\n" : |
|||
print "boot_root: Looks good so far: boot stuff = $boot_size k, device = $device_size k, remaining = $remain_boot k\n"; |
|||
|
|||
# Better do this first |
|||
print "Copy over initrd ramdisk\n"; |
|||
system "cp /tmp/$initrd /mnt/$initrd"; |
|||
die "boot_root: ERROR: Could not copy over initrd\n" if $? != 0; |
|||
|
|||
print "Copying over kernel\n"; |
|||
system "rm -rf /mnt/lost+found; cp $kernel /mnt/kernel"; |
|||
die "boot_root: ERROR: Could not copy over the kernel\n" if $? != 0; |
|||
print "Making stuff for lilo\n"; |
|||
err(system "mkdir /mnt/{boot,dev}; cp -a /dev/{null,fd?,hda1} /mnt/dev"); |
|||
print "Copy over important lilo stuff\n"; |
|||
err(system "cp /boot/boot.b /mnt/boot"); |
|||
|
|||
# HEREDOC |
|||
$brlilo = << "LILOCONF"; |
|||
boot = $device |
|||
message = message |
|||
delay = 50 |
|||
vga = normal |
|||
install = /boot/boot.b |
|||
map = /boot/map |
|||
backup = /dev/null |
|||
compact |
|||
|
|||
# bootdisk |
|||
image = kernel |
|||
append = "load_ramdisk = 1 debug" |
|||
initrd = $initrd |
|||
root = $device |
|||
label = bootdisk |
|||
read-write |
|||
|
|||
# normalboot |
|||
image = kernel |
|||
root = /dev/hda1 |
|||
label = normalboot |
|||
read-only |
|||
LILOCONF |
|||
open(LC, ">/mnt/brlilo.conf") or die "Couldn't write /mnt/brlilo.conf\n"; |
|||
print LC $brlilo; close(LC); |
|||
|
|||
|
|||
# HEREDOC |
|||
$message = << "MESSAGE"; |
|||
|
|||
BootRoot $version written by Jonathan Rosenbaum $date GPL |
|||
mailto:mttrader\@access.mountain.net |
|||
|
|||
Press [Ctrl] to see the lilo prompt. |
|||
|
|||
Press [Tab] to see a list of boot options. |
|||
|
|||
bootdisk = This will boot a compressed root filesystem |
|||
on another floppy. |
|||
normalboot = This will boot up a specified filesystem. |
|||
default: /dev/hda1 a = 1st drive |
|||
1 = 1st partition |
|||
Use root=/dev/(h or s)dXX |
|||
h = IDE Drive |
|||
s = SCSI Drive |
|||
|
|||
Trouble: Do not forget boot: option single |
|||
Fix a filesystem: e2fsck /dev/(h or s)dXX |
|||
Bad superblock: e2fsck -b 8192 /dev/(h or s)dXX |
|||
|
|||
MESSAGE |
|||
open(M, ">/mnt/message") or die "Couldn't write /mnt/message\n"; |
|||
print M $message; close(M); |
|||
|
|||
# Got to umount,mount, and umount again to make sure everything is |
|||
# copied over before doing lilo |
|||
errum(system "umount /mnt"); |
|||
print "Umount device\n"; |
|||
print "Remount device\n"; |
|||
errm(system "mount -t ext2 $device /mnt"); |
|||
print "Configuring lilo\n"; |
|||
chdir("/mnt") or die "boot_root: ERROR: Could not change directories\n"; |
|||
system "lilo -v -C brlilo.conf -r /mnt"; |
|||
die "boot_root: ERROR: lilo failed\n" if $? != 0; # code 0 regardless |
|||
chdir($pwd) or die "boot_root: ERROR: Could not change directories\n"; |
|||
print "Umounting /mnt\n"; |
|||
# y I know |
|||
$um = system "umount /mnt"; |
|||
|
|||
print "Doing a little cleanup\n"; |
|||
system "rm /tmp/$initrd; rmdir /tmp/initrd_mnt"; |
|||
|
|||
# This could be put on the top, but all that needs to be done now is |
|||
# to mke2fs & cp over /compressed_filesystem |
|||
$enough_root =~ /^-+\d+$/ ? |
|||
die "boot_root: ERROR: Not enough room: root stuff = $root_image_size k, device = $device_size\n" : |
|||
print "boot_root: Looks good: boot stuff = $boot_size k, device = $device_size k, remaining = $remain_root k\n"; |
|||
|
|||
|
|||
# Here's where we copy over that compressed filesystem |
|||
# We could separate $device = boot,root allowing two |
|||
# different devices to be used. |
|||
if ($um == 0) { |
|||
mtab(); |
|||
print "Making ext2 filesystem\n"; |
|||
system "mke2fs -m0 -i8192 $device $size"; |
|||
die "boot_root: ERROR: You need to insert a disk\n" if $? != 0; |
|||
errm(system "mount -t ext2 /dev/fd0 /mnt"); |
|||
print "Copy over the compressed filesystem\n"; |
|||
system "rmdir /mnt/lost+found"; |
|||
$broot_image = basename($root_image); |
|||
system "cp $root_image /mnt/$broot_image"; |
|||
die "boot_root: ERROR: Could not copy over the root filesystem\n" if $? != 0; |
|||
errum(system "umount /mnt"); |
|||
print "Root disk did not properly umount\n" if $? != 0; |
|||
print "Finished!\n"; |
|||
} |
|||
else { |
|||
die "boot_root: ERROR: Boot disk was never umounted\n"; |
|||
} # copy over the compressed |
|||
|
|||
|
|||
} # lilo method |
|||
|
|||
|
|||
# Some functions |
|||
|
|||
sub errmk { |
|||
die "boot_root: ERROR: Could not make important directories\n" if $? != 0; |
|||
} |
|||
|
|||
sub errcp { |
|||
die "boot_root: ERROR: Could not copy over important stuff\n" if $? != 0; |
|||
} |
|||
|
|||
sub errum { |
|||
die "boot_root: ERROR: Could not umount the device\n" if $? != 0; |
|||
} |
|||
|
|||
sub errm { |
|||
die "boot_root: ERROR: Could not mount device\n" if $? != 0; |
|||
} |
|||
|
|||
sub err { |
|||
die "boot_root: ERROR: Not enough space after all\n" if ($? > 0); |
|||
} |
|||
|
|||
sub mtab { |
|||
|
|||
# /proc/mount could be used, but maybe there is no /proc |
|||
|
|||
# \n from initrd() |
|||
print "\nPlease insert a floppy and then press [Enter]: "; |
|||
<STDIN>; |
|||
# Check to see if $device is mounted |
|||
open (MTAB, "/etc/mtab") or die "no mtab!\n"; |
|||
while (<MTAB>) { |
|||
if (m,$device,) { |
|||
print "DANGER!\n"; |
|||
print "This next step will create a new filesystem on the floppy removing all data\n"; |
|||
print "Please umount the device first, and put in a new floppy.\n"; |
|||
exit; |
|||
} |
|||
} |
|||
close(MTAB); |
|||
} # end sub mtab |
|||
|
|||
|
|||
sub initrd_size { |
|||
|
|||
($linuxrc_size) = @_; |
|||
print "Checking size needed for initrd\n"; |
|||
|
|||
# the size of the loop device should be at least 1.63% larger than what |
|||
# it will contain (i.e. 8192 inode), but to keep on the safe size it will |
|||
# be 2.00% larger. |
|||
# 9 dirs = 1024 each (increase if modified) |
|||
# {ash,gzip,mount,umount} (required executables) |
|||
# bzip2 if $compress eq bzip2 (optional) |
|||
# 1 for ld.so.cache |
|||
|
|||
# change dir size if needed |
|||
$dir_size = 9 + 1; |
|||
$initrd_size = $dir_size + $linuxrc_size; |
|||
|
|||
# add other executables here |
|||
@initrd_stuff = qw(ash gzip mount umount); |
|||
foreach (@initrd_stuff) { |
|||
$initrd_size = $initrd_size + ((stat("/bin/$_"))[12]/2); |
|||
} |
|||
|
|||
if ($compress eq "bzip2" && -e "/usr/bin/$compress") { |
|||
print "hi\n"; |
|||
$initrd_size = $initrd_size + ((stat("/usr/bin/$compress"))[12]/2); |
|||
} |
|||
|
|||
# lib sizes |
|||
open(L,"ldd /sbin/init|") or die "Oops, no init could be found :)\n"; # safe to use ldd |
|||
while (<L>) { |
|||
$lib = (split(/=>/,$_))[0]; |
|||
$lib =~ s/\s+//; |
|||
$lib = basename($lib); |
|||
$lib =~ s/\s+$//; |
|||
open (SL,"ls -l /lib/$lib|") or die "humm: $!\n"; |
|||
while (<SL>) { |
|||
# symbolic link |
|||
if (-l "/lib/$lib") { |
|||
$what = (split(/\s+/,$_))[10]; |
|||
$initrd_size = $initrd_size + 1; |
|||
$initrd_size = $initrd_size + ((stat("/lib/$what"))[12]/2); |
|||
} |
|||
# no symbolic link |
|||
else { |
|||
$initrd_size = $initrd_size + ((stat("/lib/$lib"))[12]/2); |
|||
} |
|||
} |
|||
} |
|||
|
|||
$initrd_size = $initrd_size + ($initrd_size * 0.02); |
|||
# For perfection 1 (rounded up) is o.k., but for safety 10 would be |
|||
# better |
|||
$initrd_size = sprintf("%.f",$initrd_size) + 10; |
|||
return $initrd_size; |
|||
|
|||
} # end sub initrd_size |
|||
|
|||
|
|||
sub initrd { |
|||
|
|||
$broot_image = basename($root_image); |
|||
|
|||
# Here's where the initrd is put together using a loop device |
|||
# HEREDOC |
|||
$initrd_exec = << "INITRD"; |
|||
#!/bin/ash |
|||
|
|||
export PATH=/bin:/sbin:/usr/bin: |
|||
|
|||
echo Preparing to setup ramdisk. |
|||
|
|||
mount -o remount,rw / 2>/dev/null |
|||
|
|||
echo Mounting proc... |
|||
mount -t proc none /proc |
|||
|
|||
echo -n 'Please insert the root floppy, and press [Enter]: ' |
|||
read ENTER |
|||
|
|||
echo Mounting floppy drive readonly ... |
|||
mount -o ro -t ext2 /dev/fd0 /mnt |
|||
|
|||
echo -n Copying new root to ramdisk .. please wait ... |
|||
$compress -cd /mnt/$broot_image > /dev/ram1 |
|||
echo done. |
|||
|
|||
echo -n Unmounting floppy ... |
|||
umount /mnt |
|||
echo done. |
|||
|
|||
echo Changing to the new root. |
|||
echo 257 >/proc/sys/kernel/real-root-dev |
|||
|
|||
echo -n Unmounting proc ... |
|||
umount /proc |
|||
echo done. |
|||
|
|||
echo Continuing normal boot procedure from ramdisk. |
|||
INITRD |
|||
|
|||
open(LC, ">/tmp/linuxrc") or die "Couldn't write linuxrc to loop device\n"; |
|||
print LC $initrd_exec; close(LC); |
|||
$size_needed = initrd_size((stat("/tmp/linuxrc"))[12]/2); |
|||
unlink("/tmp/linuxrc"); |
|||
|
|||
print "Using loop device to make initrd\n"; |
|||
print "Make sure you have loop device capability in your running kernel\n"; |
|||
system "dd if=/dev/zero of=/tmp/$initrd bs=1024 count=$size_needed"; |
|||
# no need to enter y every time |
|||
open(T,"|mke2fs -m0 -i8192 /tmp/$initrd") or die "Problem here: $!\n"; print T "y\n"; close(T); |
|||
print "Mounting initrd in tmp\n"; |
|||
errmk(system "mkdir /tmp/initrd_mnt; mount -o loop -t ext2 /tmp/$initrd /tmp/initrd_mnt"); |
|||
print "Putting everything together\n"; |
|||
open(LC, ">/tmp/initrd_mnt/linuxrc") or die "Couldn't write linuxrc to loop device\n"; |
|||
print LC $initrd_exec; close(LC); |
|||
# I could test this but somebody's system may do permissions differently |
|||
system "chmod 755 /tmp/initrd_mnt/linuxrc"; |
|||
system "rmdir /tmp/initrd_mnt/lost+found"; |
|||
|
|||
print "... the dirs\n"; |
|||
errmk(system "mkdir /tmp/initrd_mnt/{bin,dev,etc,lib,mnt,proc,sbin,usr}; mkdir /tmp/initrd_mnt/usr/lib"); |
|||
errcp(system "cp -a /dev/{console,fd0,null,ram0,ram1,tty0} /tmp/initrd_mnt/dev"); |
|||
# future implementation |
|||
#errcp(system "cp -a $device /tmp/initrd_mnt/dev"); |
|||
|
|||
print ".. the bins\n"; |
|||
errcp(system "cp -a /bin/{ash,gzip,mount,umount} /tmp/initrd_mnt/bin"); |
|||
if ($compress eq "bzip2") { |
|||
errcp(system "cp -a /usr/bin/$compress /tmp/initrd_mnt/bin") if -e "/usr/bin/$compress"; |
|||
} |
|||
|
|||
# Testing init is sufficient for grabbing the correct libraries for the |
|||
# executables immediately above. This could be modified to test a |
|||
# list of executables. |
|||
print ".. the libs\n"; |
|||
open(L,"ldd /sbin/init|") or die "Oops, no init could be found :)\n"; # safe to use ldd |
|||
while (<L>) { |
|||
$lib = (split(/=>/,$_))[0]; |
|||
$lib =~ s/\s+//; |
|||
$lib = basename($lib); |
|||
$lib =~ s/\s+$//; |
|||
open (SL,"ls -l /lib/$lib|") or die "humm: $!\n"; |
|||
while (<SL>) { |
|||
# symbolic link |
|||
if (-l "/lib/$lib") { |
|||
$what = (split(/\s+/,$_))[10]; |
|||
errcp(system "cp -a /lib/$lib /tmp/initrd_mnt/lib"); |
|||
errcp(system "cp -a /lib/$what /tmp/initrd_mnt/lib"); |
|||
} |
|||
# no symbolic link |
|||
else { |
|||
errcp(system "cp -a /lib/$lib /tmp/initrd_mnt/lib"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
print "Determine run-time link bindings\n"; |
|||
# Has a return code of 0 regardless |
|||
system "ldconfig -r /tmp/initrd_mnt"; |
|||
print "Umounting loop device, and compressing initrd"; |
|||
errum(system "umount /tmp/initrd_mnt; gzip -9 /tmp/$initrd"); |
|||
$initrd = $initrd . ".gz"; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,115 @@ |
|||
<html> |
|||
<head><title>BootRoot</title></head> |
|||
<body text="#000000" bgcolor="#FFFFFF" link="#0000EF" vlink="#51188E" |
|||
alink="#FF0000"> |
|||
|
|||
<p> |
|||
You found it .. the BootRoot page. Check out the <a href="/">gBootRoot</a> page, I no longer actively maintain BootRoot because the graphical version is much more powerful! |
|||
<p> |
|||
<p> |
|||
<h3>The four steps to making a Boot Root set.</h3> |
|||
1). Grab the Perl Script right here .. <a href="http://gbootroot.sourceforge.net/boot_root.4">boot_root</a> |
|||
give it a name .. umm .. boot_root. |
|||
<br><br> |
|||
2). Make sure the bang line points to the right place. |
|||
<pre> |
|||
$ which perl |
|||
/usr/bin/perl |
|||
$ grep "perl -w" boot_root |
|||
#!/usr/bin/perl -w |
|||
</pre> |
|||
<br> |
|||
3). Make it executable. |
|||
<pre> |
|||
$ chmod 755 boot_root |
|||
</pre> |
|||
<br> |
|||
4). Put it in one of your LIB PATHS. |
|||
<pre> |
|||
$ echo $PATH |
|||
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:.: |
|||
$ mv boot_root /usr/bin |
|||
</pre> |
|||
<br> |
|||
5). Run it, and have lots of fun! More directions can be found at the beginning of the script. |
|||
<br><p> |
|||
<h3>BootRoot FAQ </h3> |
|||
<p> <b> What does this program do?</b> |
|||
<p> |
|||
BootRoot creates a boot disk with lilo, a kernel and an initrd image. |
|||
The initrd script mounts another root disk with a compressed (gzip or |
|||
bzip2) filesystem. |
|||
<p> |
|||
The root filesystem isn't made by this program, but there lots of compressed filesytems out there to use (see rest of FAQ). This program is |
|||
patterned after mkrboot, but unlike <a href="http://www.debian.org/Packages/unstable/admin/mkrboot">mkrboot</a> it creates an unique bootdisk |
|||
and a separate root disk. |
|||
<p> |
|||
<b>What's the advantage of using this program?</b> |
|||
<p> |
|||
You can use a bzip2 compressed filesystem, this program is |
|||
easy to use, and it provides a framework showing a simple initrd method |
|||
which you can freely modify. I wrote this |
|||
program as a solution to help oster at EE (www.experts-exchange.com) |
|||
create separate boot and root floppies for an emergency system for his |
|||
customers. |
|||
<p> |
|||
If you make a cool change to this program, or if this program helps you |
|||
I'd love to know, that's better than receiving pizza :) |
|||
<p> |
|||
<b>How can I test BootRoot?</b> |
|||
<p> |
|||
Get SETUP.GZ as the filesystem from looplinux at |
|||
<a href="http://www.tux.org/pub/people/kent-robotti/index.html">looplinux</a> or get it <a href="/bootroot/setup.gz">here</a>. |
|||
This filesystem works with 2.2 kernels. |
|||
<p> |
|||
[Ctrl] ([Tab] to see available images) |
|||
<br> boot: bootdisk single [Enter] |
|||
<br> ( now filesystem is single user mode) |
|||
<br> exit [Enter] |
|||
<br> (now you are in multi user mode) |
|||
<p> |
|||
Better yet, do [Ctrl] |
|||
<br> boot: bootdisk 2 [Enter] |
|||
<p> |
|||
This works nicely with a compressed root filesystems made with <a href="http://www.croftj.net/~fawcett/yard/">yard</a> without "single" .. but looplinux |
|||
comes with <a href="http://www.tw.gnome.org/mc/announce.html">mc (mcedit)</a>. |
|||
|
|||
<p> |
|||
<b>Why doesn't looplinux work as "bootdisk 1?"</b> |
|||
<p> |
|||
There is a difference between "1" and "single." Looplinux was written |
|||
in a way that runlevel 1 doesn't work properly in relation to BootRoot |
|||
unless single is used. And you thought they were the same thing. |
|||
BootRoot proves otherwise. |
|||
|
|||
<p> |
|||
<b>What sort of configuration can I do?</b> |
|||
<p> |
|||
Edit the variable $compress to either gzip (default) or bzip2. |
|||
<p> |
|||
<b>How do I use the program?</b> |
|||
<p> |
|||
|
|||
|
|||
program_name lilo linux-kernel compressed-filesystem |
|||
<p> |
|||
"lilo" is the only method supported at the present. |
|||
<p> |
|||
Example: |
|||
<br> |
|||
"linux-kernel" could be: /boot/vmlinuz-2.2.14 |
|||
<br> "compressed-filesystem" could be: /home/createit/my_creation.gz |
|||
<br> (if found in same directory when running the program) |
|||
<br> "linux-kernel could be": vmlinuz-2.2.14 |
|||
<br> "compressed-filesystem" could be: my_creation.gz |
|||
<h3>Old versions of BootRoot.</h3> |
|||
None available. |
|||
<br><br><br> |
|||
Contact me: <a href="mailto:freesource@users.sourceforge.net">freesource@users.sourceforge.net</a> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
|
@ -0,0 +1,417 @@ |
|||
<html> |
|||
<head><title>gBootRoot</title></head> |
|||
<body text="#000000" bgcolor="#FFFFFF" link="#0000EF" vlink="#51188E" |
|||
alink="#FF0000"> |
|||
|
|||
|
|||
<H1 align="center">gBootRoot</h1> |
|||
<H3 align="center">at</h3> |
|||
|
|||
<p align="center"><A href="http://sourceforge.net/projects/gbootroot"> |
|||
<IMG src="http://sourceforge.net/sflogo.php?group_id=9513&type=1" |
|||
width="88" height="31" border="0" |
|||
alt="SourceForge Logo"> </A></p> |
|||
<p></p> |
|||
<P align="center"> |
|||
<b>bOOTrOOT</b> makes the development, construction, and |
|||
testing of distributions fun and simple.</P> |
|||
|
|||
<br> |
|||
|
|||
<P align="center"> |
|||
<b>Download gBootRoot<b></P> |
|||
<P align="center">Stable version</P> |
|||
<p align="center"><A href="http://prdownloads.sourceforge.net/gbootroot/"> |
|||
Old versions</A></P> |
|||
|
|||
|
|||
<P align="center"> |
|||
<IMG ALT="" SRC="images/gbootroot.xpm"> |
|||
</P> |
|||
|
|||
<P align="center"> |
|||
<b>How to Use gBootRoot</b></P> |
|||
<P><IMG ALT="" SRC="images/gBS.jpg" align="right">The most important button to |
|||
familiarize yourself with is the Submit button which starts the whole process; |
|||
dialogs are presented as the process continues asking you if you want to |
|||
continue "OK" or stop "Cancel".</P> |
|||
|
|||
<p> |
|||
The <u>first row</u> presently has only one Boot Method choice: |
|||
"2 disk compression."   |
|||
Clicking on the menu on the right selects the Boot Method.</p> |
|||
|
|||
|
|||
<P>The <u>second row</u> allows you to select the kernel for the Boot/Root set. You |
|||
may either use the file selector button on the right hand side, or you may |
|||
type in the location on the left hand side.</P> |
|||
|
|||
<P> |
|||
The <u>third row</u> allows you to select the compressed filesystem you are |
|||
providing, using either of the two ways mentioned before. You may use a |
|||
pre-made root filesystem or you may create one using one of the Methods |
|||
provided in the Advanced Root Section. |
|||
</P> |
|||
|
|||
|
|||
<P>The <u>fourth row</u> allows you to select the device you want to use. The default |
|||
device is the first floppy disk - /dev/fd0.</P> |
|||
|
|||
<p> |
|||
The <u>fifth row</u> allows you to choose the size of the device being used. |
|||
The default size of 1440 assumes you are using a floppy drive (Note: You may |
|||
want to experiment with 1722 which works fine with many floppy drives.), but |
|||
can be used with other sized devices like tape drives. Click on the |
|||
appropriate radio button to choose either gzip or bzip2 compression if the |
|||
program doesn't automatically detect it.</p> |
|||
|
|||
<P align="center"><b>Verbosity Box</b></p> |
|||
<IMG ALT="" SRC="images/verbosity_box.jpg" align="right"> |
|||
|
|||
The <u>slider bar</u> on the right allows the output of the verbosity box |
|||
to be |
|||
changed from the highest (2) to the lowest setting (1) or to be turned off (0) |
|||
or on again. |
|||
At times it may be advantageous to turn off the verbosity box |
|||
since large quantities of output to this box may cause gbootroot to use too |
|||
much cpu power; however, output may still be found in the text file "verbose" |
|||
in /tmp/gbootroot_tmp'time-date'.</p> |
|||
|
|||
|
|||
<p><P align="center"><b> |
|||
Using the Advanced Boot Section</b></p> |
|||
|
|||
<p><IMG ALT="" SRC="images/ABS.jpg" align="right"> |
|||
|
|||
"Stripping" On by default for libraries and binaries. The stripping |
|||
behavior for libraries may be changed by clicking on the right mouse button |
|||
to change from --strip-debug to --strip-all.</p> |
|||
|
|||
<p> |
|||
|
|||
"Devel Device" If the device used for development is different than the |
|||
actual boot device, use this field to indicate that device. You will have to |
|||
run lilo -v -C brlilo.conf -r "device mount point" manually at a later time |
|||
on the actual boot device.</p> |
|||
|
|||
<p> |
|||
|
|||
"Opt. Device" Add devices to the boot disk which are necessary for the |
|||
kernel to function properly. Put a space between each device. For instance, |
|||
/dev/fb0 for frame buffer devices.</p> |
|||
|
|||
<p> |
|||
|
|||
"append =" Add append options to brlilo.conf. If you are using a frame |
|||
buffer device you could add something like video=matrox:vesa:402,depth:16.</p> |
|||
|
|||
<br><br><br><br><br><br><br><br><br> |
|||
|
|||
<P align="center"> |
|||
<b>Using the Advanced Root Section</b></P> |
|||
<p><IMG ALT="" SRC="images/ARS.jpg" align="right"> |
|||
|
|||
"Root Device" |
|||
This is the device used for the root filesystem when |
|||
constructing the Boot/Root set. |
|||
You may choose a device which is different |
|||
than the Boot device, but presently only floppy devices are supported.</p> |
|||
|
|||
<p> |
|||
|
|||
"Root Device Size" The size of the actual media used for the Root Device.</p> |
|||
|
|||
<p> |
|||
|
|||
"Root Filename" |
|||
The name give to the root filesystem when initially made |
|||
in the temporary creation location. |
|||
The save button allows the creation to |
|||
be saved in the permanent default location when the |
|||
Accept button is pressed.</p> |
|||
|
|||
<p> |
|||
|
|||
"Filesystem Size" |
|||
Root Methods make the filesystem the size which is |
|||
specified here.</p> |
|||
|
|||
<p> |
|||
|
|||
"Compression" |
|||
Off by default to allow user-mode-linux testing. Turn on |
|||
compression when you are ready to use a Boot Method |
|||
which requires compression.</p> |
|||
|
|||
<p> |
|||
|
|||
"Method" The root filesystem creation method.</p> |
|||
|
|||
<p> |
|||
|
|||
"Template" The template associated with a Root Method. |
|||
Not all Root Methods |
|||
have templates.</p> |
|||
|
|||
<p> |
|||
|
|||
"Generate" This puts the chosen Root Method in action.</p> |
|||
|
|||
<p> |
|||
|
|||
"UML" Abbreviation for user-mode-linux. |
|||
This is a linux kernel which runs on |
|||
top of the host system's linux kernel and allows a you run a live root |
|||
filesystem.</p> |
|||
|
|||
<p> |
|||
|
|||
"Accept" |
|||
This accepts the created root filesystem if it is found in the |
|||
temporary creation directory. |
|||
The UML box and the main section will now |
|||
reflect the path to this root filesystem. |
|||
You can now test with the UML |
|||
button or a put together a complete Boot/Root set with the Submit button.</p> |
|||
|
|||
|
|||
<p><P align="center"><b>User Mode Linux Box</b></p> |
|||
|
|||
<p><IMG ALT="" SRC="images/uml_box.jpg" align="right"> |
|||
|
|||
"Xterm" Choose an xterm with its executable options switch.</p> |
|||
|
|||
<p> |
|||
|
|||
"Options" Enter uml command-line options like: mem=64, |
|||
devfs=nomount.</p> |
|||
|
|||
<p> |
|||
|
|||
"Root_Fs" Choose an uncompressed root filesystem. |
|||
Append with ubd?=.</p> |
|||
|
|||
<p> |
|||
|
|||
"Abort" Abort user-mode-linux kernel processes. </p> |
|||
|
|||
|
|||
<p><P align="center"><b> |
|||
About the Yard Box</b></p> |
|||
|
|||
<p><IMG ALT="" SRC="images/yard_box.jpg" align="center"></p> |
|||
|
|||
The Yard Box is a Root Method which is "Generated" from the Advanced Root |
|||
Section after a Template is chosen. It has several interesting features. |
|||
|
|||
<p> |
|||
|
|||
The check boxes at the bottom represent the different stages involved in |
|||
creating a root filesystem. The behavior of these stages may be altered in |
|||
three ways: Edit->Stages->one-by-one (default) will perform each stage |
|||
sequentially, stopping between each stage, the user may continue the process |
|||
by pressing the Continue button. Edit->Stages->continuous proceeds non-stop |
|||
through all the stages. Edit->Stages->'user defined' allows the user to |
|||
choose any stages the user wants, and will then proceed through all the |
|||
chosen stages. Choosing only 'Check', 'Links & Deps', 'Create" is a good |
|||
example.</p> |
|||
|
|||
<p><IMG ALT="" SRC="images/tests.jpg" align="center"></p> |
|||
|
|||
<p> |
|||
|
|||
The behavior of some of the stages may be altered. For instance Alt-T allows |
|||
you to choose which tests to run on the newly created |
|||
root filesystem.</p> |
|||
|
|||
<p><IMG ALT="" SRC="images/template_search.jpg" align="center"></p> |
|||
|
|||
<p> |
|||
|
|||
Press Alt-S to enable template text searching in either |
|||
direction. Find exact matches or ignore case with the case sensitive check |
|||
box.</p> |
|||
|
|||
<p><IMG ALT="" SRC="images/file.jpg" align="center"></p> |
|||
|
|||
<p> |
|||
|
|||
Use Ctl-S to save the changes to an open template, and Alt-A to save the |
|||
template with a new name. |
|||
bOOTrOOT will not allow readonly templates or template links to be saved |
|||
with their own name. A few of these example files are included. You may make |
|||
changes to them or clear their buffers. Then you may save the template with a |
|||
different name.</p> |
|||
|
|||
<p><IMG ALT="" SRC="images/stripping.jpg" align="center"></p> |
|||
|
|||
<p> |
|||
|
|||
Edit->Settings->Stripping allows you to turn off/on stripping for |
|||
Libraries, Binaries, and Modules. --strip-all is the default stripping |
|||
behavior, but Libraries may have this behavior changed to --strip-debug.</p> |
|||
|
|||
|
|||
<p><IMG ALT="" SRC="images/paths.jpg" align="center"></p> |
|||
|
|||
<p> |
|||
|
|||
Edit->Setting->Paths allows you to prepend a new search path to your |
|||
environments $PATH variable. |
|||
</p> |
|||
|
|||
<p><IMG ALT="" SRC="images/filesystem.jpg" align="center"></p> |
|||
|
|||
<p> |
|||
|
|||
Edit->'File System" may alter the type of filesystem used to make the root |
|||
filesystem. Because the filesystem is created on a loop device, some |
|||
filesystem types may complain or not be created at all.</p> |
|||
|
|||
<p><IMG ALT="" SRC="images/replacements.jpg" align="center"></p> |
|||
|
|||
<p> |
|||
|
|||
Edit->Replacements in your $HOME/.gbootroot/Replacements directory using |
|||
an editor of your choice. |
|||
</p> |
|||
|
|||
<p><IMG ALT="" SRC="images/create.jpg" align="center"></p> |
|||
|
|||
<p> |
|||
|
|||
Create->Replacements creates special replacement files. Presently it creates |
|||
an fstab configuration file as Replacements/etc/fstab.new in |
|||
$HOME/.gbootroot/yard/.</p> |
|||
|
|||
<br><br> |
|||
<P>Little things you may want to know:</P> |
|||
|
|||
<P>* gBootRoot requires ash for initrd. Ash is a feather weight version of Bash.</P> |
|||
<br> |
|||
|
|||
<P><IMG ALT="" SRC="images/gBSicon.jpg" align="center"> <b>FAQ</b></P> |
|||
<P><b>What does this program do?</b></P> |
|||
<P>gBootRoot creates a boot disk with lilo, a kernel and an initrd image. The |
|||
initrd script mounts another root disk with a compressed (gzip or bzip2) |
|||
filesystem.</P> |
|||
|
|||
<P>The root filesystem isn't made by this program, but there lots of compressed |
|||
filesytems out there to use (see rest of FAQ). This program is patterned |
|||
after mkrboot, but unlike mkrboot it creates an unique bootdisk and a |
|||
separate root disk.</P> |
|||
|
|||
<P><b>What's the advantage of using this program?</b></P> |
|||
|
|||
<P>You can use a bzip2 compressed filesystem, this program is easy to use, and it provides a framework showing a simple initrd method which you can freely |
|||
modify. I wrote this program as an extension to BootRoot which was written |
|||
as a solution to help oster at EE (www.experts-exchange.com) create separate |
|||
boot and root floppies for an emergency system for his customers.</P> |
|||
|
|||
<P>If you make a cool change to this program, or if this program helps you I'd love to know, that's better than receiving pizza. :)</P> |
|||
|
|||
<P><b>How can I test gBootRoot?</b></P> |
|||
|
|||
<P>Get SETUP.GZ as the filesystem from <a href="http://www.tux.org/pub/people/kent-robotti/index.html">looplinux</a> or get it from my <a href="/bootroot/setup.gz">site</a>. |
|||
This filesystem works with 2.2 kernels.</P> |
|||
<p> |
|||
[Ctrl] ([Tab] to see available images) |
|||
<br> boot: bootdisk single [Enter] |
|||
<br> ( now filesystem is single user mode) |
|||
<br> exit [Enter] |
|||
<br> (now you are in multi user mode) |
|||
<p> |
|||
Better yet, do [Ctrl] |
|||
<br> boot: bootdisk 2 [Enter] |
|||
|
|||
<P>You can make your own compressed filesystem with |
|||
<a href="http://www.croftj.net/~fawcett/yard/">Yard</a>.</P> |
|||
|
|||
<P><b>Why doesn't looplinux work as "bootdisk 1?"</b></P> |
|||
<P>There is a difference between "1" and "single." Looplinux was written in a |
|||
way that runlevel 1 doesn't work properly in relation to gBootRoot unless |
|||
single is used. And you thought they were the same thing? gBootRoot |
|||
proves otherwise. </P> |
|||
|
|||
<P><b>gBootRoot doesn't start because it can't locate Gtk.pm?</b></P> |
|||
<p>This program requires Gtk-Perl available from <a href="http://www.perl.com/CPAN">CPAN</a>, <a href="http://freshmeat.net/projects/gtk-perl">Freshmeat</a> or most GNU/Linux distributions.</p> |
|||
|
|||
<p><b>There isn't enough room left on my 1440 floppy to make a Boot or Root |
|||
disk. Is there any way to free up more space apart from reducing |
|||
the size of the kernel?</b></p> |
|||
|
|||
<p> |
|||
Move the device size to 1722. This is a trick that <a href="http://www.toms.net/rb/">tomsrtbt</a> uses on his famous rescue disk.</p> |
|||
|
|||
<p><b>If you roll the floppy density counter down to 0 and then try go back |
|||
up towards 1440 and 1722, you get very funny figures.</b></p> |
|||
|
|||
<p> |
|||
This is because of the way Gtk works. There are two adjustments, |
|||
step and page increments. When you press your first mouse button the step |
|||
has been set to 282 so that a person can easily switch between 1440 and 1722. |
|||
When you use your second mouse button the page is set at 360. You can go |
|||
down to zero by pressing your third mouse button on the down arrow. Now |
|||
page up with the second button to 1440 and step with the first button to |
|||
1722. Pretty cool, eh?</p> |
|||
|
|||
<p>Why we are on this subject please check out these keyboard shortcuts for Gtk.</p> |
|||
|
|||
<P>Motion Shortcuts |
|||
|
|||
<UL> |
|||
<LI> Ctrl-A Beginning of line </LI> |
|||
<LI> Ctrl-E End of line </LI> |
|||
<LI> Ctrl-N Next Line </LI> |
|||
<LI> Ctrl-P Previous Line </LI> |
|||
<LI> Ctrl-B Backward one character </LI> |
|||
<LI> Ctrl-F Forward one character </LI> |
|||
<LI> Alt-B Backward one word </LI> |
|||
<LI> Alt-F Forward one word </LI> |
|||
</UL> |
|||
|
|||
<P> Editing Shortcuts |
|||
|
|||
<UL> |
|||
<LI> Ctrl-H Delete Backward Character (Backspace) </LI> |
|||
<LI> Ctrl-D Delete Forward Character (Delete) </LI> |
|||
<LI> Ctrl-W Delete Backward Word </LI> |
|||
<LI> Alt-D Delete Forward Word </LI> |
|||
<LI> Ctrl-K Delete to end of line </LI> |
|||
<LI> Ctrl-U Delete line </LI> |
|||
</UL> |
|||
|
|||
<P>Selection Shortcuts |
|||
|
|||
<UL> |
|||
<LI> Ctrl-X Cut to clipboard </LI> |
|||
<LI> Ctrl-C Copy to clipboard </LI> |
|||
<LI> Ctrl-V Paste from clipboard </LI> |
|||
</UL> |
|||
|
|||
<IMG ALT="Larry Ewing's Penguin celebrates in gBootRoot." SRC="images/peng-movie.4.gif"> |
|||
|
|||
<br><br><br> |
|||
Contact me: Jonathan Rosenbaum <<a href="freesource@users.sourceforge.net">freesource@users.sourceforge.net</a>> |
|||
<br> |
|||
Submit a Bug: <a href="http://sourceforge.net/bugs/?group_id=9513">gBootRoot Bug System</a> |
|||
<br> |
|||
Ask a question: <a href="http://sourceforge.net/forum/forum.php?forum_id=29639">Help Forum</a> |
|||
<br> |
|||
Start a discussion: <a href="http://sourceforge.net/forum/forum.php?forum_id=29638">Open Discussion Forum</a> |
|||
<br> |
|||
Join the mailing list: <a href="http://sourceforge.net/mail/?group_id=9513">gbootroot-dev mailing list</a><p> |
|||
</body></html> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Loading…
Reference in new issue