source: trunk/Makefile @ 566

Last change on this file since 566 was 553, checked in by nicolas.van.phan@…, 6 years ago

Add SEGS_SET param in params-hard.mk

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