Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jul 2012 11:02:53 +0400
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        FreeBSD Current <freebsd-current@FreeBSD.ORG>
Cc:        Marcel Moolenaar <marcel@FreeBSD.org>, Andriy Gapon <avg@FreeBSD.org>, Hiroki Sato <hrs@FreeBSD.org>
Subject:   [Request for review] loader changes
Message-ID:  <5016319D.5000503@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig934F2ECCF177386C153B9787
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

Hi, All.

It's been a long ago, when i published my patches first time.
And it seems, there is no one who is against or wants suggest something.
So I'm asking for review, and I want start merge changes at the end of we=
ek.
Patches are here: http://people.freebsd.org/~ae/bootcode/

full.diff:
The full diff, except tools.

tools.diff:
A small test program bootparttest. It uses sys/boot/common/part.c to
taste GEOM provider or disk image in the similar way, how loader does.

common.diff:
Changes to the common code. This code is used with many architectures and=
 libraries.

* common/Makefile.inc
  added LOADER_NO_DISK_SUPPORT knob to disable build common code related =
to disks and
  partitions. By default GPT and MBR support are enabled, LOADER_NO_GPT_S=
UPPORT and
  LOADER_NO_MBR_SUPPORT can disable they.

* common/part.c
  common/part.h
  these files are new. They contains partition tables related code. Sever=
al words about API:
  Partition table described with opaque type "struct ptable", partition e=
ntries with
  struct ptable_entry {
	uint64_t		start;
	uint64_t		end;
	int			index;
	enum partition_type	type;
  };

  The partition tables detection occurs when ptable_open() is called. Thi=
s function takes
  as arguments the number of disk sectors, sector size and pointer to the=
 callback
  function, that is know how to read from the disk.
  The ptable_close() function releases allocated resources.
  The ptable_gettype() functions returns the type of partition table.
  The ptable_getpart() functions returns information about specified part=
ition.
  The ptable_iterate() functions calls a callback function for each parti=
tion in the table.
  The parttype2str() converts partition type to the string.

  The following partition tables are supported: BSD label, GPT, MBR, EBR =
and VTOC8.

* common/disk.c
  common/disk.h
  These files have been changed and they use new API to work with partiti=
ons. Also now
  they provide new disk API to the devsw disk drivers: disk_open(), disk_=
close(),
  disk_print(), disk_fmtdev() and disk_parsedev().

i386.diff:
Changes related to the i386 architecture:

* i386/libi386/devicename.c
  Use disk_fmtdev() and disk_parsedev() functions from the common code.

* i386/libi386/biosdisk.c
  The disk driver was rewritten to use new disk API. To the devsw ioctl h=
andler was added.
  It handles DIOCGSECTORSIZE and DIOCGMEDIASIZE ioctls.

* i386/libi386/libi386.h
  The offset field was added to the i386_devdesc.d_kind.biosdisk structur=
e.

* i386/libi386/Makefile
  removed unneeded flag.

* i386/pmbr/pmbr.s
  Added secondary GPT support.

* i386/loader/main.c
  ZFS probing simplified.

* i386/loader/Makefile
  removed unneeded flag.

userboot.diff:
The disk driver and sample program updated according to the changes in th=
e disk.c.
Also new diskioctl callback added.

uboot.diff:
The disk driver was rewritten to use new disk API.

arm.diff:
powerpc.diff:
Added LOADER_NO_DISK_SUPPORT handling to be able build uboot with or with=
out disk support.

zfs.diff:
Use new partitions API to probe all ZFS partitions in the GPT and BSD par=
tition tables.

So, if there will not any opinions against these APIs and patches I will =
start
commit. The first step will be common and userboot code, then - i386 and =
zfs parts.

--=20
WBR, Andrey V. Elsukov



--------------enig934F2ECCF177386C153B9787
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)

iQEcBAEBAgAGBQJQFjGiAAoJEAHF6gQQyKF6RIcIAJLsM6DEb+zxEkzD7SLGYOxO
kFcgC6wHVPunH5tluSf8FVQn6yDkSFin3Sw8xe9qFDmFQ7UCdPbhnrGPDRizzUPD
W6Od797a+iEhDdhWx2odglPyCdzaAgogw+sppPjvteRE3qNqK9bWM2MSS472CEpY
xcB6Q5Ar1szNph/x2L9JXMt7WMkc7NRGQMGCTb02kss7SAzxxkjUDxxVhY/DCgxV
auGBR+xxbRckVAFK27RyxCJuA5/114tbpA7wFiVh70SLu91l29zwc1aOPY0f87NW
6wDDP+QUdL+oO6wxY2f9OqjcL9qmJiyMZ42h4lQG+2Lg9BmT7Qo1q6txo61XTDM=
=RWeO
-----END PGP SIGNATURE-----

--------------enig934F2ECCF177386C153B9787--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5016319D.5000503>