1 | #!/bin/bash |
---|
2 | # |
---|
3 | # $Id$ |
---|
4 | # |
---|
5 | # RTEMS Bare BSP Build Script. |
---|
6 | # |
---|
7 | # This is designed to allow recording of stdout to log. The log |
---|
8 | # forms part of a clean build trace for validation and verification |
---|
9 | # reasons. |
---|
10 | # |
---|
11 | |
---|
12 | . `echo $0 | sed -e 's/do-rtems-build/build-tools/'` |
---|
13 | |
---|
14 | # |
---|
15 | # The current versions we are building. |
---|
16 | # |
---|
17 | # Note: Please change to suite. |
---|
18 | # |
---|
19 | |
---|
20 | RTEMS=rtems-980618 |
---|
21 | |
---|
22 | # |
---|
23 | # The list of processors we want the tools built for. |
---|
24 | # |
---|
25 | |
---|
26 | CPUS="m68k" |
---|
27 | |
---|
28 | # |
---|
29 | # RTEMS CPU target we want to build. |
---|
30 | # |
---|
31 | |
---|
32 | RTEMS_M68K_TARGETS="68000 68030 cpu32" |
---|
33 | |
---|
34 | # |
---|
35 | # The particular host settings we have. |
---|
36 | # |
---|
37 | # Map particulars for different hosts here. |
---|
38 | # |
---|
39 | |
---|
40 | HOST=`hostname` |
---|
41 | |
---|
42 | case "${HOST}" in |
---|
43 | kiwi*) |
---|
44 | ARCHIVE="/ods/archive" |
---|
45 | TOOLS="/ods/egcs" |
---|
46 | RTEMS_PATH=development/rtems/${RTEMS} |
---|
47 | ;; |
---|
48 | *) |
---|
49 | fatal_error "host is not known." |
---|
50 | ;; |
---|
51 | esac |
---|
52 | |
---|
53 | # |
---|
54 | # Where will RTEMS live when installed ? |
---|
55 | # |
---|
56 | |
---|
57 | RTEMS_PREFIX=${TOOLS}/test |
---|
58 | |
---|
59 | echo "Building on ${HOST}, archives in ${ARCHIVE}" |
---|
60 | |
---|
61 | # |
---|
62 | # Who is doing the build. |
---|
63 | # |
---|
64 | |
---|
65 | echo "User profile : "`id` |
---|
66 | |
---|
67 | # |
---|
68 | # Find out where we are |
---|
69 | # |
---|
70 | |
---|
71 | TOPDIR=`pwd` |
---|
72 | |
---|
73 | echo "Top directory is ${TOPDIR}" |
---|
74 | |
---|
75 | # |
---|
76 | # Test the paths to the archives exist. |
---|
77 | # |
---|
78 | |
---|
79 | test_path ${ARCHIVE}/${RTEMS_PATH} |
---|
80 | |
---|
81 | # |
---|
82 | # Get the RTEMS source and patch. |
---|
83 | # |
---|
84 | |
---|
85 | echo "Unpacking rtems source ${ARCHIVE}/${RTEMS_PATH}/${RTEMS}.tgz ... " |
---|
86 | tar zxf ${ARCHIVE}/${RTEMS_PATH}/${RTEMS}.tgz |
---|
87 | check_fatal $? "failed to unpack ${RTEMS}.tgz." |
---|
88 | |
---|
89 | # |
---|
90 | # Build all the processors we support. |
---|
91 | # |
---|
92 | |
---|
93 | for cpu in ${CPUS}; do |
---|
94 | { |
---|
95 | # |
---|
96 | # Create the target. |
---|
97 | # |
---|
98 | |
---|
99 | TARGET=${cpu}-rtems |
---|
100 | |
---|
101 | # |
---|
102 | # On to RTEMS. |
---|
103 | # |
---|
104 | |
---|
105 | case ${cpu} in |
---|
106 | m68k) |
---|
107 | RTEMS_TARGETS=${RTEMS_M68K_TARGETS} |
---|
108 | ;; |
---|
109 | *) |
---|
110 | fatal_error "unknown cpu ${cpu}" |
---|
111 | ;; |
---|
112 | esac |
---|
113 | |
---|
114 | for rtems_target in ${RTEMS_TARGETS}; do |
---|
115 | { |
---|
116 | # |
---|
117 | # Remove the target if found. |
---|
118 | # |
---|
119 | |
---|
120 | echo "Removing the RTEMS bare bsp directory rtems-bare-${rtems_target} ... " |
---|
121 | rm -rf rtems-bare-${rtems_target} |
---|
122 | check_fatal $? "failed to remove rtems-bare-${rtems_target}." |
---|
123 | |
---|
124 | echo "Creating the RTEM build directory for target ${rtems_target} ... " |
---|
125 | checked_mkdir rtems-bare-${rtems_target} |
---|
126 | |
---|
127 | cd rtems-bare-${rtems_target} |
---|
128 | |
---|
129 | # |
---|
130 | # Configure RTEMS. |
---|
131 | # |
---|
132 | # FIXME: the mapping from the rtems_target to the cpu flags |
---|
133 | # just happens to work for the m68k targets. This should |
---|
134 | # be mapped in a way which does not depends on the rtems_target, |
---|
135 | # or RTEMS should support multilibs. |
---|
136 | # |
---|
137 | |
---|
138 | echo "Configuring RTEMS target bare-${rtems_target} ... " |
---|
139 | ../${RTEMS}/configure --target=${TARGET} --prefix=${RTEMS_PREFIX} \ |
---|
140 | --enable-cxx --enable-gmake-print-directory \ |
---|
141 | --disable-tests --disable-posix --enable-networking \ |
---|
142 | --enable-bare-cpu-cflags=-m${rtems_target} \ |
---|
143 | --enable-bare-cpu-model=m${rtems_target} \ |
---|
144 | --enable-rtemsbsp=bare |
---|
145 | check_fatal $? "failed to configure rtems target." |
---|
146 | |
---|
147 | # |
---|
148 | # Do the RTEMS build. |
---|
149 | # |
---|
150 | |
---|
151 | echo "Building RTEMS target bare-${rtems_target} ... " |
---|
152 | make all install |
---|
153 | check_fatal $? "failed to complete rtems build for target ${rtems_target}." |
---|
154 | |
---|
155 | # |
---|
156 | # Remove the target if found. |
---|
157 | # |
---|
158 | |
---|
159 | echo "Removing the RTEMS bare bsp directory ${RTEMS_PREFIX}/rtems/bare-${rtems_target} ... " |
---|
160 | rm -rf ${RTEMS_PREFIX}/rtems/bare-${rtems_target} |
---|
161 | check_fatal $? "failed to remove ${RTEMS_PREFIX}/rtems/bare-${rtems_target}." |
---|
162 | |
---|
163 | # |
---|
164 | # Fix up the fact that RTEMS always installsthe bare bsp to the bare directory |
---|
165 | # |
---|
166 | |
---|
167 | echo "Moving the RTEMS bare bsp directory to bare-${rtems_target} ... " |
---|
168 | mv ${RTEMS_PREFIX}/rtems/bare ${RTEMS_PREFIX}/rtems/bare-${rtems_target} |
---|
169 | check_fatal $? "failed to move the bare bsp directory to bare-${rtems_target}." |
---|
170 | |
---|
171 | cd ../ |
---|
172 | }; done |
---|
173 | }; done |
---|
174 | |
---|
175 | cd ../ |
---|
176 | |
---|
177 | my_exit 0 |
---|