source: mainline/boot/arch/sparc64/loader/Makefile@ 95b730c2

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 95b730c2 was 95b730c2, checked in by Martin Decky <martin@…>, 17 years ago

finish mkfat.py
this drops build dependency on mtools

  • Property mode set to 100644
File size: 5.0 KB
RevLine 
[b7b5f83]1#
[df4ed85]2# Copyright (c) 2006 Martin Decky
[b7b5f83]3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8#
9# - Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# - Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14# - The name of the author may not be used to endorse or promote products
15# derived from this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28
[aca95f6b]29include ../../../../version
30include ../../../Makefile.config
31
[b7b5f83]32## Toolchain configuration
33#
34
[ac6ee45]35ifndef CROSS_PREFIX
36 CROSS_PREFIX = /usr/local
37endif
38
[960f8476]39BFD_NAME = elf64-sparc
40BFD_ARCH = sparc
[b7b5f83]41TARGET = sparc64-linux-gnu
[ac6ee45]42TOOLCHAIN_DIR = $(CROSS_PREFIX)/sparc64/bin
[b7b5f83]43
[67f5fbd9]44ifeq ($(COMPILER),gcc_native)
[b7b5f83]45 CC = gcc
46 AS = as
47 LD = ld
48 OBJCOPY = objcopy
[67f5fbd9]49 OBJDUMP = objdump
50endif
51
52ifeq ($(COMPILER),gcc_cross)
[b7b5f83]53 CC = $(TOOLCHAIN_DIR)/$(TARGET)-gcc
54 AS = $(TOOLCHAIN_DIR)/$(TARGET)-as
55 LD = $(TOOLCHAIN_DIR)/$(TARGET)-ld
56 OBJCOPY = $(TOOLCHAIN_DIR)/$(TARGET)-objcopy
57 OBJDUMP = $(TOOLCHAIN_DIR)/$(TARGET)-objdump
58endif
59
[6198611]60CFLAGS = -DRELEASE=\"$(RELEASE)\" -I. -I../../../generic -I../../../genarch -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -mcpu=ultrasparc -m64 -mno-fpu -pipe
[aca95f6b]61
62ifdef REVISION
63 CFLAGS += "-DREVISION=\"$(REVISION)\""
64endif
65
66ifdef TIMESTAMP
67 CFLAGS += "-DTIMESTAMP=\"$(TIMESTAMP)\""
68endif
[b7b5f83]69
70SOURCES = \
71 main.c \
[960f8476]72 _components.c \
[b7b5f83]73 ../../../generic/printf.c \
[9a5b556]74 ../../../generic/string.c \
[61e90dd]75 ../../../genarch/balloc.c \
[b7b5f83]76 ../../../genarch/ofw.c \
[3abe07f5]77 ../../../genarch/ofw_tree.c \
[63cda71]78 ofwarch.c \
[b7b5f83]79 asm.S \
80 boot.S
81
[338a8382]82#
83# All components that go to image.boot without the ramdisk.
84#
[b7b5f83]85COMPONENTS = \
[cfa70add]86 $(KERNELDIR)/kernel.bin \
[00acd66]87 $(USPACEDIR)/srv/ns/ns \
[00db5bcf]88 $(USPACEDIR)/app/init/init \
[c98e6ee]89 $(USPACEDIR)/srv/loader/loader \
[00db5bcf]90 $(USPACEDIR)/srv/devmap/devmap \
91 $(USPACEDIR)/srv/rd/rd \
[7c1d121]92 $(USPACEDIR)/srv/vfs/vfs
93ifeq ($(RDFMT),tmpfs)
94 COMPONENTS += $(USPACEDIR)/srv/fs/tmpfs/tmpfs
95endif
96ifeq ($(RDFMT),fat)
97 COMPONENTS += $(USPACEDIR)/srv/fs/fat/fat
98endif
[00db5bcf]99
[338a8382]100#
101# Final list of all components that go to image.boot.
102#
103ALL_COMPONENTS = $(COMPONENTS)
104ifeq ($(CONFIG_RD_EXTERNAL),n)
105 ALL_COMPONENTS += ./initrd.img
106endif
107
[de9c5cb]108RD_SRVS = \
[00acd66]109 $(USPACEDIR)/srv/fb/fb \
110 $(USPACEDIR)/srv/kbd/kbd \
111 $(USPACEDIR)/srv/console/console \
[7c1d121]112 $(USPACEDIR)/srv/fs/tmpfs/tmpfs \
[de9c5cb]113 $(USPACEDIR)/srv/fs/fat/fat
114
115RD_APPS = \
[00acd66]116 $(USPACEDIR)/app/tetris/tetris \
117 $(USPACEDIR)/app/tester/tester \
[2e3355a]118 $(USPACEDIR)/app/trace/trace \
[80791a7]119 $(USPACEDIR)/app/bdsh/bdsh \
[00acd66]120 $(USPACEDIR)/app/klog/klog
[b7b5f83]121
122OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
[338a8382]123ALL_COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(ALL_COMPONENTS))))
[b7b5f83]124
125.PHONY: all clean depend
126
[63cda71]127all: image.boot disasm
[b7b5f83]128
129-include Makefile.depend
130
[338a8382]131image.boot: depend _components.h _link.ld $(ALL_COMPONENT_OBJECTS) $(OBJECTS)
132 $(LD) -Map image.map -no-check-sections -N -T _link.ld $(ALL_COMPONENT_OBJECTS) $(OBJECTS) -o $@
[b7b5f83]133
134depend:
[6198611]135 -makedepend -f - -- $(DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null
[b7b5f83]136
137clean:
[de9c5cb]138 -for file in $(RD_SRVS) ; do \
139 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \
140 done
141 -for file in $(RD_APPS) ; do \
142 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \
[00db5bcf]143 done
[338a8382]144 -rm -f _components.h _components.c _link.ld $(ALL_COMPONENT_OBJECTS) $(OBJECTS) initrd.img image.boot image.map image.disasm Makefile.depend
[00db5bcf]145
[338a8382]146_components.h _components.c _link.ld $(ALL_COMPONENT_OBJECTS): $(COMPONENTS) $(RD_SRVS) $(RD_APPS) _link.ld.in
[de9c5cb]147 for file in $(RD_SRVS) ; do \
148 cp $$file $(USPACEDIR)/dist/srv/ ; \
149 done
150 for file in $(RD_APPS) ; do \
151 cp $$file $(USPACEDIR)/dist/app/ ; \
[00db5bcf]152 done
[7c1d121]153ifeq ($(RDFMT),tmpfs)
[619e7c9b]154 ../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs
[7c1d121]155endif
156ifeq ($(RDFMT),fat)
[95b730c2]157 ../../../../tools/mkfat.py $(USPACEDIR)/dist/ initrd.fs
[7c1d121]158endif
[619e7c9b]159 ../../../../tools/mkhord.py 16384 initrd.fs initrd.img
160 rm initrd.fs
[338a8382]161 ../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 1 "unsigned long" $(ALL_COMPONENTS)
[b7b5f83]162
163%.o: %.S
164 $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
165
166%.o: %.c
167 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@
[63cda71]168
169disasm: image.boot
[960f8476]170 $(OBJDUMP) -d image.boot > image.disasm
Note: See TracBrowser for help on using the repository browser.