Commit Graph

223 Commits

Author SHA1 Message Date
Marcel Moolenaar
c3e6b1182b Handle EFI partitions the same as regular FAT partitions. The only
difference between the two from a low-level point of view is that
the partition type is different. This change adds EFI related cases
to existing switch statements with existing FAT related cases.
2002-11-13 05:31:32 +00:00
Chad David
86b62d35bf - Document the chunk_name() function that replaces chunk_n[].
- Rearrange things a tiny bit.
2002-11-11 19:37:19 +00:00
Chad David
8ff8da756b Remove parameter names from function prototypes (at least one collided
with stdlib.h).

discussed with: phk
2002-11-11 18:55:57 +00:00
Poul-Henning Kamp
efb14d4614 Remove debugging printfs. 2002-11-11 10:08:46 +00:00
Marcel Moolenaar
cd5a1c3b76 MBR slices are named the same on ia64 as they are on i386. 2002-11-11 04:46:39 +00:00
Jake Burkholder
83702273a3 Write the boot block to the first 16 sectors of all partitions, instead of
always to the first 16 sectors of the disk.  The firmware reads the boot
code from a partition, defaulting to 'a' if none is specified, which only
corresponds to the first 16 sectors of the disk if 'a' is first.  Solaris
often makes the swap partition first, instead of the root partition, and
users expect to be able to do the same with freebsd as well.  This also
allows one to temporarily boot from another partition if the boot block
on the root partition gets scrambled somehow.
2002-11-10 21:07:29 +00:00
Marcel Moolenaar
7593e0d3c5 Add efi to the list of types for which we need to return tha name.
Also, return chunk type efi in case we find an EFI partition in
the GPT. We used to return FAT due to a lack of EFI type.
2002-11-10 20:53:10 +00:00
Marcel Moolenaar
c9a3bb24d6 Add an efi chunk type. We need to be able to create an EFI partition
on ia64, because that's where we need to put the loader and the
kernel.
2002-11-10 20:49:28 +00:00
Marcel Moolenaar
255bef40ce General cleanup:
o  Remove all code guarded by !defined(__ia64__). This file is
   specifically written for ia64,
o  Handle the case when read_block() or write_block() fails. We
   don't want sysinstall(8) to signal a thumbs-up on error,
o  Set the starting (cyl,hd,sect) triple to 0xFFFFFF when either
   bios_hd or bios_sect is zero or the LBA us not representable
   with the triple. In that case automaticly initialize the
   ending triple with 0xFFFFFF as well,
o  Reindent Write_Int32() as it was different than the rest of
   the file,
o  Remove some unused variables that appeared to be used but
   were effectively useless.
o  Plug a memory leak: The second timne we read the MBR, we write
   out a modified block, but didn't free the memory after writing.
o  Replace d1->sector_size with 512 when we read/write the MBR.
   We ignore the sector size in cases we shouldn't but adhered to
   it in cases it would be wrong if the sector_size wasn't 512.

This file should eventually be rewritten to write out a GPT. For
now, a MBR will do...
2002-11-10 20:47:02 +00:00
Yoshihiro Takahashi
3b6431b5ed - Recognize FAT partition on MBR and PC98 disks.
- Fix to convert to the name of partition.
2002-11-08 15:25:15 +00:00
Yoshihiro Takahashi
8704e2bb35 MFi386: revision 1.4. 2002-11-08 14:49:14 +00:00
John Baldwin
a96977d0ab Don't set a variable to a bogus value right before setting it to the
correct value in the next statement.
2002-11-08 14:00:44 +00:00
John Baldwin
7f55ebcd18 Don't set a value to a variable that we don't use. 2002-11-08 14:00:09 +00:00
John Baldwin
2b39144955 - Merge Write_FreeBSD() into Write_Disk().
- Miscellaneous cleanups.
2002-11-08 13:58:00 +00:00
Yoshihiro Takahashi
ba91558ce9 Fixed pc98 support.
(merged i386 changes from chunk.c 1.41 and disk.c 1.100)
2002-11-07 14:54:53 +00:00
John Baldwin
75bd4c1549 Get this closer to working. The Write_Disk() function's for loop needed
to use the same start condition as the i386 version.  However, since
Alpha's only have one fake "slice" from sysinstall's perspective we don't
need to use a loop, but can just write out the BSD label in the first
fake "slice".
2002-11-07 14:39:21 +00:00
John Baldwin
da58ad34ef Remove unused MBR gunk leftover from i386. 2002-11-03 21:18:17 +00:00
Yoshihiro Takahashi
0932c866b6 Fix to compile for pc98. 2002-11-03 09:35:08 +00:00
Marcel Moolenaar
62b693d7db Initialize d->bios_cyl. We know the media size in sectors, the number
of heads end the number of sectors per track. If there's an obvious
insanity (heads and sectors are both zero or the media size is not
an integral multiple of heads times sector) we set the number of
cylinders to zero.
2002-11-03 01:37:08 +00:00
Marcel Moolenaar
12d76c6fec Add support for GPT:
1. When the parition type is not an integer, try to parse the type
   as an UUID. If that succeeds, map the UUID to chunk_e.
2. For GPT partitions, pass the type constructed in point 1 above
   to Add_Chunk.

While here, fix the MBREXT case by only checking if the first 3
characters are MBR. This avoids duplication.
2002-11-02 12:14:04 +00:00
Marcel Moolenaar
0a8575280c Add support for ia64. This is almost identical to i386, except that
with GPT chunks of type "part" do not necessarily live under chunks
of type "freebsd". We don't necessarily have a disklabel.
2002-11-02 12:05:16 +00:00
Poul-Henning Kamp
a6db5ac980 Don't claim all MBR's have subtype 165 on i386.
Spotted by:	Frode Nordahl <frode@nordahl.net>
2002-11-02 10:57:44 +00:00
Poul-Henning Kamp
0514d63049 Fill in partition 2 with with "whole disk" parameters. 2002-11-01 16:28:19 +00:00
Poul-Henning Kamp
fd4a61e809 Style(9) improvements. 2002-10-31 07:56:40 +00:00
Poul-Henning Kamp
63abca411d Set the sector size for the disk. 2002-10-31 07:55:38 +00:00
Yoshihiro Takahashi
fe1f2a9a84 Restore to pc98 support. 2002-10-31 05:51:25 +00:00
Yoshihiro Takahashi
fecafa765a Use ${MACHINE} variable instead of using '.if .endif' each machines. 2002-10-31 05:43:49 +00:00
Yoshihiro Takahashi
c540b79f8b Add '#include <err.h>' for warn(). 2002-10-31 05:38:48 +00:00
Jake Burkholder
e03494dd17 Actually save the bootblock in the disk structure. Write the bootblock
to the right place on the disk instead of srewn all over it.
2002-10-31 04:25:17 +00:00
Poul-Henning Kamp
89a0742e57 Untested alpha disk writer. 2002-10-30 20:54:22 +00:00
Poul-Henning Kamp
ae59d02e12 Write out 15 sectors of boot code. 2002-10-30 20:52:07 +00:00
Poul-Henning Kamp
30820b02ab Getting closer to getting things right:
Always ignore the RAW_PART for BSD.
Having no quirks is not a mistake for an architecture.

Tested by:	DES
2002-10-29 17:12:02 +00:00
Poul-Henning Kamp
4730deb1e3 Don't call warn(3). 2002-10-29 14:45:43 +00:00
Poul-Henning Kamp
56d3134bfb Since make release is toast anyway, add wood to the pyre:
This significantly rewamps libdisks discovery of existing disk
layout.

Please send me reports if this does not work as expected on
i386 or sparc64 platforms.

I need to sort out alpha, pc98 and ia64 (in that order) before
testing on those platforms make a lot of sense.

Belived to work for:	i386 sparc64
Unknown state:		pc98 alpha ia64
2002-10-29 12:13:36 +00:00
Poul-Henning Kamp
2f7fb9cc47 Fix various minor issues.
Don't explode on 'write' because we access a pointer we just freed.
2002-10-29 07:39:18 +00:00
Poul-Henning Kamp
bab7e1509c the 'd' partition hasn't been magic for years, so allocate it in natural
order instead of last.
2002-10-29 07:37:11 +00:00
Poul-Henning Kamp
b6c0192ce3 Add the write_spar64_disk.c to make life easier for testers.
This file depends on some major surgery in the rest of libdisk which is
not yet committed.
2002-10-29 07:35:36 +00:00
Peter Wemm
7e50af21ba Add back ia64 support that was removed in the last few revisions.
I've cloned write_ia64_disk.c from write_i386_disk.c.
2002-10-27 00:21:02 +00:00
Andrew Gallatin
b49cf84452 #ifdef out assignToPartition on non x86 arches to unbreak the world
on alpha, sparc64 and ia64
2002-10-24 13:35:52 +00:00
Poul-Henning Kamp
d7e9a2ad8a More lobotomy:
remove CHUNK_BSD_COMPAT, it was a bad idea, and now its gone.
        remove DOSPTYP_ONTRACK, missed in OnTrack removal commit.
        unifdef -DHAVE_GEOM
make tst01 compile again.
2002-10-23 21:05:42 +00:00
Poul-Henning Kamp
943599b348 Remove another 10 mindless #ifdefs. 2002-10-23 20:35:42 +00:00
Poul-Henning Kamp
844c9bb884 Rely on sysctl kern.disks to be there, and get rid of one of the far too
many lists of disk device driver names in the system.  At this point
we should really get the names from the XML, but hey...
2002-10-23 20:15:10 +00:00
Poul-Henning Kamp
b485e51552 Remove unnecessary ioctls tickling kernel side to realize that we fiddled
with the disk.  GEOM will automatically retaste when we closet he filedesc.
2002-10-23 20:02:33 +00:00
Poul-Henning Kamp
532dd2fa86 Untangle #ifdefs in the write-end of things by giving each arch its
own file and own copy of WriteDisk() to do things in.

This should have happened years ago, instead of adding #ifdefs all
over the place.
2002-10-23 19:52:32 +00:00
Poul-Henning Kamp
56c0241de6 Separate the struct disklabel filling stuff from the rest of Write_FreeBSD(). 2002-10-23 19:32:18 +00:00
Yoshihiro Takahashi
7bec978084 - The GEOM system does not work on pc98.
- Fix to build w/o the HAVE_GEOM option.
2002-10-23 13:00:09 +00:00
Poul-Henning Kamp
0bb035b962 Add the new extra argument also in the alpha case. 2002-10-23 10:47:00 +00:00
Poul-Henning Kamp
c0e2acef98 No longer needed. 2002-10-22 15:22:36 +00:00
Poul-Henning Kamp
c087f8a1ce Remove the last traces of bogus MAKEDEV functionality. 2002-10-22 15:07:50 +00:00
Poul-Henning Kamp
374ec39bb6 Live with it: I had hoped to find a neat way to deal with all the magic
numbers, but so far havn't come up with anything:  Add an #ifdef PC98.
2002-10-22 11:55:27 +00:00