Commit Graph

29 Commits

Author SHA1 Message Date
Haibo Huang
c83113b1d8 Upgrade gptfdisk to d292ff36a3
Change 2c2deeb032 is reverted in this
merge. Because it conflicts with upstream option "move-main-table".

Change-Id: I2c1cb67a95139879333a430eb0e8b34f6b396c32
2020-02-10 11:24:48 -08:00
Geoff Williams
d4e560771b Support placing GPT last when for hybrid MBR
Some hardware (notably Raspberry PI) requires a small FAT partition be listed
as the first MBR partition to boot. At the moment hybrid MBR disks allowing
this can only be made using the interactive `gdisk` program by choosing `h`
from the recovery menu and answering `N` when asked:

```
Place EFI GPT (0xEE) partition first in MBR (good for GRUB)?
```

This commit brings feature parity to `sgdisk` by changing `-h` to support an
optional final partition `EE` indicating that the GPT partition should be
listed last in the MBR instead of first.

**Examples**:

GPT first (current behaviour)

```shell
sgdisk -h 1:2 sdcard.img
```

GPT last

```shell
sgdisk -h 1:2:EE sdcard.img
```
2019-09-22 22:00:51 +10:00
Jeff Sharkey
9c50b5e176 Parse hex code immediately to avoid SIGBUS.
On 32-bit devices we trigger SIGBUS by trying to copy around the
std::string, so parse it immediately to avoid trouble.

Test: manual with 32-bit binary
Bug: 73961200
Change-Id: I32028fd18a00f3a40d380145cb7a7874b758f5c4
2018-03-27 13:19:51 -06:00
Jeff Sharkey
d6f72efe5d Remember hex type to support MBR creation.
Before this patch, requesting a code like "0x0c00" would be flattened
to "0x0700" because it was translated through the GUID type table.

Callers creating MBR tables expect these codes to flow through without
this fidelity loss.  To support this, we stash away any provided hex
type and return it instead of doing a lookup.

Test: cts-tradefed run commandAndExit cts-dev --abi armeabi-v7a -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest
Bug: 63735902
Change-Id: If61407960c9ad1050e5f9031617d71d68f7820b4
2017-10-19 13:41:27 -06:00
Rod Smith
eed1122809 Version 1.0.2 release. 2017-07-26 21:15:59 -04:00
Rod Smith
503e9ada12 Initial commit of support for moving main partition table to arbitrary
location on disk (within limits based on existing partitions).
2017-07-21 21:48:13 -04:00
Aurimas Liutikas
6d5a8afcca Revert "Update external/gptfdisk to 1.0.1" am: bdbab02f71 am: 165c596ac3
am: fa990d2e3b

Change-Id: I88a6501b6dbc6b6682ac414a1aa590a11bbd3306
2017-03-07 21:46:12 +00:00
Aurimas Liutikas
bdbab02f71 Revert "Update external/gptfdisk to 1.0.1"
This reverts commit 74b7490a22.

This change caused a regression in fugu usb formatting.

Bug: 35217931
Test: None
Change-Id: I50c73bde912a7c941e1d67d41bfab02042db88eb
2017-03-07 09:51:00 -08:00
Aurimas Liutikas
38e853e544 Merge "Fix all warnings and enable -Werror for gptfdisk." am: 2c054ab90e am: 7424963b5b am: 8ca4df28c5
am: 2fd2c48cd3

Change-Id: I1060e62981950fa582e880d6aba6ca9e246587c3
2016-10-27 23:52:52 +00:00
Greg Hartman
2c2deeb032 Add an option to allow disk syncing to be turned off
Bug: 27795746

Change-Id: I47447a8467c409db526483ac7e4a9394cd68578a
(cherry picked from commit fd9b918d2e49de4b7b7568aaa39f7e179752766d)
2016-07-14 20:45:39 +00:00
Aurimas Liutikas
fcad060a1d Fix all warnings and enable -Werror for gptfdisk.
Bug: 26936282
Change-Id: Id7e9ec5e769e1abedc1d2e36bff2c5488b1c4b3e
2016-05-10 19:16:10 -07:00
Aurimas Liutikas
74b7490a22 Update external/gptfdisk to 1.0.1
Updates gpftdisk to the latest version 0.8.10 (ish) -> 1.0.1

The downstream patches should be uneffected.

Change-Id: I527678c0b24194f3947e360f0f38c45cfa3b0d1c
2016-05-10 18:53:54 -07:00
Rod Smith
c37c487bb9 Removed stray debugging message from "sgdisk -c" operation. 2016-04-13 09:12:10 -04:00
Roderick W. Smith
6aec1dcf15 Fixed bug in sgdisk that caused --largest-new/-N to fail if fed a
value of "0" for the partition number. (This should work, according to
the man page, and now it does.)
2015-10-18 15:56:31 -04:00
Roderick W. Smith
bdae070734 Fixed bug that caused sgdisk to not return an appropriate error code
(4) when it encountered write errors under some circumstances.
2015-10-17 18:37:07 -04:00
Roderick W. Smith
8017e083aa Changed -z and -Z behavior in sgdisk so that subsequent changes are
written even if -g is not included. Also some man page updates.
2015-04-24 21:39:20 -04:00
Roderick W. Smith
54f8fb17e6 Version 1.0.0 release! Added some type codes and the -O/--print-mbr
option for sgdisk.
2015-03-17 19:46:05 -04:00
Jeff Sharkey
d761ff5a2a Revert "Offer to print partition info in raw format."
This reverts commit 729f7bd5fe.
2015-02-28 19:18:39 -08:00
Jeff Sharkey
729f7bd5fe Offer to print partition info in raw format.
This raw format is easier for other scripts to parse.

Change-Id: I15b3011376e27c28fd40b9c3b2722a75bb8cde25
2015-02-23 16:41:48 -08:00
Jeff Sharkey
873988ad03 Compile gptfdisk for Android.
Build sgdisk command line tool for use on Android devices.  The
command line parsing is currently written using popt, which has been
deprecated for some time, and is replaced by GNOME's glib option
parser.

Instead of pulling in either of those dependencies, this change
adds a stub that implements just enough of popt to get things
working.

Change-Id: I619f8da2e413893b4ea015a5d9e48d42637e25c8
2015-02-21 13:31:03 -08:00
Roderick W. Smith
d28495e066 Can now pass "0" as partition number to -A, -c, -t, and -u commands in
sgdisk *IF* "0" was also used as a partition number in a preceding -n
command.
2014-03-02 11:37:20 -05:00
Roderick W. Smith
a345a92260 Refinements to new treatment of hybrid MBR and MBR conversions that
span the 2TiB boundary.
2014-02-22 12:12:32 -05:00
Roderick W. Smith
820d1d04a3 Fixed sgdisk problem when creating hybrid MBR with a partition that
ends beyond sector 2^32. Now refuses to create such partitions.
2014-02-20 13:25:22 -05:00
Roderick W. Smith
e3ee733ff8 Removed 0x8302 type code, since the Red Hat parted developers have
decided against using it.
2013-09-24 12:56:11 -04:00
srs5694
f5dfbfa418 Change to alignment code in sgdisk. 2013-02-14 20:47:14 -05:00
srs5694
0741fa21ac 0.8.6 release. 2013-01-09 12:55:40 -05:00
srs5694
e842bc1351 Fixed bug: >2TiB partition creation in sgdisk 2012-02-03 11:27:05 -05:00
srs5694
d1b11e8305 Fixed bug in reading GPTs with encoded header sizes other than 92 bytes. 2011-09-18 21:12:28 -04:00
srs5694
3860cbe1ca New files in support of version 0.8.0 2011-09-10 20:29:53 -04:00