source: trunk/Makefile @ 605

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

Introduce the txt_type, fbf_type, and sys_clk parameters
in the files params-hard.mk and Makefile

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