File make changed (mode: 100755) (index cb4b569..d07a5ff) |
1 |
1 |
#!/bin/sh |
#!/bin/sh |
2 |
2 |
|
|
3 |
|
#this script is brutal and verbose, has no tricks and is quite linear, then |
|
4 |
|
#quite easy to deal with |
|
5 |
|
#for the moment, it's hardcoded for a gcc toolchain... BAD! Since now |
|
6 |
|
#gcc is a c++ piece of shit |
|
|
3 |
|
# this script is brutal and verbose, has no tricks and is quite linear, then |
|
4 |
|
# quite easy to deal with |
|
5 |
|
# for the moment, it's hardcoded for a gcc toolchain... BAD! Since now |
|
6 |
|
# gcc is a c++ piece of shit |
7 |
7 |
|
|
8 |
|
#stolen from ffmpeg configure like a pig |
|
|
8 |
|
# stolen from ffmpeg configure like a pig |
9 |
9 |
set -e |
set -e |
10 |
10 |
|
|
11 |
|
#prevent locale nonsense from breaking basic text processing. |
|
|
11 |
|
# prevent locale nonsense from breaking basic text processing |
12 |
12 |
LC_ALL=C |
LC_ALL=C |
13 |
13 |
export LC_ALL |
export LC_ALL |
14 |
14 |
|
|
|
... |
... |
ramfs.c |
29 |
29 |
$init_ulinux_src_files |
$init_ulinux_src_files |
30 |
30 |
" |
" |
31 |
31 |
|
|
32 |
|
clean_do() |
|
33 |
|
{ |
|
34 |
|
rm -f static_modules.h |
|
35 |
|
rm -f *.cpio.xz |
|
36 |
|
rm -f *.cpio |
|
37 |
|
rm -f cpio |
|
38 |
|
rm -f $init_file_name |
|
39 |
|
for init_src_file in $init_src_files |
|
40 |
|
do |
|
41 |
|
init_pp_file=${init_src_file%.c} |
|
42 |
|
init_pp_file=${init_pp_file}.pp.c |
|
43 |
|
rm -f ${init_pp_file} |
|
44 |
|
init_o_file=${init_src_file%.c} |
|
45 |
|
init_o_file=${init_o_file}.o |
|
46 |
|
rm -f ${init_o_file} |
|
47 |
|
#clean directories, but keep root of build tree |
|
48 |
|
tgt_dir=$(dirname $init_src_file) |
|
49 |
|
if test -d $tgt_dir -a "$tgt_dir" != "."; then |
|
50 |
|
rmdir --ignore-fail-on-non-empty -p $tgt_dir |
|
51 |
|
fi |
|
52 |
|
done |
|
53 |
|
exit 0 |
|
54 |
|
} |
|
55 |
|
|
|
56 |
32 |
sep_start() |
sep_start() |
57 |
33 |
{ |
{ |
58 |
|
printf '###############################################################################\n' |
|
|
34 |
|
printf '###############################################################################\n' |
59 |
35 |
} |
} |
60 |
36 |
|
|
61 |
37 |
sep_end() |
sep_end() |
62 |
38 |
{ |
{ |
63 |
|
printf '###############################################################################\n\n' |
|
|
39 |
|
printf '###############################################################################\n\n' |
64 |
40 |
} |
} |
65 |
41 |
|
|
66 |
42 |
subsep_start() |
subsep_start() |
67 |
43 |
{ |
{ |
68 |
|
printf '*******************************************************************************\n' |
|
|
44 |
|
printf '*******************************************************************************\n' |
69 |
45 |
} |
} |
70 |
46 |
|
|
71 |
47 |
subsep_end() |
subsep_end() |
72 |
48 |
{ |
{ |
73 |
|
printf '*******************************************************************************\n' |
|
|
49 |
|
printf '*******************************************************************************\n' |
74 |
50 |
} |
} |
|
51 |
|
|
75 |
52 |
################################################################################ |
################################################################################ |
76 |
53 |
|
|
77 |
|
is_in(){ |
|
78 |
|
value=$1 |
|
79 |
|
shift |
|
80 |
|
for var in $*; do |
|
81 |
|
[ $var = $value ] && return 0 |
|
82 |
|
done |
|
83 |
|
return 1 |
|
|
54 |
|
is_in() |
|
55 |
|
{ |
|
56 |
|
value=$1 |
|
57 |
|
shift |
|
58 |
|
for var in $*; do |
|
59 |
|
[ $var = $value ] && return 0 |
|
60 |
|
done |
|
61 |
|
return 1 |
84 |
62 |
} |
} |
85 |
63 |
|
|
86 |
64 |
die_unknown(){ |
die_unknown(){ |
87 |
|
echo "Unknown option \"$1\"." |
|
88 |
|
echo "See $0 --help for available options." |
|
89 |
|
exit 1 |
|
|
65 |
|
echo "Unknown option \"$1\"." |
|
66 |
|
echo "See $0 --help for available options." |
|
67 |
|
exit 1 |
90 |
68 |
} |
} |
91 |
69 |
|
|
92 |
70 |
set_default(){ |
set_default(){ |
93 |
|
for opt; do |
|
94 |
|
eval : \${$opt:=\$${opt}_default} |
|
95 |
|
done |
|
|
71 |
|
for opt; do |
|
72 |
|
eval : \${$opt:=\$${opt}_default} |
|
73 |
|
done |
96 |
74 |
} |
} |
97 |
75 |
|
|
98 |
76 |
CMDLINE_SET=' |
CMDLINE_SET=' |
99 |
|
linux_src_dir |
|
100 |
|
kernel_modules_base_dir |
|
101 |
|
init_cpp |
|
102 |
|
init_cc |
|
103 |
|
init_ld |
|
104 |
|
init_ulinux_arch |
|
105 |
|
uevents_timeout |
|
106 |
|
gen_init_cpio |
|
107 |
|
kernel_release |
|
108 |
|
extra_modules |
|
109 |
|
pkg_config |
|
110 |
|
readelf |
|
111 |
|
elf_interpreter |
|
|
77 |
|
linux_build_dir |
|
78 |
|
kernel_modules_base_dir |
|
79 |
|
init_cpp |
|
80 |
|
init_cc |
|
81 |
|
init_ccld |
|
82 |
|
init_ulinux_arch |
|
83 |
|
uevents_timeout |
|
84 |
|
gen_init_cpio |
|
85 |
|
kernel_release |
|
86 |
|
extra_modules |
|
87 |
|
pkg_config |
|
88 |
|
elf_interpreter |
112 |
89 |
' |
' |
113 |
|
#command line set defaults |
|
114 |
|
#if the root is not around in less than 4s, something is really wrong |
|
|
90 |
|
# command line set defaults |
|
91 |
|
# if the root is not around in less than 4s, something is really wrong |
115 |
92 |
uevents_timeout_default=4000 |
uevents_timeout_default=4000 |
116 |
|
gen_init_cpio_default='$linux_src_dir/usr/gen_init_cpio' |
|
117 |
|
linux_src_dir_default=/usr/src/linux |
|
|
93 |
|
gen_init_cpio_default='$linux_build_dir/usr/gen_init_cpio' |
|
94 |
|
linux_build_dir_default=/usr/src/linux |
118 |
95 |
#------------------------------------------------------------------------------- |
#------------------------------------------------------------------------------- |
119 |
|
#This defaults are for gcc, tested with version 4.7.3. You will need to |
|
120 |
|
#override those for you compiler (tinycc/open64/pcc...). Additionnally, source |
|
121 |
|
#support for different toolchains is not done. |
|
122 |
|
#Since we use standard C runtime libs, be nice with the C runtime. |
|
123 |
|
#The right way to do it is to have a toolchain abstraction layer since there are |
|
124 |
|
#no standards for some |
|
|
96 |
|
# this defaults are for gcc, tested with version 4.7.3. You will need to |
|
97 |
|
# override those for you compiler (tinycc/open64/pcc...). additionnally, source |
|
98 |
|
# support for different toolchains is not done |
|
99 |
|
# since we use standard C runtime libs, be nice with the C runtime |
125 |
100 |
init_cpp_default='gcc -E -Wall -Wextra' |
init_cpp_default='gcc -E -Wall -Wextra' |
126 |
|
init_cc_default="gcc -Wall -Wextra -std=gnu99 -O0 \ |
|
127 |
|
-Wl,--dynamic-linker=/lib/ld.so -c" |
|
128 |
|
init_ld_default='gcc -Wl,-O10,-s' |
|
|
101 |
|
init_cc_default='gcc -Wall -Wextra -Wno-implicit-fallthrough -std=gnu99 -O2 -c' |
|
102 |
|
init_ccld_default='gcc -Wl,-s -static' |
129 |
103 |
#------------------------------------------------------------------------------- |
#------------------------------------------------------------------------------- |
130 |
104 |
kernel_modules_base_dir_default=/ |
kernel_modules_base_dir_default=/ |
131 |
105 |
kernel_release_default=$(uname -r) |
kernel_release_default=$(uname -r) |
132 |
106 |
init_ulinux_arch_default=$(uname -m | sed -e s/i.86/i386/ -e s/parisc64/parisc/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/sh.*/sh/) |
init_ulinux_arch_default=$(uname -m | sed -e s/i.86/i386/ -e s/parisc64/parisc/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/sh.*/sh/) |
133 |
107 |
extra_modules_default= |
extra_modules_default= |
134 |
108 |
pkg_config_default=pkg-config |
pkg_config_default=pkg-config |
135 |
|
readelf_default=readelf |
|
136 |
109 |
elf_interpreter_default= |
elf_interpreter_default= |
137 |
110 |
|
|
138 |
111 |
set_default $CMDLINE_SET |
set_default $CMDLINE_SET |
139 |
112 |
|
|
140 |
|
show_help(){ |
|
141 |
|
cat <<EOF |
|
|
113 |
|
show_help() |
|
114 |
|
{ |
|
115 |
|
cat <<EOF |
142 |
116 |
Usage: make [options] [operations] |
Usage: make [options] [operations] |
143 |
117 |
|
|
144 |
|
Operations: [default is to build the the initramfs xz compressed cpio archive]: |
|
145 |
|
clean clean build products |
|
|
118 |
|
default is to build the the initramfs xz compressed cpio archive: |
146 |
119 |
|
|
147 |
120 |
Options: [defaults in brackets after descriptions] |
Options: [defaults in brackets after descriptions] |
148 |
121 |
|
|
|
... |
... |
Standard options: |
153 |
126 |
--lib-path-list=LIB_PATH_LIST colon separated paths to look for target libraries |
--lib-path-list=LIB_PATH_LIST colon separated paths to look for target libraries |
154 |
127 |
--uevents-timeout=UEVENTS_TIMEOUT uevents timeout in ms looking up for root block device to go online [$uevents_timeout] |
--uevents-timeout=UEVENTS_TIMEOUT uevents timeout in ms looking up for root block device to go online [$uevents_timeout] |
155 |
128 |
--quiet init will be silenced (output code compiled out) |
--quiet init will be silenced (output code compiled out) |
156 |
|
--linux-src-dir=DIR where to find the target linux source tree [$linux_src_dir_default] |
|
|
129 |
|
--linux-build-dir=DIR where to find the target linux build tree [$linux_build_dir_default] |
157 |
130 |
--kernel-release=RELEASE the linux releases version [$kernel_release] |
--kernel-release=RELEASE the linux releases version [$kernel_release] |
158 |
131 |
--kernel-modules-base-dir=DIR the base dir for linux modules and support files [$kernel_modules_base_dir] |
--kernel-modules-base-dir=DIR the base dir for linux modules and support files [$kernel_modules_base_dir] |
159 |
132 |
--extra-modules=EXTRA_MODULES coma separated list of extra module to probe |
--extra-modules=EXTRA_MODULES coma separated list of extra module to probe |
|
... |
... |
Standard options: |
161 |
134 |
Advanced options: |
Advanced options: |
162 |
135 |
--gen-init-cpio=GEN_INIT_CPIO_PATH use this linux host tool to build the linux cpio initramfs [$gen_init_cpio_default] |
--gen-init-cpio=GEN_INIT_CPIO_PATH use this linux host tool to build the linux cpio initramfs [$gen_init_cpio_default] |
163 |
136 |
--pkg-config=PKG_CONFIG use PKG_CONFIG pkg-config command for target libraries [$pkg_config_default] |
--pkg-config=PKG_CONFIG use PKG_CONFIG pkg-config command for target libraries [$pkg_config_default] |
164 |
|
--readelf=READELF use READELF readelf command for target readelf [$readelf_default] |
|
165 |
|
--elf-interpreter=ELF_INTERPRETER copy target ELF_INTERPRETER in cpio archive [will use the interpreter from the generated init elf binary] |
|
166 |
137 |
--init-cpp=CPP use CPP compiler command line CPP for target init process [$init_cpp_default] |
--init-cpp=CPP use CPP compiler command line CPP for target init process [$init_cpp_default] |
167 |
138 |
--init-cc=CC use C compiler command line CC for target init process objects [$init_cc_default] |
--init-cc=CC use C compiler command line CC for target init process objects [$init_cc_default] |
168 |
|
--init-ld=LD use linker command line LD for target init process [$init_ld_default] |
|
|
139 |
|
--init-ccld=CCLD use compiler driver linker command line CCLD for target init process [$init_ccld_default] |
169 |
140 |
--init-ulinux-arch=ARCH use ulinux ARCH for target init process [$init_ulinux_arch] |
--init-ulinux-arch=ARCH use ulinux ARCH for target init process [$init_ulinux_arch] |
170 |
141 |
EOF |
EOF |
171 |
|
exit 0 |
|
|
142 |
|
exit 0 |
172 |
143 |
} |
} |
173 |
144 |
|
|
174 |
145 |
################################################################################ |
################################################################################ |
175 |
146 |
|
|
176 |
147 |
for opt do |
for opt do |
177 |
|
optval="${opt#*=}" |
|
178 |
|
case "$opt" in |
|
179 |
|
clean) clean_do |
|
180 |
|
;; |
|
181 |
|
--help|-h) show_help |
|
182 |
|
;; |
|
183 |
|
--quiet) CPPFLAGS="$CPPFLAGS -DQUIET" |
|
184 |
|
;; |
|
185 |
|
*) |
|
186 |
|
optname=${opt%%=*} |
|
187 |
|
optname=${optname#--} |
|
188 |
|
optname=$(echo "$optname" | sed 's/-/_/g') |
|
189 |
|
if is_in $optname $CMDLINE_SET; then |
|
190 |
|
eval $optname='$optval' |
|
191 |
|
else |
|
192 |
|
die_unknown $opt |
|
193 |
|
fi |
|
194 |
|
;; |
|
195 |
|
esac |
|
|
148 |
|
optval="${opt#*=}" |
|
149 |
|
case "$opt" in |
|
150 |
|
--help|-h) show_help |
|
151 |
|
;; |
|
152 |
|
--quiet) CPPFLAGS="$CPPFLAGS -DQUIET" |
|
153 |
|
;; |
|
154 |
|
*) |
|
155 |
|
optname=${opt%%=*} |
|
156 |
|
optname=${optname#--} |
|
157 |
|
optname=$(echo "$optname" | sed 's/-/_/g') |
|
158 |
|
if is_in $optname $CMDLINE_SET; then |
|
159 |
|
eval $optname='$optval' |
|
160 |
|
else |
|
161 |
|
die_unknown $opt |
|
162 |
|
fi |
|
163 |
|
;; |
|
164 |
|
esac |
196 |
165 |
done |
done |
197 |
166 |
|
|
198 |
167 |
################################################################################ |
################################################################################ |
199 |
168 |
|
|
200 |
169 |
sep_start;echo 'looking for source path:' |
sep_start;echo 'looking for source path:' |
201 |
170 |
if test -f make; then |
if test -f make; then |
202 |
|
src_path=. |
|
|
171 |
|
src_path=. |
203 |
172 |
else |
else |
204 |
|
src_path=$(cd $(dirname "$0"); pwd) |
|
205 |
|
echo "$src_path" | grep -q '[[:blank:]]' && |
|
206 |
|
die "out of tree builds are impossible with whitespace in source path." |
|
207 |
|
test -e "$src_path/config.h" && |
|
208 |
|
die "out of tree builds are impossible with config.h in source dir." |
|
|
173 |
|
src_path=$(cd $(dirname "$0"); pwd) |
|
174 |
|
echo "$src_path" | grep -q '[[:blank:]]' && |
|
175 |
|
die "out of tree builds are impossible with whitespace in source path." |
209 |
176 |
fi |
fi |
210 |
177 |
echo "source path is $src_path";sep_end |
echo "source path is $src_path";sep_end |
211 |
178 |
|
|
|
... |
... |
echo "source path is $src_path";sep_end |
213 |
180 |
|
|
214 |
181 |
sep_start;echo 'checking libkmod and libblkid pkgconfig support:' |
sep_start;echo 'checking libkmod and libblkid pkgconfig support:' |
215 |
182 |
if $pkg_config --exists libkmod blkid; then |
if $pkg_config --exists libkmod blkid; then |
216 |
|
echo "found pkg-config files for libkmod and libblkid" |
|
|
183 |
|
echo "found pkg-config files for libkmod and libblkid" |
217 |
184 |
else |
else |
218 |
|
echo "missing pkg-config file for libkmod or libblkid" |
|
219 |
|
exit 1 |
|
|
185 |
|
echo "missing pkg-config file for libkmod or libblkid" |
|
186 |
|
exit 1 |
220 |
187 |
fi |
fi |
221 |
188 |
sep_end |
sep_end |
222 |
189 |
|
|
223 |
190 |
################################################################################ |
################################################################################ |
224 |
191 |
|
|
225 |
|
#define variable in source |
|
|
192 |
|
# define variable in source |
226 |
193 |
CPPFLAGS="$CPPFLAGS -DUEVENTS_TIMEOUT=$uevents_timeout" |
CPPFLAGS="$CPPFLAGS -DUEVENTS_TIMEOUT=$uevents_timeout" |
227 |
194 |
CPPFLAGS="$CPPFLAGS $($pkg_config --cflags-only-I libkmod blkid)" |
CPPFLAGS="$CPPFLAGS $($pkg_config --cflags-only-I libkmod blkid)" |
228 |
195 |
CFLAGS="$CFLAGS $($pkg_config --cflags-only-other libkmod blkid)" |
CFLAGS="$CFLAGS $($pkg_config --cflags-only-other libkmod blkid)" |
229 |
|
LDFLAGS="$LDFLAGS $($pkg_config --libs libkmod blkid)" |
|
|
196 |
|
LIBS="$($pkg_config --libs --static libkmod blkid) $LIBS" |
230 |
197 |
|
|
231 |
198 |
################################################################################ |
################################################################################ |
232 |
199 |
|
|
|
... |
... |
sep_end |
238 |
205 |
|
|
239 |
206 |
################################################################################ |
################################################################################ |
240 |
207 |
|
|
241 |
|
#generated some code/headers |
|
|
208 |
|
# generated some code/headers |
242 |
209 |
|
|
243 |
210 |
sep_start |
sep_start |
244 |
211 |
revision=$(echo "$kernel_release" | egrep -o '^[[:digit:]]+\.[[:digit:]]+') |
revision=$(echo "$kernel_release" | egrep -o '^[[:digit:]]+\.[[:digit:]]+') |
|
... |
... |
cat $src_path/$revision |
248 |
215 |
echo '--------' |
echo '--------' |
249 |
216 |
sep_end |
sep_end |
250 |
217 |
|
|
|
218 |
|
# those modules are all loaded before anything else |
251 |
219 |
sep_start;echo 'generate static module list:' |
sep_start;echo 'generate static module list:' |
252 |
220 |
$src_path/script/static_modules_h.sh $extra_modules $DISK_MODULES \ |
$src_path/script/static_modules_h.sh $extra_modules $DISK_MODULES \ |
253 |
221 |
>./static_modules.h |
>./static_modules.h |
|
... |
... |
sep_end |
259 |
227 |
sep_start;echo 'C preprocess init src files:' |
sep_start;echo 'C preprocess init src files:' |
260 |
228 |
for init_src_file in $init_src_files |
for init_src_file in $init_src_files |
261 |
229 |
do |
do |
262 |
|
init_pp_c_file=${init_src_file%.c} |
|
263 |
|
init_pp_c_file=${init_pp_c_file}.pp.c |
|
264 |
|
echo "INIT_CPP $init_src_file->$init_pp_c_file" |
|
265 |
|
mkdir -p $(dirname $init_pp_c_file) |
|
266 |
|
$init_cpp $CPPFLAGS -I. -I$src_path -o $init_pp_c_file \ |
|
267 |
|
$src_path/$init_src_file |
|
268 |
|
init_pp_c_files="$init_pp_c_file $init_pp_c_files" |
|
|
230 |
|
init_pp_c_file=${init_src_file%.c}.pp.c |
|
231 |
|
echo "INIT_CPP $init_src_file->$init_pp_c_file" |
|
232 |
|
mkdir -p $(dirname $init_pp_c_file) |
|
233 |
|
$init_cpp -o $init_pp_c_file \ |
|
234 |
|
$CPPFLAGS \ |
|
235 |
|
-I. \ |
|
236 |
|
-I$src_path \ |
|
237 |
|
$src_path/$init_src_file |
|
238 |
|
init_pp_c_files="$init_pp_c_file $init_pp_c_files" |
269 |
239 |
done |
done |
270 |
240 |
sep_end |
sep_end |
271 |
241 |
|
|
|
... |
... |
sep_end |
274 |
244 |
sep_start;echo 'compile init preprocessed src files:' |
sep_start;echo 'compile init preprocessed src files:' |
275 |
245 |
for init_pp_c_file in $init_pp_c_files |
for init_pp_c_file in $init_pp_c_files |
276 |
246 |
do |
do |
277 |
|
init_obj_file=${init_pp_c_file%.pp.c} |
|
278 |
|
init_obj_file=${init_obj_file}.o |
|
279 |
|
echo "INIT_CC $init_pp_c_file-->$init_obj_file" |
|
280 |
|
$init_cc $CFLAGS -o $init_obj_file $init_pp_c_file |
|
281 |
|
init_obj_files="$init_obj_file $init_obj_files" |
|
|
247 |
|
init_obj_file=${init_pp_c_file%.pp.c}.o |
|
248 |
|
echo "INIT_CC $init_pp_c_file-->$init_obj_file" |
|
249 |
|
$init_cc $CFLAGS -o $init_obj_file $init_pp_c_file |
|
250 |
|
init_obj_files="$init_obj_file $init_obj_files" |
282 |
251 |
done |
done |
283 |
252 |
sep_end |
sep_end |
284 |
253 |
|
|
285 |
254 |
################################################################################ |
################################################################################ |
286 |
255 |
|
|
287 |
256 |
sep_start;echo 'link the init objects to produce the init binary:' |
sep_start;echo 'link the init objects to produce the init binary:' |
288 |
|
echo "INIT_LD $init_file_name" |
|
289 |
|
$init_ld -o $init_file_name $init_obj_files $LDFLAGS |
|
290 |
|
sep_end |
|
291 |
|
|
|
292 |
|
################################################################################ |
|
293 |
|
|
|
294 |
|
#build the library path used by the gcc toolchain. We will need it to lookup |
|
295 |
|
#for the dynamic shared libraries and copy them into the cpio |
|
296 |
|
sep_start;echo "computing gcc library path:" |
|
297 |
|
#in gcc search paths, the sysroot uses '=' |
|
298 |
|
lib_path_nosysroot=$($init_ld $LDFLAGS -print-search-dirs | egrep '^libraries' \ |
|
299 |
|
| sed -r 's/libraries:[[:space:]]+(.+)/\1/') |
|
300 |
|
echo "gcc library path is $lib_path_nosysroot" |
|
301 |
|
gcc_sysroot=$($init_ld -print-sysroot) |
|
302 |
|
echo "gcc_sysroot (can be empty) is $gcc_sysroot" |
|
303 |
|
|
|
304 |
|
IFS=: |
|
305 |
|
#replace the sysroot marker, '=', in gcc library path |
|
306 |
|
if test -n "$gcc_sysroot"; then |
|
307 |
|
for p in $lib_path_nosysroot; do |
|
308 |
|
lib_path_noncanonical="$lib_path_noncanonical:$(echo "$p" | sed -r "s:^=:$gcc_sysroot:")" |
|
309 |
|
done |
|
310 |
|
else |
|
311 |
|
for p in $lib_path_nosysroot; do |
|
312 |
|
lib_path_noncanonical="$lib_path_noncanonical:$(echo "$p" | sed -r 's/^=//')" |
|
313 |
|
done |
|
314 |
|
fi |
|
315 |
|
|
|
316 |
|
lib_path_noncanonical=${lib_path_noncanonical#:} |
|
317 |
|
|
|
318 |
|
for p in $lib_path_noncanonical; do |
|
319 |
|
if readlink -m -q "$p" >/dev/null 2>&1; then |
|
320 |
|
lib_path="$lib_path:$(readlink -m "$p")" |
|
321 |
|
fi |
|
322 |
|
done |
|
323 |
|
|
|
324 |
|
lib_path=${lib_path#:} |
|
325 |
|
echo "final LIB_PATH=$lib_path" |
|
326 |
|
sep_end |
|
327 |
|
|
|
328 |
|
################################################################################ |
|
329 |
|
|
|
330 |
|
#locate the target elf interpreter which will be copied in the cpio archive |
|
331 |
|
sep_start |
|
332 |
|
if test -z "$elf_interpreter"; then |
|
333 |
|
elf_interpreter=$($readelf -l ./init | egrep 'Requesting program interpreter' | sed -r 's/^.+interpreter:[[:space:]]*(.+)\]/\1/') |
|
334 |
|
fi |
|
335 |
|
echo "will copy $elf_interpreter elf interpreter in cpio archive" |
|
|
257 |
|
echo "INIT_CCLD $init_file_name" |
|
258 |
|
$init_ccld -o $init_file_name $init_obj_files $LIBS |
336 |
259 |
sep_end |
sep_end |
337 |
260 |
|
|
338 |
261 |
################################################################################ |
################################################################################ |
|
... |
... |
echo "dir /lib/modules/$kernel_release 0755 0 0">>cpio |
343 |
266 |
|
|
344 |
267 |
modules=$HW_MODULES,$DISK_MODULES,$FS_MODULES |
modules=$HW_MODULES,$DISK_MODULES,$FS_MODULES |
345 |
268 |
if test -n "$extra_modules";then |
if test -n "$extra_modules";then |
346 |
|
modules=$modules,$extra_modules |
|
|
269 |
|
modules=$modules,$extra_modules |
347 |
270 |
fi |
fi |
348 |
271 |
|
|
349 |
272 |
subsep_start |
subsep_start |
|
... |
... |
$src_path/script/cpio_modules_add.sh $kernel_modules_base_dir $kernel_release \ |
352 |
275 |
$modules ./cpio |
$modules ./cpio |
353 |
276 |
subsep_end |
subsep_end |
354 |
277 |
|
|
355 |
|
subsep_start |
|
356 |
|
#add proper entries in the cpio definition file related to shared elf libs |
|
357 |
|
$src_path/script/cpio_libs_add.sh "$readelf" "$lib_path" ./init \ |
|
358 |
|
"$elf_interpreter" ./cpio |
|
359 |
|
subsep_end |
|
360 |
|
|
|
361 |
278 |
printf "cpio source file is:\n--------\n" |
printf "cpio source file is:\n--------\n" |
362 |
279 |
cat cpio |
cat cpio |
363 |
280 |
echo '--------' |
echo '--------' |