Re: writing to a partition
- From: Kees Theunissen <theuniss@xxxxxxxx>
- Date: Wed, 17 Oct 2007 04:22:39 +0200
Allan Adler wrote:
Kees Theunissen <theuniss@xxxxxxxx> writes:
Allan Adler wrote:I then edited biosdata.S to produce a file dubiosdata.S in which all theDespite of the immediate _goal_,
various capitalized strings are defined explicitly and also inserted an
#define BD_VERBOSE, etc., and also copied the routines say, dsk_do_rw,
pause and bout to dubiosdata.S, as well as the routine putc which bout
uses. The immediate goal of this editorial activity is to produce a
self-contained version of biosdata.S that I can, in principle, study
without having to think about the rest of the lilo source and without
having to use the Makefile and to process it using only techniques that
it would normally occur to me to use (although that palette will hopefully
be enlarged by these experiences).
Read "immediate" as "temporary".
when you take parts of complicated
programs out of context -editing some parts more or less at random
without understanding what you're doing-, the immediate _result_ will be
lots and lots of error messages.
I think you need to read the part of my posting where I showed how to solve
that problem in this case.
Yes you showed what you did to solve the problem. You also told that you
had to remove a few single quote chars (') by hand in an intermediate
file. The original Makefile didn't have that problem. Somehow you
introduced this error while trying to reduce the complexity of the part
you want to study. How can you be sure that you didn't also introduce
logical errors in the program? Building a program without errors is
one thing, making it do what it should do is a different thing.
As long as you don't understand the context, the global picture, the way
(Intel) PC's boot, any attempt to simplify LILO will only introduce
errors and complicate the whole thing.
If you want to understand a program you should study that program, not
a modified part of it.
I'm not trying to simplify LILO. If I were to make an analogy, it would
be like seeing a radio tube inside an old TV set, removing it and testing the
tube separately and studying its characteristics or of using it to build
another unrelated device. That is a respectable activity. It would be
incorrect to accuse someone who does that of trying to simply the television
set. Of course, there might be features of using the tube that depend on its
context in the TV set, and that is something one has to keep in mind. But it
is still a good thing to do.
Using/testing a tube or any other single component outside the TV set is
common practice. Trying to isolate a whole functional module like the
deflection system would be more complicated. Are you sure your simple
"radio tube" analogy is valid in this case?
However, since you have a definite opinion about the right way to study
the lilo source, which I'm interested in doing, and since I'm open to
other points of view, maybe you can answer some questions:
There is no single right way to study things (although there a lots of
wrong ways). It just doesn't make sense in my opinion to spend lots of
time in trimming down a complicated but working program if that only
introduces errors. Creating a simple study environment isn't a valid
argument in this case, as you need to study and understand the program
first in order to be able to trim it down in a proper way.
(1) TRUE OR FALSE: When you read a source code file, you read it from
beginning to end without first jumping into the middle of it to
find a part that looks like it might be easier to read or more
interesting. (I'm just guessing that you think the answer is TRUE).
FALSE. Mostly I start grepping to find the things I'm looking for.
(2) There are dozens of source files in the lilo-22.8 distribution.
What is the precise order in which you think they ought to be
read?
I hardly can imagine the need to read all of them. I normally start by
trying to get the big picture of the issue I'm looking for. Details
come later.
(3) Apart from (1) and (2), when you studied the lilo source, what was
your method of going through it and making sure you understood what
was going on?
I never studied the lilo source. But I repaired quite a lot of corrupted
dos/windows boot sectors with only a hex editor as primary tool.
If I would want to write some 'self booting application' like you want
to do, then I would spend most of my time studying the BIOS function
calls. At boot time the BIOS is the only way to interact with your
keyboard, screen and disks.
I would probably start with a simple program that only puts a string
on the screen and enters a infinite loop after that.
After that I would study how to access the disk. I would learn about
different BIOS versions, different extensions to the hard disk
interface, and the different ways to circumvent the hard disk size
limits of previous BIOS versions. I would study how to determine the
current BIOS capabilities and the best way to access the disk.
After that I would extend my program to load some disks sectors in
memory (I'll need some way to pass the location of my partition on
the hard disk, or at least which partition is booting, to the bootstrap
code in the partition's boot sector). While studying the mentioned
BIOS aspects I'll probably see several coding examples that can be used
as a starting point to my program. I might have a look at lilo's boot
sector and borrow some of its ideas and/or code but I would build my
program from scratch, adding functionality pace by pace. I would never
start by trimming a complex program down until just wanted functionality
is left (not sure if you're doing that).
And after spending some time with this I would certainly conclude that
it was a useful exercise, that I learned a lot, but that I want to use
a real operating system to get work done.
Scavenging is a perfectly legitimate activity and it has definite advantages,
both practical and pedagogical.
Your suggestion about reading boot sectors has some merit. I've actually
tried on more than one occasion and was unsuccessful. Maybe after the present
effort, I'll be better prepared to try it again in the future.
Regards,
Kees.
--
Kees Theunissen.
.
- Follow-Ups:
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- References:
- Re: writing to a partition
- From: Dan Espen
- Re: writing to a partition
- From: Bill Marcum
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Bill Marcum
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Bill Marcum
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Michael Black
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Balwinder S Dheeman
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Dan Espen
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Dan Espen
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Unruh
- Re: writing to a partition
- From: Floyd L. Davidson
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Floyd L. Davidson
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Dan Espen
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- From: Kees Theunissen
- Re: writing to a partition
- From: Allan Adler
- Re: writing to a partition
- Prev by Date: Re: Ubuntu erased my whole hard drive
- Next by Date: hot sell nike jordan adidas puma prada clothes jeans and so on
- Previous by thread: Re: writing to a partition
- Next by thread: Re: writing to a partition
- Index(es):
Relevant Pages
|