Mini-OS developers:
I acquired a Core 2 Duo machine, and decided to see if I could get a
32-bit Mini-OS application running using a 64-bit hypervisor. I''m
running Fedora Core 6 for hardware platform x86_64 using its packaging
of the Xen hypervisor. The Mini-OS sources were obtained today from
xen-unstable.hg.
I built binutils 2.17, gcc 4.1.2, and newlib 1.5.0 with a target of
i386-elf, and installed them into $HOME/opt/i386-elf.
$ cd $HOME/opt/i386-elf
$ ls i386-elf/bin
ar as c++ g++ gcc ld nm objdump ranlib strip
[ramsdell@mm144697-pc i386-elf]$ ls bin
i386-elf-addr2line i386-elf-cpp i386-elf-gcov i386-elf-ranlib
i386-elf-ar i386-elf-g++ i386-elf-ld i386-elf-readelf
i386-elf-as i386-elf-gcc i386-elf-nm i386-elf-size
i386-elf-c++ i386-elf-gcc-4.1.2 i386-elf-objcopy i386-elf-strings
i386-elf-c++filt i386-elf-gccbug i386-elf-objdump i386-elf-strip
I first tried to build an application on top of Mini-OS, so I
attempted to build libminios.a with:
$ make CROSS_COMPILE=$HOME/opt/i386-elf/i386-elf/bin/ \
TARGET_ARCH=x86_32 CPPFLAGS=-DHAVE_LIBC libminios.a
I found there is no rule for the libminios.a target, or one for the
all target. Okay, lets get more conservative.
I decided to try to build just Mini-OS with:
$ make CROSS_COMPILE=$HOME/opt/i386-elf/i386-elf/bin/ TARGET_ARCH=x86_32
[ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
/home/ramsdell/opt/i386-elf/i386-elf/bin/gcc -fno-builtin -Wall -Werror
-Wredundant-decls -Wno-format -Wstrict-prototypes -Wnested-externs
-Wpointer-arith -Winline -D__XEN_INTERFACE_VERSION__=0x00030205 -g -m64
-mno-red-zone -fpic -fno-reorder-blocks -fno-asynchronous-unwind-tables
-I/home/ramsdell/scm/xen-unstable.hg/extras/mini-os/include
-I/home/ramsdell/scm/xen-unstable.hg/extras/mini-os/include/x86
-I/home/ramsdell/scm/xen-unstable.hg/extras/mini-os/include/x86/x86_64 -c
events.c -o events.o
events.c:1: sorry, unimplemented: 64-bit mode not compiled in
In file included from
/home/ramsdell/scm/xen-unstable.hg/extras/mini-os/include/x86/os.h:20,
from events.c:19:
/home/ramsdell/scm/xen-unstable.hg/extras/mini-os/include/hypervisor.h:19:30:
error: hypercall-x86_32.h: No such file or directory
cc1: warnings being treated as errors
In file included from events.c:22:
/home/ramsdell/scm/xen-unstable.hg/extras/mini-os/include/events.h: In function
''notify_remote_via_evtchn'':
/home/ramsdell/scm/xen-unstable.hg/extras/mini-os/include/events.h:45: warning:
implicit declaration of function ''HYPERVISOR_event_channel_op''
/home/ramsdell/scm/xen-unstable.hg/extras/mini-os/include/events.h:45: warning:
nested extern declaration of ''HYPERVISOR_event_channel_op''
make: *** [events.o] Error 1
$
Some how, setting TARGET_ARCH=x86_32 was not enough to convince the
makefile to think 32-bits. What was I supposed to do?
I decided to carefully read the makefiles in the Mini-OS directories.
I discovered that the one in the root directory calls for $(OBJCOPY).
When using a cross compiler, this variable evaluates to objcopy, but
the installation of a cross compiler does not produce a binary named
objcopy. When the target is i386-elf, it puts i386-elf-objcopy in the
bin directory where it is installed, but objcopy is not put the
i386-elf/bin directory. Is this makefile intended to be used with a
cross compiler? I''d gladly specify a target of i386-elf on the
command line if that helps.
I promise to submit a text document to be placed in the Mini-OS root
directory describing how to use its makefile with a cross compiler if
given the information need to complete this document by you all.
John
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
On 3/4/07 00:11, "John D. Ramsdell" <ramsdell@mitre.org> wrote:> I decided to carefully read the makefiles in the Mini-OS directories. > I discovered that the one in the root directory calls for $(OBJCOPY). > When using a cross compiler, this variable evaluates to objcopy, but > the installation of a cross compiler does not produce a binary named > objcopy. When the target is i386-elf, it puts i386-elf-objcopy in the > bin directory where it is installed, but objcopy is not put the > i386-elf/bin directory. Is this makefile intended to be used with a > cross compiler? I''d gladly specify a target of i386-elf on the > command line if that helps.I doubt anyone has ever cross-compiled the minios. I''d suggest making its build system more like Xen''s in terms of how it picks up the tool chain (Xen can be cross compiled). I have no specific pointers on how to do that. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
John D. Ramsdell
2007-Apr-03 11:08 UTC
Re: [Xen-devel] Mini-OS Makefile and Cross Compilation
The command in my previous post should have been: $ make CROSS_COMPILE=$HOME/opt/i386-elf/bin/i386-elf- TARGET_ARCH=x86_32 not this: $ make CROSS_COMPILE=$HOME/opt/i386-elf/i386-elf/bin/ TARGET_ARCH=x86_32 This should allow the makefile to find the correct version of objcopy. Keir Fraser <Keir.Fraser@cl.cam.ac.uk> writes:> I doubt anyone has ever cross-compiled the minios. I''d suggest > making its build system more like Xen''s in terms of how it picks up > the tool chain (Xen can be cross compiled). I have no specific > pointers on how to do that.Last summer, I cross-compiled a 32-bit minios for 32-bit Xen so that I could build an application in the Lua scripting language. The interpreter required a C library, so I used newlib. On a 32-bit machine, I can still build Mini-OS with a cross compiler with: $ make CROSS_COMPILE=$HOME/opt/cross/bin/i386-elf- The problem seems to be when specifying a different target architecture. I also can no longer build a minios library to link with the application, I''m not worried about that now. By the way, the latest version of newlib, 1.15.0, no longer needs to be patched for use with Mini-OS. John _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel