# build newlib, minios, the pci and xen libraries. cd /root/xen/xen-4.0-testing.hg/stubdom/c make c-stubdom # put all the minios object files into an archive MO=/root/xen/xen-4.0-testing.hg/stubdom/mini-os-x86_32-c ar cr /root/xen/xen-4.0-testing.hg/extras/mini-os/minios.a \ $MO/blkfront.o $MO/events.o $MO/fbfront.o $MO/fs-front.o $MO/gntmap.o \ $MO/gnttab.o $MO/hypervisor.o $MO/kernel.o $MO/lock.o $MO/main.o \ $MO/mm.o $MO/netfront.o $MO/pcifront.o $MO/sched.o $MO/lib/ctype.o \ $MO/lib/math.o $MO/lib/printf.o $MO/lib/stack_chk_fail.o \ $MO/lib/string.o $MO/lib/sys.o $MO/lib/xmalloc.o $MO/lib/xs.o \ $MO/xenbus/xenbus.o $MO/console/console.o $MO/console/xencons_ring.o ############################ D=/root/xen/xen-4.0-testing.hg/stubdom GPP=$D/cross-root-i686/bin/i686-xen-elf-g++ LD=$D/cross-root-i686/bin/i686-xen-elf-ld $GPP c/main.cpp -c -o c/main.o $GPP c/mi.cpp -c -o c/mi.o $LD -r -d \ -m elf_i386 \ /root/xen/xen-4.0-testing.hg/stubdom/mini-os-x86_32-c/arch/x86/x86_32.o \ -\( \ /root/xen/xen-4.0-testing.hg/stubdom/c/main.o \ /root/xen/xen-4.0-testing.hg/stubdom/c/mi.o \ /root/xen/xen-4.0-testing.hg/extras/mini-os/app.lds \ --undefined main \ -\) \ -whole-archive \ /root/xen/xen-4.0-testing.hg/extras/mini-os/minios.a \ -no-whole-archive \ /root/xen/xen-4.0-testing.hg/stubdom/mini-os-x86_32-c/lwip.a \ /root/xen/xen-4.0-testing.hg/stubdom/libxc-x86_32/libxenguest.a \ /root/xen/xen-4.0-testing.hg/stubdom/libxc-x86_32/libxenctrl.a \ /root/xen/xen-4.0-testing.hg/stubdom/mini-os-x86_32-c/arch/x86/libx86_32.a \ -L$D/cross-root-i686/i686-xen-elf/lib \ -lstdc++ \ -lc -lm -lz -lpci \ -L$D/cross-root-i686/lib/gcc/i686-xen-elf/4.5.0 \ -lgcc \ -o /root/xen/xen-4.0-testing.hg/stubdom/mini-os-x86_32-c/mini-os.o # move around code in .o files into their correct sections $LD \ -m elf_i386 \ $D/mini-os-x86_32-c/mini-os.o \ -T /root/xen/xen-4.0-testing.hg/extras/mini-os/arch/x86/minios-x86_32.lds \ -o $D/mini-os-x86_32-c/mini-os gzip -f -9 -c $D/mini-os-x86_32-c/mini-os >$D/mini-os-x86_32-c/mini-os.gz ###### ## ## The following has to be defined because newlib doesn't provide ## lseek and fstat correctly after the xen patches (which renames them). ## ## The domain crashes if linked with crt{begin,end}.o so instead ## declare the missing variable __dso_handle. ## extern off_t lseek64(int a, off_t b, int c); off_t lseek(int a, off_t b, int c) { return lseek64 (a, b, c); } int fstat64(int a, struct stat* b); int fstat(int a, struct stat* b) { return fstat64(a,b); } void *__dso_handle = 0; ### # I was using a cross compiler with a special libstdc++, built with the commands # below. Note that the directories here are local to my machine. cd /root/xen/xen-4.0-testing.hg/stubdom/build/binutils /home/larsr/test/i486-none-elf/build/binutils-2.20/configure \ --prefix=/root/xen/xen-4.0-testing.hg/stubdom/cross-root-i686 \ --target=i686-xen-elf --enable-interwork \ --enable-multilib --disable-nls --disable-shared --disable-threads \ --with-sysroot=/root/xen/xen-4.0-testing.hg/stubdom/cross-root-i686/i686-xen-elf --with-gcc --with-gnu-as --with-gnu-ld make -j8 && make install cd /root/xen/xen-4.0-testing.hg/stubdom/build/gcc /home/larsr/test/i486-none-elf/build/gcc-4.5.0/configure \ --prefix=/root/xen/xen-4.0-testing.hg/stubdom/cross-root-i686 \ --target=i686-xen-elf --enable-interwork \ --disable-multilib --enable-languages=c,c++ --with-newlib --disable-nls \ --disable-shared --disable-threads --with-gnu-as --with-gnu-ld \ --with-gmp=/home/larsr/test/i486-none-elf/build/gmp \ --with-mpfr=/home/larsr/test/i486-none-elf/build/mpfr \ --with-mpc=/home/larsr/test/i486-none-elf/build/mpc \ --with-sysroot=/root/xen/xen-4.0-testing.hg/extras/mini-os/include make -j8 && make install cd ../../
fredag 18 juni 2010
Compiling a C++ xen mini-os
Prenumerera på:
Kommentarer till inlägget (Atom)
Inga kommentarer:
Skicka en kommentar