All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Allow use of a C library in Mini-OS
       [not found] <E1Fh7Rx-00087F-4v@host-192-168-0-1-bcn-london>
@ 2006-05-19 18:07 ` John D. Ramsdell
  0 siblings, 0 replies; only message in thread
From: John D. Ramsdell @ 2006-05-19 18:07 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

I noticed many improvements have been made to Mini-OS, and one can now
easily integrate an application into Mini-OS as long as the
application does not depend on a C library.  My thanks go to those
responsible.

I'd like to make it so that the following command builds libminios.a
using a cross-compiler that provides a full C library.

$ $PATH=${COMP_HOME}/bin:$PATH make CPPFLAGS=-DHAVE_LIBC libminios.a

The enclosed patch makes small changes to three files.  The Makefile
is changed so that the libminios.a target depends on the links target,
and lib/printf.c and lib/string.c are changed so their content is
omitted when HAVE_LIBC is defined.

John


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Allow use of a C library in Mini-OS --]
[-- Type: text/x-patch, Size: 2744 bytes --]

Only in xen-unstable/extras/mini-os/console: console.o
Only in xen-unstable/extras/mini-os/console: xencons_ring.o
Only in xen-unstable/extras/mini-os: events.o
Only in xen-unstable/extras/mini-os: hypervisor.o
Only in xen-unstable/extras/mini-os/include: xen
Only in xen-unstable/extras/mini-os: kernel.o
Only in xen-unstable/extras/mini-os/lib: math.o
diff -ur oxen-unstable/extras/mini-os/lib/printf.c xen-unstable/extras/mini-os/lib/printf.c
--- oxen-unstable/extras/mini-os/lib/printf.c	2006-05-19 01:02:48.000000000 -0400
+++ xen-unstable/extras/mini-os/lib/printf.c	2006-05-19 11:55:54.000000000 -0400
@@ -54,6 +54,8 @@
  * $FreeBSD: src/sys/libkern/divdi3.c,v 1.6 1999/08/28 00:46:31 peter Exp $
  */
 
+#if !defined HAVE_LIBC
+
 #include <os.h>
 #include <types.h>
 #include <hypervisor.h>
@@ -789,4 +791,4 @@
 	return i;
 }
 
-
+#endif
Only in xen-unstable/extras/mini-os/lib: printf.c~
Only in xen-unstable/extras/mini-os/lib: printf.o
diff -ur oxen-unstable/extras/mini-os/lib/string.c xen-unstable/extras/mini-os/lib/string.c
--- oxen-unstable/extras/mini-os/lib/string.c	2006-05-19 01:02:48.000000000 -0400
+++ xen-unstable/extras/mini-os/lib/string.c	2006-05-19 11:56:11.000000000 -0400
@@ -18,6 +18,8 @@
  ****************************************************************************
  */
 
+#if !defined HAVE_LIBC
+
 #include <os.h>
 #include <types.h>
 #include <lib.h>
@@ -153,3 +155,5 @@
         }
         return NULL;
 }
+
+#endif
Only in xen-unstable/extras/mini-os/lib: string.c~
Only in xen-unstable/extras/mini-os/lib: string.o
Only in xen-unstable/extras/mini-os/lib: xmalloc.o
Only in xen-unstable/extras/mini-os: libminios.a
diff -ur oxen-unstable/extras/mini-os/Makefile xen-unstable/extras/mini-os/Makefile
--- oxen-unstable/extras/mini-os/Makefile	2006-05-19 01:02:47.000000000 -0400
+++ xen-unstable/extras/mini-os/Makefile	2006-05-19 12:04:54.000000000 -0400
@@ -12,6 +12,7 @@
 override CPPFLAGS := -Iinclude $(CPPFLAGS)
 ASFLAGS = -D__ASSEMBLY__
 
+LDLIBS =  -L. -lminios
 LDFLAGS := -N -T minios-$(TARGET_ARCH).lds
 
 ifeq ($(TARGET_ARCH),x86_32)
@@ -49,11 +50,11 @@
 links:
 	[ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
 
-libminios.a: $(OBJS) $(HEAD)
+libminios.a: links $(OBJS) $(HEAD)
 	ar r libminios.a $(HEAD) $(OBJS)
 
 $(TARGET): links libminios.a $(HEAD)
-	$(LD) $(LDFLAGS) $(HEAD) -L. -lminios -o $@.elf
+	$(LD) $(LDFLAGS) $(HEAD) $(LDLIBS) -o $@.elf
 	gzip -f -9 -c $@.elf >$@.gz
 
 .PHONY: clean
Only in xen-unstable/extras/mini-os: mm.o
Only in xen-unstable/extras/mini-os: sched.o
Only in xen-unstable/extras/mini-os: time.o
Only in xen-unstable/extras/mini-os: traps.o
Only in xen-unstable/extras/mini-os: x86_32.o
Only in xen-unstable/extras/mini-os/xenbus: xenbus.o

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-19 18:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1Fh7Rx-00087F-4v@host-192-168-0-1-bcn-london>
2006-05-19 18:07 ` [PATCH] Allow use of a C library in Mini-OS John D. Ramsdell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.