source: trunk/Makefile @ 623

Last change on this file since 623 was 623, checked in by alain, 5 years ago

Introduce three new types of vsegs (KCODE,KDATA,KDEV)
to map the kernel vsegs in the process VSL and GPT.
This now used by both the TSAR and the I86 architectures.

File size: 6.8 KB
Line 
1#############################################################################
2#                         ALMOS-MKH Global Makefile                         #
3#############################################################################
4
5-include params-soft.mk
6
7ifeq ($(ARCH_NAME),)
8$(error Please define ARCH_NAME parameter in params-soft.mk!)
9endif
10
11-include params-hard.mk
12
13# Default values for hardware parameters.
14# These parameters should be defined in the 'params-hard.mk' file.
15ARCH            ?= /users/alain/soc/tsar-trunk-svn-2013/platforms/tsar_generic_iob
16X_SIZE          ?= 2
17Y_SIZE          ?= 2
18NB_PROCS        ?= 2
19NB_TTYS         ?= 3
20IOC_TYPE        ?= IOC_BDV
21TXT_TYPE    ?= TXT_TTY
22FBF_TYPE    ?= FBF_SCL
23SYS_CLK     ?= 50000
24
25# Checking hardware platform definition.
26ifeq ($(wildcard $(ARCH)),)
27$(error Please define in ARCH parameter the path to the hardware platform!)
28endif
29
30# Rules that don't build target files
31# always out-of-date, need to be regenerated everytime they are called
32.PHONY: compile                                \
33        hard_config.h                      \
34                dirs                                           \
35                list                                           \
36                extract                                        \
37                fsck                                           \
38                clean                                          \
39                build_libs                         \
40                build-disk                                     \
41                $(BOOTLOADER_PATH)/build/boot.elf  \
42                kernel/build/kernel.elf            \
43                user/init/build/init.elf           \
44                user/ksh/build/ksh.elf             \
45                user/pgdc/build/pgcd.elf           \
46                user/idbg/build/idbg.elf           \
47                user/sort/build/sort.elf           \
48        user/fft/build/fft.elf
49
50# Virtual disk path
51DISK_IMAGE      := hdd/virt_hdd.dmg
52
53# The Mtools used to build the FAT32 disk image perfom a few sanity checks, to
54# make sure that the disk is indeed an MS-DOS disk. However, the size of the
55# disk image used by ALMOS-MKH is not MS-DOS compliant.
56# Setting this variable prevents these checks.
57MTOOLS_SKIP_CHECK := 1
58
59##########################################################################################
60# Rule to generate boot.elf, kernel.elf, all user.elf files, and update the virtual disk
61# when the corresponding sources files have been modified or destroyed.
62# The /home directory on the virtual disk is not modified
63compile: dirs                              \
64         hard_config.h                     \
65         build_libs                        \
66         $(BOOTLOADER_PATH)/build/boot.elf \
67         kernel/build/kernel.elf           \
68         user/init/build/init.elf          \
69         user/ksh/build/ksh.elf            \
70         user/pgcd/build/pgcd.elf          \
71         user/idbg/build/idbg.elf          \
72         user/sort/build/sort.elf          \
73         user/fft/build/fft.elf            \
74         list
75
76# Rule to create the hdd directory
77dirs:
78        @mkdir -p hdd
79
80# Rule to make a recursive list of the virtual disk content.
81list:
82        mdir -/ -b -i $(DISK_IMAGE) ::/
83
84##############################################################
85# Rule to copy the files generated by the virtual prototype
86# from the virtual disk 'home' directory to the current directory.
87extract:
88        mcopy -o -i $(DISK_IMAGE) ::/home .
89
90##############################################################
91# Rules to delete all binary files from Unix File System
92# without modifying the virtual disk.
93clean:
94        rm -f hard_config.h arch_info.xml arch_info.bin
95        rm -rf build
96        $(MAKE) -C kernel clean
97        $(MAKE) -C $(BOOTLOADER_PATH) clean
98        $(MAKE) -C $(LIBC_PATH) clean
99        $(MAKE) -C $(LIBPTHREAD_PATH) clean
100        $(MAKE) -C $(LIBSEMAPHORE_PATH) clean
101        $(MAKE) -C $(LIBALMOSMKH_PATH) clean
102        $(MAKE) -C $(LIBMATH_PATH) clean
103        $(MAKE) -C user/init clean
104        $(MAKE) -C user/ksh clean
105        $(MAKE) -C user/sort clean
106        $(MAKE) -C user/pgcd clean
107        $(MAKE) -C user/idbg clean
108        $(MAKE) -C user/fft clean
109        $(MAKE) -C $(HAL_ARCH) clean
110
111####################################################   
112# Rule for building a new virtual disk from scratch.
113# It creates the bin, bin/kernel, bin/user, and home directories.
114# This requires the generic Linux/MacOS 'create_dmg' script, that should be
115# placed in the same directory as this Makefile.
116build_disk: dirs
117        rm -f $(DISK_IMAGE)
118        ./create_dmg    create $(basename $(DISK_IMAGE))
119        dd                              if=$(DISK_IMAGE) of=temp.dmg count=65536
120        mv                              temp.dmg $(DISK_IMAGE)
121        mmd                     -o -i $(DISK_IMAGE) ::/bin         || true
122        mmd                     -o -i $(DISK_IMAGE) ::/bin/kernel  || true
123        mmd                     -o -i $(DISK_IMAGE) ::/bin/user    || true
124        mmd                     -o -i $(DISK_IMAGE) ::/home        || true
125        mdir             -/ -b -i $(DISK_IMAGE) ::/
126
127##############################################################
128# Rules to generate hardware description files (hard_config.h,
129# arch_info.bin and arch_info.xml), and update the virtual disk.
130hard_config.h: $(ARCH)/arch_info.py
131        tools/arch_info/genarch.py      --arch=$(ARCH)                  \
132                                                                --x_size=$(X_SIZE)              \
133                                                                --y_size=$(Y_SIZE)              \
134                                                                --nb_cores=$(NB_PROCS)  \
135                                                                --nb_ttys=$(NB_TTYS)    \
136                                                                --ioc_type=$(IOC_TYPE)  \
137                                --txt_type=$(TXT_TYPE)  \
138                                --fbf_type=$(FBF_TYPE)  \
139                                --sys_clk=$(SYS_CLK)    \
140                                                                --hard=.                                \
141                                                                --bin=.                                 \
142                                                                --xml=.                                 
143        mcopy -o -i $(DISK_IMAGE) arch_info.bin ::/   || true
144        mdir             -/ -b -i $(DISK_IMAGE) ::/
145
146############################################
147# Rules to generate the user level libraries
148build_libs: build_hal
149        $(MAKE) -C $(LIBALMOSMKH_PATH) headers
150        $(MAKE) -C $(LIBPTHREAD_PATH) headers
151        $(MAKE) -C $(LIBSEMAPHORE_PATH) headers
152        $(MAKE) -C $(LIBMATH_PATH) headers
153        $(MAKE) -C $(LIBC_PATH)
154        $(MAKE) -C $(LIBALMOSMKH_PATH)
155        $(MAKE) -C $(LIBPTHREAD_PATH)
156        $(MAKE) -C $(LIBSEMAPHORE_PATH) 
157        $(MAKE) -C $(LIBMATH_PATH) 
158
159#####################################################################
160# Rule to generate boot.elf and place it in sector #2 of virtual disk
161$(BOOTLOADER_PATH)/build/boot.elf:
162        $(MAKE) -C $(BOOTLOADER_PATH)
163        dd if=$@ of=$(DISK_IMAGE) seek=2 conv=notrunc
164
165######################################################
166# Rule to generate HAL objects (depending on HAL_ARCH)
167build_hal:
168        $(MAKE) -C $(HAL_ARCH)
169
170#############################################################
171# Rule to generate kernel.elf and place it on virtual disk
172kernel/build/kernel.elf: build_hal
173        $(MAKE) -C kernel/
174        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/kernel
175
176#####################################################
177# Rules to generate user.elf and copy on virtual disk
178user/init/build/init.elf: build_libs
179        $(MAKE) -C user/init
180        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
181user/ksh/build/ksh.elf: build_libs
182        $(MAKE) -C user/ksh
183        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
184user/pgcd/build/pgcd.elf: build_libs
185        $(MAKE) -C user/pgcd
186        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
187user/idbg/build/idbg.elf: build_libs
188        $(MAKE) -C user/idbg
189        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
190user/sort/build/sort.elf: build_libs
191        $(MAKE) -C user/sort
192        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
193user/fft/build/fft.elf: build_libs
194        $(MAKE) -C user/fft
195        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
Note: See TracBrowser for help on using the repository browser.