1
This is the first attempt at a complete boot loader for Linux on Sparc.
2
Because of the lack of space on the bootblock, we have to do it in two
3
steps, the first step is a very simple loader based on Peter Zaitcev's
4
silo (we will call this the first stage loader) which should fit in 512B
5
and its sole purpose is to load a more complete bootstrap loader, herein
6
refered to as the second stage boot loader. The cool thing about the
7
second stage loader we implemented is that it makes use of the ext2
8
library (provided with the ext2fs tools) and some ufs code, and thus
9
allows the loader to access any file on a ext2 fs and ufs, uses silo.conf,
10
handles gunzipping and a lot of other things. This is different from
11
Linux/i386 lilo which needs a map for each kernel. In silo we just keep
12
one map file for the second stage loader, we don't expect you to be
13
changing the second stage loader on your daily routine (you can do so, you
14
will just need to use a tool to reinstall the maps).
16
There are two distinct versions of the Sun EPROM, those before 2.0 ("old")
17
and those of 2.0 and later ("new"). Unfortunately these details are
18
visible at various points. With old proms, the device is specified as
19
dev(X,Y,Z) [e.g. sd(0,3,1)] where dev is the device (normally sd), X is
20
the controller, Y is the unit number, and Z is the partition number. Note
21
that numbers start at 0, rather than Linux's convention of starting at 1,
22
so sd(0,3,1) is /dev/sda2. Note also that many systems have the "first"
23
disk (sda) as unit 3. With new proms, the device is specified in "open
24
boot prom" format, e.g. /iommu/sbus/espdma/esp/sd@1,0 is target 1, LUN 0
25
and /sbus/esp@0,800000/sd@3,0 is target 3, LUN 0.
27
Due to a bug in some (all??) v2 PROMs (what about v0??) all the files
28
which SILO can load must be below a magic boundary 1GB from the start of
29
the disk (not from start of the partition). The easiest way is to put your
30
/ filesystem completely inside first 1GB (and if you want to boot other OS
31
on the same harddisk, put their / partitions under that boundary as well).
32
Then just make sure you always leave the images you want to boot in those
35
During the installation, SILO saves the original boot loader under a user
36
especified file name, so, when silo prompts for a kernel name it is
37
possible to load the original boot loader, either by adding it to your
38
silo.conf or by typing its path on your SILO command line. Assuming the
39
original boot block is stored in boot/old.b on partition 4, it can be
40
accessed by having silo.conf containing:
43
bootblock = 4/boot/old.b
46
(old proms need "other = sd(0,3,0) bootblock = sd(0,3,3)/boot/old.b") or
47
by typing 1 bootblock=/boot/old.b on your SILO command line.
49
There is a magic image name `halt' that gets you back to the prom, and
50
`help' displays some help text.
52
If you wan to uninstall SILO, restore the original blocks by running e.g.
53
dd if=/boot/old.b of=/dev/sda bs=512 seek=1 count=15
57
You need all the proper compilers and linkers for Linux/SPARC native ELF
58
compile, if you want to compile SILO yourself. But the standard
59
distribution comes with all the necessary binaries.
61
Under the boot, etc and sbin subdirs you will find all the programs
62
already compiled and ready to run on Linux/SPARC. Those three directories
63
should be probably copied to your /boot, /etc and /sbin on your root
64
partition to make things easy. Then you just run /sbin/silo and if /boot
65
doesn't contain old.b file yet, your old loader (usually sunos or solaris)
66
will be copied there and silo will be installed. Bootblocks will be
67
installed after the label of the disk which contains your second.b and
68
silo.conf (both have to be on the same physical disk), e.g. if second.b is
69
on /dev/sda5 and silo.conf on /dev/sda1, bootblocks will be installed into
70
/dev/sda. In case you are creating a new root file system (e.g. your
71
current root filesystem is nfs and you are setting up an ext2 root
72
filesystem in /mnt), then you should run silo after installing boot, etc
73
and sbin directories into /mnt/boot, /mnt/etc and /mnt/sbin with the -r
74
parameter, e.g. /mnt/sbin/silo -r /mnt
76
The firts loader pumps you into the second one very quickly, printing
77
letters SILO after some actions are performed. If it prints only some of
78
these letters and then dies, it means some error happened, e.g. if it
79
prints SIL it means that it loaded a second stage loader, but with wrong
80
magic. Then SILO prints a boot: prompt. If you give silo arguments on the
81
prom command line already, SILO will try to load it (image params). This
82
image can be either a full name (described later) or alias or label of
83
some image in case you have silo.conf.
85
Otherwise SILO refers to your silo.conf file, which is similar the iX86
86
lilo.conf with some additions and omissions (some are not needed, others
87
are not implemented). To the boot: prompt, you can:
89
1) wait for the timeout (if any) to expire, which loads the "default"
90
2) press enter, which loads the "default"
91
3) type "halt" to get back to prom
92
4) type "help" to get some help
93
5) type an alias or label present in silo.conf
94
6) press TAB to list the label names and aliases in silo.conf
95
7) type the full path of the image to load
97
where the "default" is the image marked as default=image, or the first
98
one. The last option is the only one if you have no silo.conf, and gives
99
you much more freedom at the expense of more typing.
102
The full image path name depend on the prom version, pre 2.0 being "old",
103
and 2.0 and later being "new". Old ones have {promname} whereas later have
104
{prompath;}{partition_number}, i.e. new ones accept
105
{prompath;}{partition_number}/kernelname {kernel-args}
106
or {prompath;}{partition_number}[beg-end] {args}
107
whereas old ones accept
108
{promname}/kernelname {kernel-args}
109
or {promname}[beg-end]
111
{prompath;} and {promname} are optional, defaulting to the device specified
112
in the main section (before first image keyword) of silo.conf, or the boot
115
With old proms, you type prom paths as dev(X,Y,Z) [e.g. sd(0,3,1)].
116
With new proms, you type the open boot prom style strings such as
117
/iommu/sbus/espdma/esp/sd@1,0 terminated with a semicolon (;) to specify disk.
118
Then the partition can be specified, defaulting to the (optional) partition=Z
119
line in the main section in silo.conf. /dev/sda2 is "2".
121
For all proms, you specify a path to the image starting with a slash (/),
122
starting for the root of the specified partition.
123
Alternatively, you can load portions of physical disk by typing [B-E] instead
124
of /kernelname where B is the offset of the first 512 byte block to load,
125
and E is the last. Thus [1-16] will load 7680 bytes starting at offset 512.
126
On newer prome, if the partition number is omitted, it defaults to 0, i.e. the
129
In all cases, kernel args are optional.
131
/sbin/silo will warn you if there are any problems, but you should ensure that:
133
you need to start either first, or third (usually whole disk), or any other
134
partition on cylinder 0 in your partition table.
135
It is highly recommended, that your first partition (sda1) starts on cylinder 0
136
(beginning of disk) and that third partition (sda3) is of type WHOLE_DISK and
137
spans the entire disk, as these are conbentions which are often assumed.
138
If you do not, you have to make sure that whenever you use fdisk to change a
139
partition which starts at 0 (which usually includes deleted partitions) to
140
something else, you must rerun /sbin/silo on that disk.
141
If you keep sda1 and sda3 startng at offset 0, you don't need to do that.
143
SILO from 0.6.5 up supports loading of Solaris kernels without using the
144
saved boot loader. Either put into your silo.conf something like
145
image = 4/kernel/unix
146
label = solaris-single
150
(the name is relative to /platform/your_platform_name_here/ in case of
151
Solaris 2.5+), keyword solaris says that the kernel needs special handling
152
(otherwise it won't be loaded). On the command line, you can either type
153
somewhere between parameters a keyword solaris, or if the name is
154
/kernel/unix, you don't have to type anything. You should have your solaris
155
ufsboot in either /ufsboot or /platform/your_platform_name_here/ of the
156
partition you're booting solaris from.
158
SILO from 0.7.3 onwards supports a special syntax for conditionals in
159
silo.conf: instead of writing image keyword, you write e.g. image[sun4c,sun4m]
160
which means if the machine is sun4c or sun4m, that image will appear as is,
161
otherwise it will be hidden. There cannot be any spaces in the whole keyword
162
(ie. between "image", "[", the list of machines and trailing "]", machines
163
have to be separated by commas, the machine names should be either case of
164
sun4, sun4c, sun4d, sun4m, sun4e, sun4u.
167
image[sun4] = /boot/vmlinux-sun4.gz
169
image[sun4c,sun4d,sun4m] = /boot/vmlinux-sparc32.gz
171
image[sun4u] = /boot/vmlinux-sparc64.gz
174
To create a bootable floppy, you can use the romfs filesystem. It will allow
175
you to squeeze files on the floppy more than you achieve e.g. with ext2, and
176
you can use the dual sun4[cdm]/sun4u first stage bootblock.
177
You need to use genromfs-0.3 and higher. It can be obtained from
178
ftp://ftp.banki.hu/pub/linux/local/genromfs-0.3.tar.gz.
179
Firstly, you should populate the tree for the floppy in some directory. Lets
180
assume it is floppy/. Then copy the /boot/fd.b bootblock somewhere into the
181
floppy/ tree, e.g. to floppy/boot/fd.b. Then make sure you have the right
182
silo.conf in the tree as well, and do:
184
genromfs -d floppy/ -f /dev/ram -A 2048,/.. -a 512 -V 'My installation disk'
185
mount -t romfs /dev/ram /mnt
186
silo -r /mnt -F -i /boot/fd.b -b /boot/second.b -C /etc/silo.conf
188
dd if=/dev/ram of=floppy.img bs=1440k count=1
190
and you're done. -i defaults to /boot/fd.b for romfs floppies, -b defaults
191
to /boot/second.b, -C to /etc/silo.conf. The -A 2048,/.. argument to romfs
192
is required so that you have enough space for the first stage loader and
193
-a 512 is required because of the internal implementation of romfs in
194
second stage loader (but even if that changes, it would be required at
195
least for /boot/second.b anyway).
197
To create a bootable flash image for JavaStation-NC or JavaStation-E equiped
198
with flash, populate flash/ directory with boot/ieee32.b, boot/second.b,
199
etc/silo.conf, boot/proll.img and boot/vmlinux.gz:
201
dd if=/dev/zero of=flash.img bs=1k count=1
202
genromfs -a 512 -f romfs.img -d flash/
203
cat romfs.img >> flash.img
205
losetup /dev/loop0 -o 1024 flash.img
206
mount -t romfs -o ro /dev/loop0 /mnt
207
silo -J flash.img -i /boot/ieee32.b -r /mnt
209
losetup -d /dev/loop0
214
All the code is under GPL.
218
* (DONE) Redo filesystem support so it is easier to plug in more
219
* (All except ufs done) Add ls support for more filesystems
220
* Fix ls so you can do "ls -l /some/file", since ls only works on
221
directories right now.
222
* Someway to cache the filesystems, so we don't have to
223
open/read/close on every access to them.
225
* More silo.conf keywords/commands