[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How To Write Extended Partition Tables from GRUB?

From: sburtchin
Subject: How To Write Extended Partition Tables from GRUB?
Date: Wed, 8 Nov 2006 02:40:25 -0800 (PST)

This dialog began in another thread ("How Do I Install GRUB Program Files to
FAT32 Partition"), but really has nothing to do with that subject, so I am
continuing here.

adrian15 wrote:
> sburtchin escribió:
>> Is there an equivalent ("partnew" like) GRUB command for writing to
>> EPT's?  OR, is there a
>> GRUB command that can write a specific sector?
> I've made a very limited dd command on super grub disk (SGD is not
> intended to work on hard disk and has not the partnew command but it can
> be added.)
OK, so the answer is NO on both counts, but I think I know the solution (at
least a dirty way of doing it).  More on that later.

adrian15 wrote:
> sburtchin escribió:
>>  I want to share an extended
>> partition, but the last logical partition for DOS & Win3.1 will be in the
>> middle of the extended partition for the more advanced os's.  Therefore,
>> the
>> second  entry in this EPT should be different depending on the os being
>> booted.
> Can you please ellaborate on this example? I like this complex boot
> situations? Can you please tell us something as MS-DOS could see that if
> it was created like that but if it is created the other way....
Here is my planned layout for the second hard disk.  The alternate "b1's"
and "b4's" are for different boot situations.  The "DOS Place Holder"
partitions are for the purpose of justifying drive letter assignments with
the Win9x operating systems.  The first disk also has various Windows and
Linux and Solaris.


The old operating systems want to use CHS addressing and don't like disks
with more than 1024 cylinders.  So I have to limit their view of the world
to keep them happy.  But there is interesting stuff here that the advanced
operating systems should have access to.  The advanced operating systems use
LBA addressing and don't care about lots of cylinders.  To get them to share
the same logical partitions, I plan to have alternate definitions for the
extended partition.  Normally (using the "LBA" extended partition) the EPT
at "b15" would have a type "05" entry pointing to the next logical
partition.  But when booting DOS5 and Windows3.1 they need to see a much
smaller disk (the "CHS" extended partition).  Note the ending cylinders of
the two extended partitions.  In this case the EPT at "b15" should not have
a type "05" entry.

adrian15 wrote:
> sburtchin escribió:
>> Can the command "parttype" be used with logical partitions as well as
>> primary ones (eg. "parttype (hd0,7) 0x0C")?
> It seems that yes.
> I've seen on the code that next_partition code... so ... it is possible
> to modify the "mbr" of an extended partition.
> That means that a enhanced partnew command could be written but I
> currently do now the technical details (what numbers and values are
> exactly written in the "partition table" of the extended partition)
> about how all these things work.
> If you can search documentation about it I may work on it sooner ( I
> have currently other projects on mind. )
The "parttype" command knows how to write a one byte string to any of the
EPT's as specified by parameters on the command line.  So a slightly
modified "parttype" (lets call it "EPTpartnew") could be made to write a
longer string to anywhere within the same sector without too much
modification.  The "dirty" part is that I would have to figure out that
string using a calculator and scratchpad.

A user friendly "EPTpartnew" would be nice (probably a good bit of work),
but I think I could figure out how to make the "quick and dirty" one with a
little help.  I understand that the GRUB source code is available and that I
can compile it with Linux to create the binaries myself.  Can you explain
the steps to do this?

Can you tell me which source code module(s) defines the "parttype" command
and what is its calling module.  First step would be to create a new command
("EPTpartnew") that is exactly the same as "parttype".  Is there anything
special I would need to know to do this?  The next step would be to modify
the "EPTpartnew" command to accept a longer input string and write a longer
output string with different offset.  Please tell me what code lines to look
at in the "parttype" module.

I'll post more detail if you need it (or help provide formulas to calculate
the output string if you want to create a user-frienldly version).  Thanks
for any help you can give me on this.
View this message in context: 
Sent from the Grub - Bugs mailing list archive at Nabble.com.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]