1 |
Mark Knecht wrote: |
2 |
> Hi, |
3 |
> Probably no one has tried his but so far I cannot get it to build. |
4 |
> It does build on one of my 32-bit Intel machines: |
5 |
|
6 |
this is a major hack. It compiles, but I don't guarantee that it won't eat |
7 |
your harddrive. It reads my scsi drive OK, but it has the size wrong. |
8 |
However, the same thing happens when compiled in a 32-bit chroot. |
9 |
|
10 |
Also note, that mac-fdisk isn't even marked ~amd64... |
11 |
|
12 |
If this gets you up and running, I might submit it to b.g.o .. but I'm |
13 |
feeling lazy tonight ;-) |
14 |
|
15 |
Kludge Steps without making an overlay ebuild (someone else is free to |
16 |
accomplish that): |
17 |
|
18 |
0. save everything below "cut here" into the file /tmp/mac_fdisk.patch |
19 |
1. emerge with FEATURES=keepwork |
20 |
$ FEATURES=keepwork emerge mac-fdisk |
21 |
2. when it fails, go into the work dir: |
22 |
$ cd /var/tmp/portage/mac-fdisk*/work/mac-fdisk-0.1 |
23 |
3. apply the patch: |
24 |
$ patch -p1 < /tmp/mac_fdisk.patch |
25 |
4. redo the emerge: |
26 |
$ FEATURES=keepwork emerge mac-fdisk |
27 |
5. Use the new possibly broken mac-fdisk. |
28 |
$ mac-fdisk |
29 |
$ pmac-fdisk |
30 |
|
31 |
--cut here-- |
32 |
diff -ru mac-fdisk-0.1/fdisklabel.c /tmp/mac-fdisk-0.1/fdisklabel.c |
33 |
--- mac-fdisk-0.1/fdisklabel.c 2005-10-19 18:21:03.000000000 -0400 |
34 |
+++ /tmp/mac-fdisk-0.1/fdisklabel.c 2005-10-19 18:15:37.000000000 -0400 |
35 |
@@ -68,7 +68,7 @@ |
36 |
static int bsd_readlabel (struct partition *p, struct disklabel *d); |
37 |
static int bsd_writelabel (struct partition *p, struct disklabel *d); |
38 |
static void sync_disks (void); |
39 |
-#if defined (i386) |
40 |
+#if defined (i386) || defined (__x86_64__) |
41 |
static int bsd_translate_fstype (int linux_type); |
42 |
static void bsd_link_part (void); |
43 |
#endif |
44 |
@@ -78,7 +78,7 @@ |
45 |
|
46 |
static struct disklabel bsd_dlabel; |
47 |
static char buffer[BSD_BBSIZE]; |
48 |
-#if defined (i386) |
49 |
+#if defined (i386) || defined (__x86_64__) |
50 |
static struct partition *bsd_part; |
51 |
static int bsd_part_index; |
52 |
#endif |
53 |
@@ -95,13 +95,13 @@ |
54 |
" n add a new BSD partition\n" |
55 |
" p print BSD partition table\n" |
56 |
" q quit without saving changes\n" |
57 |
-#if defined (i386) |
58 |
+#if defined (i386) || defined (__x86_64__) |
59 |
" r return to main menu\n" |
60 |
#endif |
61 |
" s show complete disklabel\n" |
62 |
" t change a partition's filesystem id\n" |
63 |
" w write disklabel to disk\n" |
64 |
-#if defined (i386) |
65 |
+#if defined (i386) || defined (__x86_64__) |
66 |
" x link BSD partition to non-BSD partition" |
67 |
#endif |
68 |
); |
69 |
@@ -110,7 +110,7 @@ |
70 |
void |
71 |
bselect (void) |
72 |
{ |
73 |
-#if defined (i386) |
74 |
+#if defined (i386) || defined (__x86_64__) |
75 |
int t; |
76 |
|
77 |
for (t=0; t<4; t++) |
78 |
@@ -181,7 +181,7 @@ |
79 |
case 'w': |
80 |
bsd_write_disklabel (); |
81 |
break; |
82 |
-#if defined (i386) |
83 |
+#if defined (i386) || defined (__x86_64__) |
84 |
case 'r': |
85 |
return; |
86 |
case 'x': |
87 |
@@ -219,7 +219,7 @@ |
88 |
if (!bsd_check_new_partition (&i)) |
89 |
return; |
90 |
|
91 |
-#if defined (i386) |
92 |
+#if defined (i386) || defined (__x86_64__) |
93 |
begin = bsd_part -> start_sect; |
94 |
end = begin + bsd_part -> nr_sects - 1; |
95 |
#elif defined (__alpha__) || defined (__powerpc__) |
96 |
@@ -253,7 +253,7 @@ |
97 |
|
98 |
if (show_all) |
99 |
{ |
100 |
-#if defined (i386) |
101 |
+#if defined (i386) || defined (__x86_64__) |
102 |
fprintf(f, "# %s%d:\n", disk_device, bsd_part_index+1); |
103 |
#elif defined (__alpha__) || defined (__powerpc__) |
104 |
fprintf(f, "# %s:\n", disk_device); |
105 |
@@ -348,7 +348,7 @@ |
106 |
static void |
107 |
bsd_write_disklabel (void) |
108 |
{ |
109 |
-#if defined (i386) |
110 |
+#if defined (i386) || defined (__x86_64__) |
111 |
printf ("Writing disklabel to %s%d.\n", disk_device, bsd_part_index+1); |
112 |
bsd_writelabel (bsd_part, &bsd_dlabel); |
113 |
#elif defined (__alpha__) || defined (__powerpc__) |
114 |
@@ -362,7 +362,7 @@ |
115 |
{ |
116 |
char c; |
117 |
|
118 |
-#if defined (i386) |
119 |
+#if defined (i386) || defined (__x86_64__) |
120 |
fprintf (stderr, "%s%d contains no disklabel.\n", |
121 |
disk_device, bsd_part_index+1); |
122 |
#elif defined (__alpha__) || defined (__powerpc__) |
123 |
@@ -372,7 +372,7 @@ |
124 |
while (1) |
125 |
if ((c = tolower (read_char ("Do you want to create a disklabel? (y/n) "))) == 'y') |
126 |
{ |
127 |
-#if defined (i386) |
128 |
+#if defined (i386) || defined (__x86_64__) |
129 |
if (bsd_initlabel (bsd_part, &bsd_dlabel, bsd_part_index) == 1) |
130 |
#elif defined (__alpha__) || defined (__powerpc__) || defined (__mc68000__) |
131 |
if (bsd_initlabel (NULL, &bsd_dlabel, 0) == 1) |
132 |
@@ -380,9 +380,7 @@ |
133 |
{ |
134 |
bsd_print_disklabel (1); |
135 |
return 1; |
136 |
- } |
137 |
- else |
138 |
- return 0; |
139 |
+ } else {return(0);} |
140 |
} |
141 |
else if (c == 'n') |
142 |
return 0; |
143 |
@@ -503,7 +501,7 @@ |
144 |
|
145 |
bcopy (&dl, d, sizeof (struct disklabel)); |
146 |
|
147 |
-#if defined (i386) |
148 |
+#if defined (i386) || defined (__x86_64__) |
149 |
sector = bsd_part -> start_sect; |
150 |
#elif defined (__powerpc__) |
151 |
sector = 0; |
152 |
@@ -517,7 +515,7 @@ |
153 |
if (BSD_BBSIZE != write (fd, buffer, BSD_BBSIZE)) |
154 |
fatal (unable_to_write); |
155 |
|
156 |
-#if defined (i386) |
157 |
+#if defined (i386) || defined (__x86_64__) |
158 |
printf ("Bootstrap installed on %s%d.\n", disk_device, bsd_part_index+1); |
159 |
#elif defined (__alpha__) || defined (__powerpc__) |
160 |
printf ("Bootstrap installed on %s.\n", disk_device); |
161 |
@@ -621,7 +619,7 @@ |
162 |
d -> d_subtype = BSD_DSTYPE_INDOSPART & pindex; |
163 |
#endif |
164 |
|
165 |
-#if defined (i386) |
166 |
+#if defined (i386) || defined (__x86_64__) |
167 |
d -> d_flags = BSD_D_DOSPART; |
168 |
#else |
169 |
d -> d_flags = 0; |
170 |
@@ -644,7 +642,7 @@ |
171 |
d -> d_bbsize = BSD_BBSIZE; |
172 |
d -> d_sbsize = BSD_SBSIZE; |
173 |
|
174 |
-#if defined (i386) |
175 |
+#if defined (i386) || defined (__x86_64__) |
176 |
d -> d_npartitions = 4; |
177 |
pp = &d -> d_partitions[2]; /* Partition C should be the NetBSD partition */ |
178 |
pp -> p_offset = p -> start_sect; |
179 |
@@ -670,7 +668,7 @@ |
180 |
{ |
181 |
int t, sector; |
182 |
|
183 |
-#if defined (i386) |
184 |
+#if defined (i386) || defined (__x86_64__) |
185 |
sector = p -> start_sect; |
186 |
#elif defined (__alpha__) || defined (__powerpc__) |
187 |
sector = 0; |
188 |
@@ -704,7 +702,7 @@ |
189 |
{ |
190 |
int sector; |
191 |
|
192 |
-#if defined (i386) |
193 |
+#if defined (i386) || defined (__x86_64__) |
194 |
sector = p -> start_sect + BSD_LABELSECTOR; |
195 |
#elif defined (__alpha__) || defined (__powerpc__) |
196 |
sector = BSD_LABELSECTOR; |
197 |
@@ -745,7 +743,7 @@ |
198 |
sleep (4); |
199 |
} |
200 |
|
201 |
-#if defined (i386) |
202 |
+#if defined (i386) || defined (__x86_64__) |
203 |
static int |
204 |
bsd_translate_fstype (int linux_type) |
205 |
{ |
206 |
diff -ru mac-fdisk-0.1/fdisklabel.h /tmp/mac-fdisk-0.1/fdisklabel.h |
207 |
--- mac-fdisk-0.1/fdisklabel.h 2005-10-19 18:21:03.000000000 -0400 |
208 |
+++ /tmp/mac-fdisk-0.1/fdisklabel.h 2005-10-19 18:10:31.000000000 -0400 |
209 |
@@ -58,6 +58,11 @@ |
210 |
#define BSD_LABELOFFSET 0 |
211 |
#define BSD_BBSIZE 0 |
212 |
#define BSD_SBSIZE 0 |
213 |
+#elif defined (__x86_64__) |
214 |
+#define BSD_LABELSECTOR 1 |
215 |
+#define BSD_LABELOFFSET 0 |
216 |
+#define BSD_BBSIZE 8192 /* size of boot area, with label */ |
217 |
+#define BSD_SBSIZE 8192 /* max size of fs superblock */ |
218 |
#else |
219 |
#error unknown architecture |
220 |
#endif |
221 |
-- |
222 |
gentoo-amd64@g.o mailing list |