source: patches/yaboot-1.3.17-stubfuncs-1.patch @ a54251a

clfs-3.0.0-systemdsystemd
Last change on this file since a54251a was 5c734c5, checked in by William Harrington <kb0iic@…>, 11 years ago

Add yaboot stubfuncs patch for ppc and ppc64 builds.

  • Property mode set to 100644
File size: 4.2 KB
RevLine 
[5c734c5]1Submitted By: William Harrington kb0iic at cross-lfs dot org
2Date: 2013-01-13
3Initial Package Version: 1.3.17
4Upstream Status: Unknown
5Origin: Gentoo x86 sys-boot yaboot files
6Description: Adds more stub functions for newer e2fsprogs.
7
8diff -Naur yaboot-1.3.17.orig/lib/malloc.c yaboot-1.3.17/lib/malloc.c
9--- yaboot-1.3.17.orig/lib/malloc.c     2011-10-18 04:11:10.000000000 +0000
10+++ yaboot-1.3.17/lib/malloc.c  2013-01-13 13:32:27.392764935 +0000
11@@ -64,6 +64,15 @@
12     return caddr;
13 }
14 
15+/* Calloc wrapper for malloc */
16+void *memset(void *s, int c, size_t n);
17+void *calloc(size_t nmemb, size_t size) {
18+       void *caddr;
19+       caddr = malloc(nmemb * size);
20+       memset(caddr, 0, nmemb * size);
21+       return caddr;
22+}
23+
24 /* Do not fall back to the malloc above as posix_memalign is needed by
25  * external libraries not yaboot */
26 int posix_memalign(void **memptr, size_t alignment, size_t size)
27diff -Naur yaboot-1.3.17.orig/lib/nonstd.c yaboot-1.3.17/lib/nonstd.c
28--- yaboot-1.3.17.orig/lib/nonstd.c     2011-10-18 04:11:10.000000000 +0000
29+++ yaboot-1.3.17/lib/nonstd.c  2013-01-13 13:32:27.396764906 +0000
30@@ -65,3 +65,178 @@
31 {
32        return NULL;
33 }
34+
35+// I tried to use prom functions for these...
36+int open(const char *pathname, int flags) {
37+       return (int) prom_open((char *)pathname);
38+}
39+
40+int open64(const char *pathname, int flags) {
41+       return (int) prom_open((char *)pathname);
42+}
43+
44+int __open64_2 (__const char *__path, int __oflag) {
45+       return (int) prom_open((char *)__path);
46+}
47+
48+int read(int fd, void *buf, size_t count) {
49+       return prom_read((void *)fd, buf, count);
50+}
51+
52+int write(int fd, void *buf, size_t count) {
53+       return prom_write((void *)fd, buf, count);
54+}
55+
56+int close(int fd) {
57+       prom_close((void *)fd);
58+       return 0;
59+}
60+
61+// No fsync, just assume we've sync'd
62+int fsync(int fd) {
63+       return 0;
64+}
65+
66+void exit(int status) {
67+       prom_exit();
68+}
69+
70+int __printf_chk(int flag, const char *format, ...) {
71+       va_list ap;
72+       va_start (ap, format);
73+       prom_vfprintf (prom_stdout, format, ap);
74+       va_end (ap);
75+
76+       return 0;
77+}
78+
79+int __sprintf_chk(char * str, int flag, size_t strlen, const char * format, ...) {
80+       va_list ap;
81+       va_start(ap, format);
82+       // No sprintf? :(
83+       va_end(ap);
84+       return 0;
85+
86+}
87+
88+int __fprintf_chk(FILE *stream, int flag, const char *format, ...) {
89+       va_list ap;
90+       va_start (ap, format);
91+       prom_vfprintf (prom_stdout, format, ap);
92+       va_end (ap);
93+
94+       return 0;
95+}
96+
97+void *memcpy(void *dest, const void *src, size_t n);
98+void *__memcpy_chk(void *dest, const void *src, size_t n, size_t destlen) {
99+       return memcpy(dest, src, n);
100+}
101+
102+// But these are all dummy functions
103+int __xstat64 (int __ver, const char *__filename, void *__stat_buf) {
104+       return 0;
105+}
106+
107+int stat64(const char *path, void *stat_buf) {
108+       return 0;
109+}
110+
111+int fstat64(int fildes, void *stat_buf) {
112+       return 0;
113+}
114+
115+int __fxstat64 (int __ver, int __filedesc, void *__stat_buf) {
116+       return 0;
117+}
118+
119+signed int random(void) {
120+       return 0;
121+}
122+
123+void srandom(unsigned int seed) {
124+       return;
125+}
126+
127+int rand(void) {
128+       return 0;
129+}
130+
131+void srand(unsigned int seed) {
132+       return;
133+}
134+
135+unsigned int sleep(unsigned int seconds) {
136+       return 0;
137+}
138+
139+int gettimeofday(void *tv, void *tz) {
140+       return 0;
141+}
142+
143+long sysconf(int name) {
144+       return 0;
145+}
146+
147+int getpagesize(void) {
148+       return 0;
149+}
150+
151+int gethostname(char *name, size_t len) {
152+       return 0;
153+}
154+
155+int getpid(void) {
156+       return 0;
157+}
158+
159+int getuid(void) {
160+       return 0;
161+}
162+
163+void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) {
164+       return;
165+}
166+
167+int * __errno_location(void) {
168+       return 0;
169+}
170+
171+int lseek(int fd, int offset, int whence) {
172+       return prom_lseek ((void *)fd, whence + offset);
173+}
174+
175+int lseek64(int fd, int offset, int whence) {
176+       return prom_lseek ((void *)fd, whence + offset);
177+}
178+
179+size_t fwrite(const void *ptr, size_t size, size_t nmemb, void *stream) {
180+       return 0;
181+}
182+
183+int ioctl(int d, int request, ...) {
184+       return 0;
185+}
186+
187+int fallocate(int fd, int mode, unsigned int offset, unsigned int len) {
188+       return 0;
189+}
190+
191+int uname(void *buf) {
192+       return 0;
193+}
194+
195+int setrlimit(int resource, void *rlim) {
196+       return 0;
197+}
198+
199+unsigned long long int strtoull(const char *nptr, char **endptr, int base) {
200+       return 0;
201+}
202+
203+int getrlimit(int resource, void *rlim) {
204+       return 0;
205+}
206+
207+int stderr = 0;
208+int perror = 0;
Note: See TracBrowser for help on using the repository browser.