# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../dietlibc/patches/pkg_lilo.patch
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2004 Clifford Wolf
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
                                                                                                                                                                                                                    
--- lilo-22.5.6/partition.h.orig	Fri Jun  6 19:07:45 2003
+++ lilo-22.5.6/partition.h	Fri Sep  5 17:42:53 2003
@@ -19,9 +19,9 @@
 enum {PTW_OKAY=0, PTW_DOS=1, PTW_OS2=2, PTW_SWAP, PTW_XFS,
 		PTW_mask=7, PTW_NTFS=8};
 
-#if 1
-
 #define LLSECTORSIZE ((long long)SECTOR_SIZE)
+
+#ifndef __dietlibc__
 
        loff_t llseek(unsigned int fd, loff_t offs, unsigned int whence);
 
--- lilo-22.5.6/partition.c.orig	Fri Sep  5 17:41:58 2003
+++ lilo-22.5.6/partition.c	Fri Sep  5 17:47:18 2003
@@ -9,7 +9,9 @@
 
 */
 
-
+#ifdef __dietlibc__
+#include <asm/posix_types.h>
+#endif
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -35,7 +37,7 @@
 #include "loader.h"
 
 
-       
+#ifndef __dietlibc__       
        _syscall5(int,  _llseek,  uint,  fd, ulong, hi, ulong, lo,
        loff_t *, res, uint, wh);
 
@@ -48,6 +50,7 @@
        	return _llseek(fd, offs>>32, offs, &res, whence) < 0  ?
        			 (loff_t)(-1) : res;
        }
+#endif
 
 static
 int anywhere(void *buf, unsigned char *str)
@@ -185,8 +188,13 @@
     }
     i=5;
     while (i<=pe && base) {
+#ifdef __dietlibc__
+        if (lseek(fd, LLSECTORSIZE*(base+second) + PART_TABLE_OFFSET, SEEK_SET) < 0)
+            die("secondary lseek failed");
+#else
         if (llseek(fd, LLSECTORSIZE*(base+second) + PART_TABLE_OFFSET, SEEK_SET) < 0)
             die("secondary llseek failed");
+#endif
 	if (read(fd, part_table, sizeof(part_table)) != sizeof(part_table)) die("secondary read pt failed");
 	if ( read(fd, &boot_sig, sizeof(boot_sig)) != sizeof(boot_sig)  ||
 	    boot_sig != BOOT_SIGNATURE ) die("read second boot signature failed");
@@ -609,7 +617,11 @@
     	if (pt[count].sys_ind && pt[count].boot_ind != flag) {
     	    pt[count].boot_ind = flag;
 	    printf("pt[%d] -> %2x\n", count+1, (int)flag);
+#ifdef __dietlibc__
+	    if (lseek(fd, daddr[count], SEEK_SET) < 0) die("PT lseek failed");
+#else
 	    if (llseek(fd, daddr[count], SEEK_SET) < 0) die("PT llseek failed");
+#endif
 	    if (!test)
 	    if (write(fd, &pt[count], sizeof(pt[0])) != sizeof(pt[0]) )
 		die("PT write failure");
@@ -793,8 +805,13 @@
     if (max>0)
     while (base) {
     	daddr = LLSECTORSIZE*(base+second) + PART_TABLE_OFFSET;
+#ifdef __dietlibc__
+        if (lseek(fd, daddr, SEEK_SET) < 0)
+            die("secondary lseek failed");
+#else
         if (llseek(fd, daddr, SEEK_SET) < 0)
             die("secondary llseek failed");
+#endif
 	if (read(fd, pt, sizeof(pt)) != sizeof(pt)) die("secondary read pt failed");
 	if ( read(fd, &boot_sig, sizeof(boot_sig)) != sizeof(boot_sig)  ||
 	    boot_sig != BOOT_SIGNATURE ) die("read second boot signature failed");
--- lilo-22.5.6/Makefile~	Mon Jun 30 03:45:19 2003
+++ lilo-22.5.6/Makefile	Fri Sep  5 18:27:38 2003
@@ -51,7 +51,7 @@
 #   XL_SECS=n	  Support for extra large (non-standard) floppies.
 
 CONFIG=-DBDATA -DDSECS=3 -DEVMS -DIGNORECASE -DLVM -DONE_SHOT -DPASS160 \
-   -DREISERFS -DREWRITE_TABLE -DSOLO_CHAIN -DVERSION -DVIRTUAL
+   -DREWRITE_TABLE -DSOLO_CHAIN -DVERSION -DVIRTUAL
 
 # set the compiler optimization level
 
--- lilo-22.5.6/boot.c~	Tue Jun 24 22:23:10 2003
+++ lilo-22.5.6/boot.c	Fri Sep  5 18:35:27 2003
@@ -17,7 +17,11 @@
 #include <ctype.h>
 #include <fcntl.h>
 #include <errno.h>
+#ifdef __dietlibc__
+#include <linux/a.out.h>
+#else
 #include <a.out.h>
+#endif
 #include <sys/stat.h>
 
 #include "config.h"
--- lilo-22.5.6/bsect.c.orig	Mon Jun 30 02:34:44 2003
+++ lilo-22.5.6/bsect.c	Fri Sep  5 18:41:20 2003
@@ -12,7 +12,9 @@
 
 #include <unistd.h>
 #include <sys/types.h>
+#ifndef __dietlibc__
 #include <sys/statfs.h>
+#endif
 #include <sys/stat.h>
 #include <stdio.h>
 #include <fcntl.h>
--- lilo-22.5.6/partition.c~	Fri Sep  5 17:47:18 2003
+++ lilo-22.5.6/partition.c	Fri Sep  5 18:44:06 2003
@@ -19,7 +19,11 @@
 #include <ctype.h>
 #include <fcntl.h>
 #include <errno.h>
+#ifdef __dietlibc__
+#include <linux/a.out.h>
+#else
 #include <a.out.h>
+#endif
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <asm/unistd.h>
--- lilo-22.5.6/edit.c.orig	Sun Feb 23 19:14:12 2003
+++ lilo-22.5.6/edit.c	Mon Sep  8 07:48:20 2003
@@ -10,7 +10,11 @@
 
 #include <unistd.h>
 #include <sys/types.h>
+#ifdef __dietlibc__
+#include <sys/vfs.h>
+#else
 #include <sys/statfs.h>
+#endif
 #include <sys/stat.h>
 #include <stdio.h>
 #include <stdlib.h>