# Makefile.ia32.i386, Copyright 1998 (c) by Lukas Ruf, # Swiss Federal Institute of Technology, # Computer Engineering and Networks Laboratory. # # TOPSY -- A Teachable Operating System. # Implementation of a tiny and simple # micro kernel for teaching purposes. # # For further information, please visit http://www.tik.ee.ethz.ch/~topsy # # This software is provided under the terms of the GNU General Public Licence. # A full copy of the GNU GPL is provided in the file COPYING found in the # development root of Topsy. # # # File: $Source: /usr/drwho/vault/cvs/topsy/Topsy/Makefiles/Makefile.ia32.i386,v $ # Author(s): # Affiliation: ETH Zuerich, TIK # Version: $Revision: 1.17 $ # Creation Date: # Last Date of Change: $Date: 2000/06/06 17:36:45 $ by: $Author: ruf $ # # # $Log: Makefile.ia32.i386,v $ # Revision 1.17 2000/06/06 17:36:45 ruf # Bug fixed userdisk: # # Revision 1.16 2000/06/06 12:07:53 ruf # userdisk to 1.4MB # # Revision 1.15 2000/06/05 15:06:15 ruf # *** empty log message *** # # Revision 1.14 1999/12/15 15:15:41 gfa # *** empty log message *** # # Revision 1.13 1999/12/13 21:48:29 ruf # GNU General Public Licence Update # # Revision 1.12 1999/10/23 19:07:11 jeker # added Makefile.SimOS.mips and did some code cleanup # # Revision 1.11 1999/09/23 06:48:51 gfa # dd order for ia32 floppy image fixed # # Revision 1.10 1999/09/22 13:23:37 gfa # *** empty log message *** # # Revision 1.9 1999/09/21 21:54:11 gfa # *** empty log message *** # # Revision 1.8 1999/09/20 13:11:20 gfa # *** empty log message *** # # Revision 1.7 1999/09/17 07:55:03 gfa # new automatic version string # # Revision 1.6 1999/09/11 12:14:52 gfa # precaution for gcc 2.95 # # Revision 1.5 1999/06/12 17:16:43 gfa # a32 bootimage target added # # Revision 1.4 1999/06/12 16:54:36 gfa # linkscript typo... # # Revision 1.3 1999/06/10 15:10:54 jeker # cleaning up # # Revision 1.2 1999/06/10 13:15:43 jeker # cleaning up # # Revision 1.1 1999/06/06 20:54:52 jeker # putting everything together for Topsy 2.0 # # # ############################################################################### # machine dependent subdirectories for each module and folder for object files ARCH=ia32 # make procedures for the outside fast: version kernel user alldisk: kerndisk userdisk # include default stuff include Makefiles/Makefile.default include Makefiles/Makefile.user # host platform (Filename Platform.ARCH.PLATFORM) include Makefiles/Platform.$(ARCH).linux # compiler defines SFLAGS=-x assembler-with-cpp SIZEFLAGS=-A CCDEBUG= CFLAGS=$(MACHINE_CFLAGS) $(CCDEBUG) INC=$(addprefix -I, $(ALLDIRS)) INC+=-IIO/$(ARCH)/Drivers DEFS = -DDEBUG_LEVEL=2 -D$(ARCH) OPTIMIZE = -O2 -fno-strict-aliasing #LDFLAGS are defined in Platform file # first the kernel architecture depending files STFILESARCH=start.S Init.c TOFILESARCH=SyscallMsg.S SupportAsm.S Exception.c Tools.c MMFILESARCH=MMDirectMapping.c MMError.c MMHal.c mmHalAsm.S TMFILESARCH=TMHal.c TMError.c TMHalAsm.S TMClock.c TMClockAsm.S IOFILESARCH=IOHal.c # now the drivers, this is a temporary solution, will be changed in near future IOFILESDRIVERS=ia32/TTY.c ia32/Keyboard.c ia32/HWKeyTable.S \ ia32/keyboard.S ia32/KeyCodeTable.S ia32/Video.c \ ia32/video.S Loopback.c # make depending files LINKSCRIPT=link.$(ARCH).scr KERNEL_LINKSCRIPT=Boot/$(ARCH)/$(LINKSCRIPT) USER_LINKSCRIPT=User/$(LINKSCRIPT) ######################### KERNELSTUFF ######################### # this builds the Topsy ia32 "kernel" #FLOPPY=/dev/fd0H1440 FLOPPY=topsyimage kernel: kernel.bin kerndisk: fast dd if=Boot/$(ARCH)/LowCore/CoreBoot/CoreBoot.bin of=$(FLOPPY) obs=512 @echo "The CoreLoad.bin image is written to Head/Track/Sector 0/1/1" dd if=Boot/$(ARCH)/LowCore/CoreLoad/CoreLoad.bin of=$(FLOPPY) obs=512 seek=36 @echo "The Kernel image is written to Head/Track/Sector 0/2/1" dd if=kernel.bin of=$(FLOPPY) obs=512 seek=72 kernel.elf: $(REALKERNELOBJS) $(KERNEL_LINKSCRIPT) # create linked file $(LD) -m $(ELF) $(LDFLAGS) -o $@ -T $(KERNEL_LINKSCRIPT) kernel.elf.size: kernel.elf # Get Sizes $(SIZE) $(SIZEFLAGS) $< >$@ kernel.bin: kernel.elf.size \ Boot/$(ARCH)/Tools/KernPatch/KernPatch # Copy to binary format $(OBJCOPY) $(OBJCOPYFLAGS) kernel.elf $@ # Patch sizes into compiled kernel Boot/$(ARCH)/Tools/KernPatch/KernPatch \ kernel.bin kernel.elf.size # Dissamble Kernel -- Debugging echo "Dissambling" objdump -b binary -m i386 -D -s kernel.bin >kernel.src Boot/$(ARCH)/Tools/KernPatch/KernPatch: $(MAKE) -C Boot/$(ARCH)/Tools/KernPatch ########################## USER STUFF ########################## # this builds the Topsy user stuff user: user.bin userdisk: user.bin dd if=user.bin of=$(FLOPPY) obs=512 seek=576 dd if=/dev/zero of=$(FLOPPY) obs=512 seek=1440 count=1440 # $(LD) $(DEBUG) -m $(ELF) $(LDFLAGS) -o user.elf $(REALOBJS) user.bin: \ $(REALOBJS) $(USER_LINKSCRIPT) \ Boot/$(ARCH)/Tools/KernPatch/KernPatch $(LD) $(DEBUG) -m $(ELF) -o user.elf $(REALOBJS) \ ia32.obj/Topsy/Syscall.o ia32.obj/Topsy/ia32/SyscallMsg.o \ ia32.obj/Startup/ia32/start.o -defsym __printstr=0 \ -T $(USER_LINKSCRIPT) # Copy to binary format $(OBJCOPY) $(OBJCOPYFLAGS) user.elf user.bin #-LR /* LR 000519 */ # modified SIZE getting -- strange settings were previously used # Get Sizes $(SIZE) $(SIZEFLAGS) user.elf >user.elf.size # Patch sizes into compiled user Boot/$(ARCH)/Tools/KernPatch/KernPatch \ user.bin user.elf.size size: find ia32.obj -name "*.o" -print | xargs -x $(SIZE) | sort -n -r echo -n "ia32 kernel:" $(SIZE) -Ax kernel.elf