Permalink
Browse files

HVM-740 want a basic dmod for qemu

  • Loading branch information...
rmustacc committed Aug 6, 2012
1 parent d61d4b6 commit d145a69b03243d4ec0db78fd70ce2fd2ebcb8bea
Showing with 617 additions and 8 deletions.
  1. +83 −8 Makefile.joyent
  2. +534 −0 qemu_mdb.c
View
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011 Joyent, Inc.
+# Copyright (c) 2012 Joyent, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -20,31 +20,106 @@
# THE SOFTWARE.
#
-KERNEL_SOURCE=$(PWD)/../../illumos
-CTFBINDIR=$(KERNEL_SOURCE)/usr/src/tools/proto/*/opt/onbld/bin/i386
+PROTO_AREA = $(PWD)/../../../proto
+KERNEL_SOURCE = $(PWD)/../../illumos
+MDB_SOURCE = $(KERNEL_SOURCE)/usr/src/cmd/mdb
+CTFBINDIR= $(KERNEL_SOURCE)/usr/src/tools/proto/*/opt/onbld/bin/i386
+CSTYLE = $(KERNEL_SOURCE)/usr/src/tools/scripts/cstyle
+CC = $(PROTO_AREA)/usr/bin/gcc
-world: config-host.mak
- echo "Building world"
- PATH=$(CTFBINDIR):$(PATH) V=1 gmake all
+QEMU_CPPFLAGS = \
+ -DTARGET_PHYS_ADDR_BITS=64 \
+ -D__EXTENSIONS__
+
+DMOD_CPPFLAGS = \
+ $(QEMU_CPPFLAGS) \
+ -D_KERNEL \
+ -DTEXT_DOMAIN="SUNW_OST_OSCMD" \
+ -D_TS_ERRNO \
+ -D_ELF64 \
+ -Ui386 \
+ -U__i386 \
+ -isystem $(PROTO_AREA)/usr/include \
+ -I. \
+ -Ihw
+
+ALWAYS_CFLAGS = \
+ -fident \
+ -fno-builtin \
+ -nodefaultlibs \
+ -Wall \
+ -Werror \
+ -fno-inline-functions
+
+USER_CFLAGS = \
+ -finline \
+ -gdwarf-2 \
+ -std=gnu89
+
+DMOD_CFLAGS = \
+ $(ALWAYS_CFLAGS) \
+ $(USER_CFLAGS) \
+ -m64 \
+ -fno-strict-aliasing \
+ -fno-unit-at-a-time \
+ -fno-optimize-sibling-calls \
+ -O2 \
+ -fno-inline-small-functions \
+ -fno-inline-functions-called-once \
+ -mtune=opteron \
+ -ffreestanding \
+ -fPIC
+
+DMOD_LDFLAGS = \
+ -m64 \
+ -shared \
+ -nodefaultlibs \
+ -Wl,-M$(KERNEL_SOURCE)/usr/src/common/mapfiles/common/map.pagealign \
+ -Wl,-M$(KERNEL_SOURCE)/usr/src/common/mapfiles/common/map.noexdata \
+ -Wl,-ztext \
+ -Wl,-zdefs \
+ -Wl,-M$(MDB_SOURCE)/common/modules/conf/mapfile-extern \
+ -L$(PROTO_AREA)/lib \
+ -L$(PROTO_AREA)/usr/lib
+
+DMOD_LIBS = \
+ -lc
+
+DMOD_SRCS = \
+ qemu_mdb.c
+
+world: qemu qemu.so
config-host.mak:
PATH=$(CTFBINDIR):$(PATH) CONFIGURE_ONLY=1 ./build.sh
+qemu: config-host.mak
+ echo "Building world"
+ PATH=$(CTFBINDIR):$(PATH) V=1 gmake all
+
+qemu.so: $(DMOD_SRCS)
+ $(CC) $(DMOD_CPPFLAGS) $(DMOD_CFLAGS) $(DMOD_LDFLAGS) -o $@ \
+ $(DMOD_SRCS) $(DMOD_LIBS)
+
+
update:
git pull --rebase
manifest:
cp manifest $(DESTDIR)/$(DESTNAME)
install: world
- echo "Building install"
DESTDIR=$(DESTDIR) PATH=$(CTFBINDIR):$(PATH) V=1 gmake install
clean:
gmake clean
+ rm -f qemu.so
xref:
find . -type f -name '*.[ch]' > cscope.files
cscope-fast -bq
-.PHONY: manifest xref
+check:
+ $(CSTYLE) qemu_mdb.c
+
+.PHONY: manifest xref check clean
Oops, something went wrong.

0 comments on commit d145a69

Please sign in to comment.