--- /dev/null
+typedef long unsigned int size_t;
+extern __inline __attribute__ ((__always_inline__))
+ __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__))
+void *
+ __attribute__ ((__nothrow__, __leaf__)) memcpy(void *__restrict __dest,
+ const void *__restrict __src,
+ size_t __len)
+{
+ return __builtin___memcpy_chk(__dest, __src, __len,
+ __builtin_object_size(__dest, 0));
+}
+
+struct apartition {
+ unsigned char flag;
+ char id[3];
+ unsigned long start;
+ unsigned long size;
+} __attribute((packed));
+struct rootsector {
+ char unused[0x156];
+ struct apartition icdpart[8];
+ char unused2[0xc];
+ struct apartition part[4];
+} __attribute((packed));
+typedef struct _PARTITION {
+ unsigned long start;
+ char id[4];
+ unsigned long rootsec;
+} PARTITION;
+extern int partitions;
+extern PARTITION part_table[64];
+static void PART2diskpart(PARTITION * cp, struct apartition *dp,
+ unsigned long relto)
+{
+ memcpy(dp->id, cp->id, 3);
+}
+
+void put_boot(int first_ext, int last_ext, PARTITION * master_XGM)
+{
+ char buffer[512];
+ struct rootsector *rs = (struct rootsector *)buffer;
+ struct apartition *pi;
+ int i, bootable;
+ PARTITION cont_XGM;
+ pi = &rs->part[0];
+ for (i = 0; i < partitions; ++i) {
+ if (i == first_ext) {
+ PART2diskpart(master_XGM, pi, 0);
+ PART2diskpart(&part_table[i], &rs->part[0],
+ part_table[i].rootsec);
+ if (i == last_ext) {
+ PART2diskpart(&cont_XGM, &rs->part[1],
+ master_XGM->start);
+ }
+ }
+ }
+}