1
1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## sparc-new-label.dpatch by <fabbione@vultus5.int.fabbione.net>
2
## sparc-new-label.dpatch by David S. Miller and
3
## Fabio M. Di Nitto <fabbione@ubuntu.com>
4
5
## All lines beginning with `## DP:' are a description of the patch.
6
## DP: Fix sparc disk label generation. This is required for LDOM and
7
## DP: parallel installations with Solaris 10.
8
diff -urNad parted-1.7.1~/libparted/labels/sun.c parted-1.7.1/libparted/labels/sun.c
9
--- parted-1.7.1~/libparted/labels/sun.c 2007-07-02 07:21:20.000000000 +0200
10
+++ parted-1.7.1/libparted/labels/sun.c 2007-07-02 07:22:37.000000000 +0200
10
diff -urNad parted-1.8.8.git.2008.03.24~/libparted/labels/sun.c parted-1.8.8.git.2008.03.24/libparted/labels/sun.c
11
--- parted-1.8.8.git.2008.03.24~/libparted/labels/sun.c 2008-06-24 12:52:11.000000000 +0100
12
+++ parted-1.8.8.git.2008.03.24/libparted/labels/sun.c 2008-06-24 12:56:06.000000000 +0100
12
14
#define SUN_DISK_MAGIC 0xDABE /* Disk magic number */
13
15
#define SUN_DISK_MAXPARTITIONS 8
36
38
#define WHOLE_DISK_PART 2 /* as in 0, 1, 2 (3rd partition) */
37
39
-#define LINUX_SWAP_ID 0x82
40
u_int32_t start_cylinder; /* where the part starts... */
42
} __attribute__ ((packed)) SunRawPartition;
41
typedef struct _SunRawPartition SunRawPartition;
42
-typedef struct _SunPartitionInfo SunPartitionInfo;
43
+typedef struct _SunPartInfo SunPartInfo;
44
typedef struct _SunRawLabel SunRawLabel;
45
typedef struct _SunPartitionData SunPartitionData;
46
typedef struct _SunDiskData SunDiskData;
48
u_int32_t num_sectors; /* ...and it's length */
51
-struct __attribute__ ((packed)) _SunPartitionInfo {
46
53
- u_int8_t id; /* Partition type */
48
55
- u_int8_t flags; /* Partition flags */
49
-} __attribute__ ((packed)) SunPartitionInfo;
50
+ u_int16_t tag; /* Tagged type */
56
+struct __attribute__ ((packed)) _SunPartInfo {
57
+ u_int16_t tag; /* Tagged type */
51
58
+ u_int16_t flags; /* Partition flags */
52
+} __attribute__ ((packed)) SunPartInfo;
54
61
+#define SUN_LABEL_ID_SIZE 128
55
62
+#define SUN_VOLUME_ID_SIZE 8
57
64
+#define SUN_LABEL_VERSION 0x00000001
58
65
+#define SUN_LABEL_SANE 0x600ddeee
67
struct __attribute__ ((packed)) _SunRawLabel {
61
68
- char info[128]; /* Informative text string */
62
69
- u_int8_t spare0[14];
63
70
- SunPartitionInfo infos[SUN_DISK_MAXPARTITIONS];
65
72
+ char label_id[SUN_LABEL_ID_SIZE]; /* Informative text string */
66
73
+ u_int32_t version;
67
74
+ char volume_id[SUN_VOLUME_ID_SIZE];
69
76
+ SunPartInfo infos[SUN_DISK_MAXPARTITIONS];
71
+ u_int32_t bootinfo[3];
74
+ u_int32_t part_timestamps[SUN_DISK_MAXPARTITIONS];
75
+ u_int32_t write_reinstruct;
76
+ u_int32_t read_reinstruct;
78
+ u_int32_t bootinfo[3];
81
+ u_int32_t part_timestamps[SUN_DISK_MAXPARTITIONS];
82
+ u_int32_t write_reinstruct;
83
+ u_int32_t read_reinstruct;
77
84
+ u_int8_t pad2[148];
78
85
u_int16_t rspeed; /* Disk rotational speed */
79
86
u_int16_t pcylcount; /* Physical cylinder count */
80
87
u_int16_t sparecyl; /* extra sects per cylinder */
83
90
/* #gentoo-sparc people agree that nacyl = 0 is the best option */
84
91
label->magic = PED_CPU_TO_BE16 (SUN_DISK_MAGIC);
104
111
"GNU Parted Custom cyl %d alt %d hd %d sec %d",
105
112
PED_BE16_TO_CPU(label->ncyl),
106
113
PED_BE16_TO_CPU(label->nacyl),
108
115
for (i = 0; i < SUN_DISK_MAXPARTITIONS; i++) {
109
116
if (!PED_BE32_TO_CPU(label->partitions[i].num_sectors))
142
149
&& PED_BE16_TO_CPU (old_label.magic) == SUN_DISK_MAGIC)
143
150
memcpy (&sun_specific->raw_label, &old_label, 512);
146
153
memset (label->partitions, 0,
147
154
sizeof (SunRawPartition) * SUN_DISK_MAXPARTITIONS);
148
155
memset (label->infos, 0,