Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 156611
Collapse All | Expand All

(-)genkernel-3.4.5/gen_initramfs.sh (-358 / +192 lines)
Lines 1-6 Link Here
1
#!/bin/bash
1
#!/bin/bash
2
2
3
create_base_layout_cpio() {
3
CPIO_ARGS="--quiet -o -H newc"
4
5
append_base_layout() {
4
	if [ -d "${TEMP}/initramfs-base-temp" ]
6
	if [ -d "${TEMP}/initramfs-base-temp" ]
5
	then
7
	then
6
		rm -rf "${TEMP}/initramfs-base-temp" > /dev/null
8
		rm -rf "${TEMP}/initramfs-base-temp" > /dev/null
Lines 35-45 create_base_layout_cpio() { Link Here
35
	mknod -m 660 null c 1 3
37
	mknod -m 660 null c 1 3
36
	mknod -m 600 tty1 c 4 1
38
	mknod -m 600 tty1 c 4 1
37
	cd "${TEMP}/initramfs-base-temp/"
39
	cd "${TEMP}/initramfs-base-temp/"
38
	find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-base-layout.cpio.gz
40
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
39
	rm -rf "${TEMP}/initramfs-base-temp" > /dev/null
41
	rm -rf "${TEMP}/initramfs-base-temp" > /dev/null
40
}
42
}
41
43
42
create_busybox_cpio() {
44
append_busybox() {
43
	if [ -d "${TEMP}/initramfs-busybox-temp" ]
45
	if [ -d "${TEMP}/initramfs-busybox-temp" ]
44
	then
46
	then
45
		rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
47
		rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
Lines 66-76 create_busybox_cpio() { Link Here
66
	done
68
	done
67
	
69
	
68
	cd "${TEMP}/initramfs-busybox-temp/"
70
	cd "${TEMP}/initramfs-busybox-temp/"
69
	find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-busybox-${BUSYBOX_VER}.cpio.gz
71
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
70
	rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
72
	rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
71
}
73
}
72
74
73
create_insmod_cpio() {
75
append_insmod() {
74
	if [ -d "${TEMP}/initramfs-insmod-temp" ]
76
	if [ -d "${TEMP}/initramfs-insmod-temp" ]
75
	then
77
	then
76
		rm -rf "${TEMP}/initramfs-insmod-temp" > /dev/null
78
		rm -rf "${TEMP}/initramfs-insmod-temp" > /dev/null
Lines 85-95 create_insmod_cpio() { Link Here
85
	chmod +x "${TEMP}/initramfs-insmod-temp/bin/insmod"
87
	chmod +x "${TEMP}/initramfs-insmod-temp/bin/insmod"
86
	
88
	
87
	cd "${TEMP}/initramfs-insmod-temp/"
89
	cd "${TEMP}/initramfs-insmod-temp/"
88
	find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-insmod-${MODULE_INIT_TOOLS_VER}.cpio.gz
90
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
89
	rm -rf "${TEMP}/initramfs-insmod-temp" > /dev/null
91
	rm -rf "${TEMP}/initramfs-insmod-temp" > /dev/null
90
}
92
}
91
93
92
create_udev_cpio(){
94
append_udev(){
93
	if [ -d "${TEMP}/initramfs-udev-temp" ]
95
	if [ -d "${TEMP}/initramfs-udev-temp" ]
94
	then
96
	then
95
		rm -r "${TEMP}/initramfs-udev-temp/"
97
		rm -r "${TEMP}/initramfs-udev-temp/"
Lines 99-109 create_udev_cpio(){ Link Here
99
	[ "${UDEV}" -eq '1' ] && { /bin/tar -jxpf "${UDEV_BINCACHE}" -C "${TEMP}/initramfs-udev-temp" ||
101
	[ "${UDEV}" -eq '1' ] && { /bin/tar -jxpf "${UDEV_BINCACHE}" -C "${TEMP}/initramfs-udev-temp" ||
100
		gen_die "Could not extract udev binary cache!"; }
102
		gen_die "Could not extract udev binary cache!"; }
101
	cd "${TEMP}/initramfs-udev-temp/"
103
	cd "${TEMP}/initramfs-udev-temp/"
102
	find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-udev-${UDEV_VER}.cpio.gz
104
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
103
	rm -rf "${TEMP}/initramfs-udev-temp" > /dev/null
105
	rm -rf "${TEMP}/initramfs-udev-temp" > /dev/null
104
}
106
}
105
107
106
create_blkid_cpio(){
108
append_blkid(){
107
	if [ -d "${TEMP}/initramfs-blkid-temp" ]
109
	if [ -d "${TEMP}/initramfs-blkid-temp" ]
108
	then
110
	then
109
		rm -r "${TEMP}/initramfs-blkid-temp/"
111
		rm -r "${TEMP}/initramfs-blkid-temp/"
Lines 114-124 create_blkid_cpio(){ Link Here
114
		gen_die "Could not extract blkid binary cache!"; }
116
		gen_die "Could not extract blkid binary cache!"; }
115
	chmod a+x "${TEMP}/initramfs-blkid-temp/bin/blkid"
117
	chmod a+x "${TEMP}/initramfs-blkid-temp/bin/blkid"
116
	cd "${TEMP}/initramfs-blkid-temp/"
118
	cd "${TEMP}/initramfs-blkid-temp/"
117
	find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-blkid-${E2FSPROGS_VER}.cpio.gz
119
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
118
	rm -rf "${TEMP}/initramfs-blkid-temp" > /dev/null
120
	rm -rf "${TEMP}/initramfs-blkid-temp" > /dev/null
119
}
121
}
120
122
121
create_devfs_cpio(){
123
append_devfs(){
122
	if [ -d "${TEMP}/initramfs-devfs-temp" ]
124
	if [ -d "${TEMP}/initramfs-devfs-temp" ]
123
	then
125
	then
124
		rm -r "${TEMP}/initramfs-devfs-temp/"
126
		rm -r "${TEMP}/initramfs-devfs-temp/"
Lines 131-179 create_devfs_cpio(){ Link Here
131
	bunzip2 "${TEMP}/initramfs-devfs-temp/bin/devfsd.bz2" || gen_die "could not uncompress devfsd"
133
	bunzip2 "${TEMP}/initramfs-devfs-temp/bin/devfsd.bz2" || gen_die "could not uncompress devfsd"
132
	chmod +x "${TEMP}/initramfs-devfs-temp/bin/devfsd"
134
	chmod +x "${TEMP}/initramfs-devfs-temp/bin/devfsd"
133
	cd "${TEMP}/initramfs-devfs-temp/"
135
	cd "${TEMP}/initramfs-devfs-temp/"
134
	find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-devfs-${DEVFSD_VER}.cpio.gz
136
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
135
	rm -rf "${TEMP}/initramfs-devfs-temp" > /dev/null
137
	rm -rf "${TEMP}/initramfs-devfs-temp" > /dev/null
136
}
138
}
137
139
138
create_unionfs_modules_cpio(){
140
append_unionfs_modules(){
139
	#UNIONFS Modules
141
	if [ -d "${TEMP}/initramfs-unionfs-modules-temp" ]
140
	if [ "${UNIONFS}" -eq '1' ]
141
	then
142
	then
142
		if [ -d "${TEMP}/initramfs-unionfs-modules-temp" ]
143
		rm -r "${TEMP}/initramfs-unionfs-modules-temp/"
143
		then
144
	fi
144
			rm -r "${TEMP}/initramfs-unionfs-modules-temp/"
145
	print_info 1 'UNIONFS MODULES: Adding support (compiling)...'
145
		fi
146
	compile_unionfs_modules
146
		print_info 1 'UNIONFS MODULES: Adding support (compiling)...'
147
	mkdir -p "${TEMP}/initramfs-unionfs-modules-temp/"
147
		compile_unionfs_modules
148
	/bin/tar -jxpf "${UNIONFS_MODULES_BINCACHE}" -C "${TEMP}/initramfs-unionfs-modules-temp" ||
148
		mkdir -p "${TEMP}/initramfs-unionfs-modules-temp/"
149
		gen_die "Could not extract unionfs modules binary cache!";
149
		/bin/tar -jxpf "${UNIONFS_MODULES_BINCACHE}" -C "${TEMP}/initramfs-unionfs-modules-temp" ||
150
			gen_die "Could not extract unionfs modules binary cache!";
151
	cd "${TEMP}/initramfs-unionfs-modules-temp/"
150
	cd "${TEMP}/initramfs-unionfs-modules-temp/"
152
	find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-unionfs-${UNIONFS_VER}-modules-${KV}.cpio.gz
151
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
153
	rm -r "${TEMP}/initramfs-unionfs-modules-temp/"
152
	rm -r "${TEMP}/initramfs-unionfs-modules-temp/"
154
	fi
155
}
153
}
156
154
157
create_unionfs_tools_cpio(){
155
append_unionfs_tools(){
158
	#UNIONFS Tools
156
	if [ -d "${TEMP}/initramfs-unionfs-tools-temp" ]
159
	if [ "${UNIONFS}" -eq '1' ]
160
	then
157
	then
161
		if [ -d "${TEMP}/initramfs-unionfs-tools-temp" ]
162
		then
163
			rm -r "${TEMP}/initramfs-unionfs-tools-temp/"
164
		fi
165
		print_info 1 'UNIONFS TOOLS: Adding support (compiling)...'
166
		compile_unionfs_utils
167
		mkdir -p "${TEMP}/initramfs-unionfs-tools-temp/bin/"
168
		/bin/tar -jxpf "${UNIONFS_BINCACHE}" -C "${TEMP}/initramfs-unionfs-tools-temp" ||
169
			gen_die "Could not extract unionfs tools binary cache!";
170
		cd "${TEMP}/initramfs-unionfs-tools-temp/"
171
		find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-unionfs-${UNIONFS_VER}-tools.cpio.gz
172
		rm -r "${TEMP}/initramfs-unionfs-tools-temp/"
158
		rm -r "${TEMP}/initramfs-unionfs-tools-temp/"
173
	fi										        
159
	fi
160
	print_info 1 'UNIONFS TOOLS: Adding support (compiling)...'
161
	compile_unionfs_utils
162
	mkdir -p "${TEMP}/initramfs-unionfs-tools-temp/bin/"
163
	/bin/tar -jxpf "${UNIONFS_BINCACHE}" -C "${TEMP}/initramfs-unionfs-tools-temp" ||
164
		gen_die "Could not extract unionfs tools binary cache!";
165
	cd "${TEMP}/initramfs-unionfs-tools-temp/"
166
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
167
	rm -r "${TEMP}/initramfs-unionfs-tools-temp/"
174
}
168
}
175
169
176
create_suspend_cpio(){
170
append_suspend(){
177
	if [ -d "${TEMP}/initramfs-suspend-temp" ];
171
	if [ -d "${TEMP}/initramfs-suspend-temp" ];
178
	then
172
	then
179
		rm -r "${TEMP}/initramfs-suspend-temp/"
173
		rm -r "${TEMP}/initramfs-suspend-temp/"
Lines 187-343 create_suspend_cpio(){ Link Here
187
	cp -f /etc/suspend.conf "${TEMP}/initramfs-suspend-temp/etc" ||
181
	cp -f /etc/suspend.conf "${TEMP}/initramfs-suspend-temp/etc" ||
188
		gen_die 'Could not copy /etc/suspend.conf'
182
		gen_die 'Could not copy /etc/suspend.conf'
189
	cd "${TEMP}/initramfs-suspend-temp/"
183
	cd "${TEMP}/initramfs-suspend-temp/"
190
	find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-suspend-${SUSPEND_VER}.cpio.gz
184
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
185
	rm -r "${TEMP}/initramfs-suspend-temp/"
191
}
186
}
192
187
193
create_dmraid_cpio(){
188
append_dmraid(){
194
	# DMRAID
189
	if [ -d "${TEMP}/initramfs-dmraid-temp" ]
195
	if [ "${DMRAID}" = '1' ]
196
	then
190
	then
197
		if [ -d "${TEMP}/initramfs-dmraid-temp" ]
198
		then
199
			rm -r "${TEMP}/initramfs-dmraid-temp/"
200
		fi
201
		print_info 1 'DMRAID: Adding support (compiling binaries)...'
202
		compile_dmraid
203
		mkdir -p "${TEMP}/initramfs-dmraid-temp/"
204
		/bin/tar -jxpf "${DMRAID_BINCACHE}" -C "${TEMP}/initramfs-dmraid-temp" ||
205
			gen_die "Could not extract dmraid binary cache!";
206
		cd "${TEMP}/initramfs-dmraid-temp/"
207
		find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-dmraid-${DMRAID_VER}.cpio.gz
208
		rm -r "${TEMP}/initramfs-dmraid-temp/"
191
		rm -r "${TEMP}/initramfs-dmraid-temp/"
209
	fi										        
192
	fi
193
	print_info 1 'DMRAID: Adding support (compiling binaries)...'
194
	compile_dmraid
195
	mkdir -p "${TEMP}/initramfs-dmraid-temp/"
196
	/bin/tar -jxpf "${DMRAID_BINCACHE}" -C "${TEMP}/initramfs-dmraid-temp" ||
197
		gen_die "Could not extract dmraid binary cache!";
198
	cd "${TEMP}/initramfs-dmraid-temp/"
199
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
200
	rm -r "${TEMP}/initramfs-dmraid-temp/"
210
}
201
}
211
202
212
create_lvm2_cpio(){
203
append_lvm2(){
213
	# LVM2
204
	if [ -d "${TEMP}/initramfs-lvm2-temp" ]
214
	if [ "${LVM2}" -eq '1' ]
215
	then
205
	then
216
		if [ -d "${TEMP}/initramfs-lvm2-temp" ]
217
		then
218
			rm -r "${TEMP}/initramfs-lvm2-temp/"
219
		fi
220
		cd ${TEMP}
221
		mkdir -p "${TEMP}/initramfs-lvm2-temp/bin/"
222
		mkdir -p "${TEMP}/initramfs-lvm2-temp/etc/lvm/"
223
		if [ -e '/sbin/lvm' ] && ldd /sbin/lvm|grep -q 'not a dynamic executable';
224
		then
225
			print_info 1 '		LVM2: Adding support (using local static binaries)...'
226
			cp /sbin/lvm "${TEMP}/initramfs-lvm2-temp/bin/lvm" ||
227
				gen_die 'Could not copy over lvm!'
228
		else
229
			print_info 1 '		LVM2: Adding support (compiling binaries)...'
230
			compile_lvm2
231
			/bin/tar -jxpf "${LVM2_BINCACHE}" -C "${TEMP}/initramfs-lvm2-temp" ||
232
				gen_die "Could not extract lvm2 binary cache!";
233
			mv ${TEMP}/initramfs-lvm2-temp/sbin/lvm.static ${TEMP}/initramfs-lvm2-temp/bin/lvm ||
234
				gen_die 'LVM2 error: Could not move lvm.static to lvm!'
235
		fi
236
		cp /etc/lvm/lvm.conf "${TEMP}/initramfs-lvm2-temp/etc/lvm/lvm.conf" ||
237
			gen_die 'Could not copy over lvm.conf!'
238
		cd "${TEMP}/initramfs-lvm2-temp/"
239
		find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-lvm2-${LVM2_VER}.cpio.gz
240
		rm -r "${TEMP}/initramfs-lvm2-temp/"
206
		rm -r "${TEMP}/initramfs-lvm2-temp/"
241
	else # Deprecation warning; remove in a few versions.
242
		if [ -e '/sbin/lvm' ]
243
		then
244
			if ldd /sbin/lvm|grep -q 'not a dynamic executable';
245
			then
246
				print_warning 1 'LVM2: For support, use --lvm2!'
247
			fi
248
		fi
249
	fi
207
	fi
208
	cd ${TEMP}
209
	mkdir -p "${TEMP}/initramfs-lvm2-temp/bin/"
210
	mkdir -p "${TEMP}/initramfs-lvm2-temp/etc/lvm/"
211
	if [ -e '/sbin/lvm' ] && ldd /sbin/lvm|grep -q 'not a dynamic executable';
212
	then
213
		print_info 1 '		LVM2: Adding support (using local static binaries)...'
214
		cp /sbin/lvm "${TEMP}/initramfs-lvm2-temp/bin/lvm" ||
215
			gen_die 'Could not copy over lvm!'
216
	else
217
		print_info 1 '		LVM2: Adding support (compiling binaries)...'
218
		compile_lvm2
219
		/bin/tar -jxpf "${LVM2_BINCACHE}" -C "${TEMP}/initramfs-lvm2-temp" ||
220
			gen_die "Could not extract lvm2 binary cache!";
221
		mv ${TEMP}/initramfs-lvm2-temp/sbin/lvm.static ${TEMP}/initramfs-lvm2-temp/bin/lvm ||
222
			gen_die 'LVM2 error: Could not move lvm.static to lvm!'
223
	fi
224
	cp /etc/lvm/lvm.conf "${TEMP}/initramfs-lvm2-temp/etc/lvm/lvm.conf" ||
225
		gen_die 'Could not copy over lvm.conf!'
226
	cd "${TEMP}/initramfs-lvm2-temp/"
227
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
228
	rm -r "${TEMP}/initramfs-lvm2-temp/"
250
}
229
}
251
230
252
create_evms2_cpio(){	
231
append_evms2(){
253
	# EVMS2
232
	if [ -d "${TEMP}/initramfs-evms2-temp" ]
254
	if [ -e '/sbin/evms_activate' ]
255
	then
233
	then
256
		if [ -d "${TEMP}/initramfs-evms2-temp" ]
257
		then
258
			rm -r "${TEMP}/initramfs-evms2-temp/"
259
		fi
260
		mkdir -p "${TEMP}/initramfs-evms2-temp/lib/evms"
261
		mkdir -p "${TEMP}/initramfs-evms2-temp/etc/"
262
		mkdir -p "${TEMP}/initramfs-evms2-temp/bin/"
263
		mkdir -p "${TEMP}/initramfs-evms2-temp/sbin/"
264
		if [ "${EVMS2}" -eq '1' ]
265
		then
266
			print_info 1 '		EVMS2: Adding support...'	
267
			mkdir -p ${TEMP}/initramfs-evms2-temp/lib
268
			cp -a /lib/ld-* "${TEMP}/initramfs-evms2-temp/lib" \
269
				|| gen_die 'Could not copy files for EVMS2!'
270
			if [ -n "`ls /lib/libgcc_s*`" ]
271
			then
272
				cp -a /lib/libgcc_s* "${TEMP}/initramfs-evms2-temp/lib" \
273
					|| gen_die 'Could not copy files for EVMS2!'
274
			fi
275
			cp -a /lib/libc-* /lib/libc.* "${TEMP}/initramfs-evms2-temp/lib" \
276
				|| gen_die 'Could not copy files for EVMS2!'
277
			cp -a /lib/libdl-* /lib/libdl.* "${TEMP}/initramfs-evms2-temp/lib" \
278
				|| gen_die 'Could not copy files for EVMS2!'
279
			cp -a /lib/libpthread* "${TEMP}/initramfs-evms2-temp/lib" \
280
				|| gen_die 'Could not copy files for EVMS2!'
281
			cp -a /lib/libuuid*so* "${TEMP}/initramfs-evms2-temp/lib" \
282
				|| gen_die 'Could not copy files for EVMS2!'
283
			cp -a /lib/libevms*so* "${TEMP}/initramfs-evms2-temp/lib" \
284
				|| gen_die 'Could not copy files for EVMS2!'
285
			cp -a /lib/evms "${TEMP}/initramfs-evms2-temp/lib" \
286
				|| gen_die 'Could not copy files for EVMS2!'
287
			cp -a /lib/evms/* "${TEMP}/initramfs-evms2-temp/lib/evms" \
288
				|| gen_die 'Could not copy files for EVMS2!'
289
			cp -a /etc/evms.conf "${TEMP}/initramfs-evms2-temp/etc" \
290
				|| gen_die 'Could not copy files for EVMS2!'
291
			cp /sbin/evms_activate "${TEMP}/initramfs-evms2-temp/sbin" \
292
				|| gen_die 'Could not copy over evms_activate!'
293
294
			# Fix EVMS2 complaining that it can't find the swap utilities.
295
			# These are not required in the initramfs
296
			for swap_libs in "${TEMP}/initramfs-evms2-temp/lib/evms/*/swap*.so"
297
			do
298
				rm ${swap_libs}
299
			done
300
		fi
301
		cd "${TEMP}/initramfs-evms2-temp/"
302
		find . -print | cpio --quiet -o -H newc \
303
			| gzip -9 > ${CACHE_CPIO_DIR}/initramfs-evms2.cpio.gz
304
		rm -r "${TEMP}/initramfs-evms2-temp/"
234
		rm -r "${TEMP}/initramfs-evms2-temp/"
305
	fi	
235
	fi
306
}
236
	mkdir -p "${TEMP}/initramfs-evms2-temp/lib/evms"
307
237
	mkdir -p "${TEMP}/initramfs-evms2-temp/etc/"
308
create_gensplash(){	
238
	mkdir -p "${TEMP}/initramfs-evms2-temp/bin/"
309
	if [ "${GENSPLASH}" -eq '1' ]
239
	mkdir -p "${TEMP}/initramfs-evms2-temp/sbin/"
310
	then
240
	if [ "${EVMS2}" -eq '1' ]
311
		if [ -x /usr/bin/splash_geninitramfs ] || [ -x /sbin/splash_geninitramfs ]
241
	then
242
		print_info 1 '		EVMS2: Adding support...'
243
		mkdir -p ${TEMP}/initramfs-evms2-temp/lib
244
		cp -a /lib/ld-* "${TEMP}/initramfs-evms2-temp/lib" \
245
			|| gen_die 'Could not copy files for EVMS2!'
246
		if [ -n "`ls /lib/libgcc_s*`" ]
312
		then
247
		then
313
			[ -z "${GENSPLASH_THEME}" ] && [ -e /etc/conf.d/splash ] && source /etc/conf.d/splash
248
			cp -a /lib/libgcc_s* "${TEMP}/initramfs-evms2-temp/lib" \
314
			[ -z "${GENSPLASH_THEME}" ] && GENSPLASH_THEME=default
249
				|| gen_die 'Could not copy files for EVMS2!'
315
			print_info 1 "  >> Installing gensplash [ using the ${GENSPLASH_THEME} theme ]..."
316
			cd /
317
			local tmp=""
318
			[ -n "${GENSPLASH_RES}" ] && tmp="-r ${GENSPLASH_RES}"
319
			splash_geninitramfs -g ${CACHE_CPIO_DIR}/initramfs-splash-${KV}.cpio.gz ${tmp} ${GENSPLASH_THEME} || gen_die "Could not build splash cpio archive"
320
			if [ -e "/usr/share/splashutils/initrd.splash" ]; then
321
				if [ -d "${TEMP}/initramfs-gensplash-temp" ]
322
				then
323
					rm -r "${TEMP}/initramfs-gensplash-temp/"
324
				fi
325
				mkdir -p "${TEMP}/initramfs-gensplash-temp/etc"
326
				cd "${TEMP}/initramfs-gensplash-temp/"
327
				gunzip -c ${CACHE_CPIO_DIR}/initramfs-splash-${KV}.cpio.gz | cpio -idm --quiet -H newc || gen_die "unpacking splash cpio"
328
				cp -f "/usr/share/splashutils/initrd.splash" "${TEMP}/initramfs-gensplash-temp/etc"
329
				find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-splash-${KV}.cpio.gz || gen_die "compressing splash cpio"
330
				rm -r "${TEMP}/initramfs-gensplash-temp/"
331
			fi
332
		else
333
			print_warning 1 '               >> No splash detected; skipping!'
334
		fi
250
		fi
251
		cp -a /lib/libc-* /lib/libc.* "${TEMP}/initramfs-evms2-temp/lib" \
252
			|| gen_die 'Could not copy files for EVMS2!'
253
		cp -a /lib/libdl-* /lib/libdl.* "${TEMP}/initramfs-evms2-temp/lib" \
254
			|| gen_die 'Could not copy files for EVMS2!'
255
		cp -a /lib/libpthread* "${TEMP}/initramfs-evms2-temp/lib" \
256
			|| gen_die 'Could not copy files for EVMS2!'
257
		cp -a /lib/libuuid*so* "${TEMP}/initramfs-evms2-temp/lib" \
258
			|| gen_die 'Could not copy files for EVMS2!'
259
		cp -a /lib/libevms*so* "${TEMP}/initramfs-evms2-temp/lib" \
260
			|| gen_die 'Could not copy files for EVMS2!'
261
		cp -a /lib/evms "${TEMP}/initramfs-evms2-temp/lib" \
262
			|| gen_die 'Could not copy files for EVMS2!'
263
		cp -a /lib/evms/* "${TEMP}/initramfs-evms2-temp/lib/evms" \
264
			|| gen_die 'Could not copy files for EVMS2!'
265
		cp -a /etc/evms.conf "${TEMP}/initramfs-evms2-temp/etc" \
266
			|| gen_die 'Could not copy files for EVMS2!'
267
		cp /sbin/evms_activate "${TEMP}/initramfs-evms2-temp/sbin" \
268
			|| gen_die 'Could not copy over evms_activate!'
269
270
		# Fix EVMS2 complaining that it can't find the swap utilities.
271
		# These are not required in the initramfs
272
		for swap_libs in "${TEMP}/initramfs-evms2-temp/lib/evms/*/swap*.so"
273
		do
274
			rm ${swap_libs}
275
		done
276
	fi
277
	cd "${TEMP}/initramfs-evms2-temp/"
278
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
279
	rm -r "${TEMP}/initramfs-evms2-temp/"
280
}
281
282
append_gensplash(){
283
	if [ -x /usr/bin/splash_geninitramfs ] || [ -x /sbin/splash_geninitramfs ]
284
	then
285
		[ -z "${GENSPLASH_THEME}" ] && [ -e /etc/conf.d/splash ] && source /etc/conf.d/splash
286
		[ -z "${GENSPLASH_THEME}" ] && GENSPLASH_THEME=default
287
		print_info 1 "  >> Installing gensplash [ using the ${GENSPLASH_THEME} theme ]..."
288
		if [ -d "${TEMP}/initramfs-gensplash-temp" ]
289
		then
290
			rm -r "${TEMP}/initramfs-gensplash-temp/"
291
		fi
292
		mkdir -p "${TEMP}/initramfs-gensplash-temp"
293
		cd /
294
		local tmp=""
295
		[ -n "${GENSPLASH_RES}" ] && tmp="-r ${GENSPLASH_RES}"
296
		splash_geninitramfs -c "${TEMP}/initramfs-gensplash-temp" ${tmp} ${GENSPLASH_THEME} || gen_die "Could not build splash cpio archive"
297
		if [ -e "/usr/share/splashutils/initrd.splash" ]; then
298
			mkdir -p "${TEMP}/initramfs-gensplash-temp/etc"
299
			cp -f "/usr/share/splashutils/initrd.splash" "${TEMP}/initramfs-gensplash-temp/etc"
300
		fi
301
		cd "${TEMP}/initramfs-gensplash-temp/"
302
		find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
303
			|| gen_die "compressing splash cpio"
304
		rm -r "${TEMP}/initramfs-gensplash-temp/"
305
	else
306
		print_warning 1 '               >> No splash detected; skipping!'
335
	fi
307
	fi
336
}
308
}
337
309
338
create_initramfs_overlay_cpio(){
310
append_overlay(){
339
	cd ${INITRAMFS_OVERLAY}
311
	cd ${INITRAMFS_OVERLAY}
340
	find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-overlay.cpio.gz
312
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
341
}
313
}
342
print_list()
314
print_list()
343
{
315
{
Lines 348-358 print_list() Link Here
348
	done
320
	done
349
}
321
}
350
322
351
create_initramfs_modules() {
323
append_modules() {
352
	local group
324
	local group
353
	local group_modules
325
	local group_modules
354
	
326
	local MOD_EXT=".ko"
355
	MOD_EXT=".ko"
356
327
357
	print_info 2 "initramfs: >> Searching for modules..."
328
	print_info 2 "initramfs: >> Searching for modules..."
358
	if [ "${INSTALL_MOD_PATH}" != '' ]
329
	if [ "${INSTALL_MOD_PATH}" != '' ]
Lines 388-394 create_initramfs_modules() { Link Here
388
		print_list ${!group_modules} > "${TEMP}/initramfs-modules-${KV}-temp/etc/modules/${group}"
359
		print_list ${!group_modules} > "${TEMP}/initramfs-modules-${KV}-temp/etc/modules/${group}"
389
	done
360
	done
390
	cd "${TEMP}/initramfs-modules-${KV}-temp/"
361
	cd "${TEMP}/initramfs-modules-${KV}-temp/"
391
	find . | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-modules-${KV}.cpio.gz
362
	find . | cpio ${CPIO_ARGS} --append -F "${CPIO}"
392
	rm -r "${TEMP}/initramfs-modules-${KV}-temp/"	
363
	rm -r "${TEMP}/initramfs-modules-${KV}-temp/"	
393
}
364
}
394
365
Lines 398-404 is_static() { Link Here
398
	return $?
369
	return $?
399
}
370
}
400
371
401
create_initramfs_aux() {
372
append_auxilary() {
402
	if [ -d "${TEMP}/initramfs-aux-temp" ]
373
	if [ -d "${TEMP}/initramfs-aux-temp" ]
403
	then
374
	then
404
		rm -r "${TEMP}/initramfs-aux-temp/"
375
		rm -r "${TEMP}/initramfs-aux-temp/"
Lines 485-574 create_initramfs_aux() { Link Here
485
	chmod +x "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
456
	chmod +x "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
486
	chmod +x "${TEMP}/initramfs-aux-temp/sbin/modprobe"
457
	chmod +x "${TEMP}/initramfs-aux-temp/sbin/modprobe"
487
	cd "${TEMP}/initramfs-aux-temp/"
458
	cd "${TEMP}/initramfs-aux-temp/"
488
	find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-aux.cpio.gz
459
	find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
489
	rm -r "${TEMP}/initramfs-aux-temp/"	
460
	rm -r "${TEMP}/initramfs-aux-temp/"	
490
}
461
}
491
462
492
merge_initramfs_cpio_archives(){
463
append_data() {
493
	cd "${CACHE_CPIO_DIR}"
464
	local name=$1 var=$2
494
	MERGE_LIST="initramfs-base-layout.cpio.gz initramfs-aux.cpio.gz"	
465
	local func="append_${name}"
495
	if [ ! -e "${CACHE_CPIO_DIR}/initramfs-base-layout.cpio.gz" ]
466
496
	then
467
	if [ $# -eq '1' ] || [ "${var}" -eq '1' ]
497
		gen_die "${CACHE_CPIO_DIR}/initramfs-base-layout.cpio.gz is missing."
498
	fi
499
	if [ ! -e "${CACHE_CPIO_DIR}/initramfs-aux.cpio.gz" ]
500
	then
501
		gen_die "${CACHE_CPIO_DIR}/initramfs-aux.cpio.gz is missing."
502
	fi
503
	
504
	if [ "${BUSYBOX}" -eq '1' -a -e ${CACHE_CPIO_DIR}/initramfs-busybox-${BUSYBOX_VER}.cpio.gz ]
505
	then
506
		MERGE_LIST="${MERGE_LIST} initramfs-busybox-${BUSYBOX_VER}.cpio.gz"
507
	fi
508
	
509
	if [ "${NOINITRDMODULES}" = '' -a -e ${CACHE_CPIO_DIR}/initramfs-insmod-${MODULE_INIT_TOOLS_VER}.cpio.gz ]
510
	then
468
	then
511
		MERGE_LIST="${MERGE_LIST} initramfs-insmod-${MODULE_INIT_TOOLS_VER}.cpio.gz"
469
	    print_info 1 "        >> Appending ${name} cpio data..."
470
	    ${func}
512
	fi
471
	fi
472
}
473
474
create_initramfs() {
475
	print_info 1 "initramfs: >> Initializing..."
476
477
	# Create empty cpio
478
	CPIO="${TMPDIR}/initramfs-${KV}"
479
	echo | cpio ${CPIO_ARGS} -F "${CPIO}" 2>/dev/null \
480
		|| gen_die "Could not create empty cpio at ${CPIO}"
481
482
	append_data 'base_layout'
483
	append_data 'auxilary'
484
	append_data 'busybox' "${BUSYBOX}"
485
	append_data 'devfs' "${DEVFS}"
486
#	append_data 'udev' "${UDEV}"
487
	append_data 'unionfs_modules' "${UNIONFS}"
488
	append_data 'unionfs_tools' "${UNIONFS}"
489
	append_data 'suspend' "${SUSPEND}"
490
	append_data 'lvm2' "${LVM2}"
491
	append_data 'dmraid' "${DMRAID}"
492
	append_data 'evms2' "${EVMS2}"
513
	
493
	
514
#	if [ "${UDEV}" -eq '1' -a -e ${CACHE_CPIO_DIR}/initramfs-udev-${UDEV_VER}.cpio.gz ]
494
	if [ "${NOINITRDMODULES}" = '' ]
515
#	then
516
#		MERGE_LIST="${MERGE_LIST} initramfs-udev-${UDEV_VER}.cpio.gz"
517
#	fi
518
	if [ "${DISKLABEL}" -eq '1' -a -e ${CACHE_CPIO_DIR}/initramfs-blkid-${E2FSPROGS_VER}.cpio.gz ]
519
	then
520
		MERGE_LIST="${MERGE_LIST} initramfs-blkid-${E2FSPROGS_VER}.cpio.gz"
521
	fi
522
	if [ "${UNIONFS}" -eq '1' -a -e ${CACHE_CPIO_DIR}/initramfs-unionfs-${UNIONFS_VER}-tools.cpio.gz ]
523
	then
524
		MERGE_LIST="${MERGE_LIST} initramfs-unionfs-${UNIONFS_VER}-tools.cpio.gz"
525
	fi
526
	if [ "${UNIONFS}" -eq '1' -a -e ${CACHE_CPIO_DIR}/initramfs-unionfs-${UNIONFS_VER}-modules-${KV}.cpio.gz ]
527
	then
528
		MERGE_LIST="${MERGE_LIST} initramfs-unionfs-${UNIONFS_VER}-modules-${KV}.cpio.gz"
529
	fi
530
	if [ "${SUSPEND}" -eq '1' -a -e "${CACHE_CPIO_DIR}/initramfs-suspend-${SUSPEND_VER}.cpio.gz" ]
531
	then
532
		MERGE_LIST="${MERGE_LIST} initramfs-suspend-${SUSPEND_VER}.cpio.gz"
533
	fi
534
	if [ "${EVMS2}" -eq '1' -a -e "${CACHE_CPIO_DIR}/initramfs-evms2.cpio.gz" ]
535
	then
536
		MERGE_LIST="${MERGE_LIST} initramfs-evms2.cpio.gz"
537
	fi
538
	if [ "${LVM2}" -eq '1' -a -e "${CACHE_CPIO_DIR}/initramfs-lvm2-${LVM2_VER}.cpio.gz" ]
539
	then
540
		MERGE_LIST="${MERGE_LIST} initramfs-lvm2-${LVM2_VER}.cpio.gz"
541
	fi
542
	if [ "${DEVFS}" -eq '1' -a -e "${CACHE_CPIO_DIR}/initramfs-devfs-${DEVFSD_VER}.cpio.gz" ]
543
	then
544
		MERGE_LIST="${MERGE_LIST} initramfs-devfs-${DEVFSD_VER}.cpio.gz"
545
	fi
546
	if [ "${DMRAID}" -eq '1' -a -e ${CACHE_CPIO_DIR}/initramfs-dmraid-${DMRAID_VER}.cpio.gz ]
547
	then
548
		MERGE_LIST="${MERGE_LIST} initramfs-dmraid-${DMRAID_VER}.cpio.gz"
549
	fi
550
	if [ "${NOINITRDMODULES}" = '' -a -e "${CACHE_CPIO_DIR}/initramfs-modules-${KV}.cpio.gz" ]
551
	then
552
		MERGE_LIST="${MERGE_LIST} initramfs-modules-${KV}.cpio.gz"
553
	fi
554
	if [ "${GENSPLASH}" -eq '1' -a -e "${CACHE_CPIO_DIR}/initramfs-splash-${KV}.cpio.gz" ]
555
	then
495
	then
556
		MERGE_LIST="${MERGE_LIST} initramfs-splash-${KV}.cpio.gz"
496
		append_data 'insmod'
497
		append_data 'modules'
498
	else
499
		print_info 1 "initramfs: Not copying modules..."
557
	fi
500
	fi
501
502
	append_data 'blkid' "${DISKLABEL}"
503
	append_data 'gensplash' "${GENSPLASH}"
504
558
	# This should always be appended last
505
	# This should always be appended last
559
	if [ "${INITRAMFS_OVERLAY}" != '' -a -e "${CACHE_CPIO_DIR}/initramfs-overlay.cpio.gz" ]
506
	if [ "${INITRAMFS_OVERLAY}" != '' ]
560
	then
507
	then
561
		MERGE_LIST="${MERGE_LIST} initramfs-overlay.cpio.gz"
508
		append_data 'overlay'
562
	fi
509
	fi
563
	
564
	echo
565
	print_info 1 "Merging"
566
	for i in ${MERGE_LIST}
567
	do
568
		print_info 1 "    $i"
569
	done
570
510
571
    	cat ${MERGE_LIST} > ${TMPDIR}/initramfs-${KV}
511
	gzip -9 "${CPIO}"
512
	mv -f "${CPIO}.gz" "${CPIO}"
572
513
573
	# Pegasos hack for merging the initramfs into the kernel at compile time
514
	# Pegasos hack for merging the initramfs into the kernel at compile time
574
	[ "${KERNEL_MAKE_DIRECTIVE}" == 'zImage.initrd' -a "${GENERATE_Z_IMAGE}" = '1' ] ||
515
	[ "${KERNEL_MAKE_DIRECTIVE}" == 'zImage.initrd' -a "${GENERATE_Z_IMAGE}" = '1' ] ||
Lines 581-693 merge_initramfs_cpio_archives(){ Link Here
581
		cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/initramfs.cpio.gz
522
		cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/initramfs.cpio.gz
582
		gunzip -f ${KERNEL_DIR}/initramfs.cpio.gz
523
		gunzip -f ${KERNEL_DIR}/initramfs.cpio.gz
583
	fi
524
	fi
584
}
585
586
clear_cpio_dir(){
587
	if [ "${CLEAR_CPIO_CACHE}" == 'yes' ]
588
	then
589
590
		if [ -d ${CACHE_CPIO_DIR} ]
591
		then
592
			print_info 1 "        >> Clearing old cpio archives..."
593
	    		rm -r ${CACHE_CPIO_DIR}
594
		fi
595
	fi
596
	
597
	if [ ! -d ${CACHE_CPIO_DIR} ]
598
	then
599
		mkdir -p ${CACHE_CPIO_DIR}
600
	fi
601
}
602
603
create_initramfs() {
604
	local MOD_EXT
605
606
	print_info 1 "initramfs: >> Initializing..."
607
	clear_cpio_dir
608
	mkdir -p ${CACHE_CPIO_DIR}
609
	print_info 1 "        >> Creating base_layout cpio archive..."
610
	create_base_layout_cpio
611
	
612
	print_info 1 "        >> Creating auxilary cpio archive..."
613
	create_initramfs_aux
614
	
615
	if [ "${BUSYBOX}" -eq '1' ]
616
	then
617
	    print_info 1 "        >> Creating busybox cpio archive..."
618
	    create_busybox_cpio
619
	fi
620
	
621
	if [ "${DEVFS}" -eq '1' ]
622
	then
623
	    print_info 1 "        >> Creating devfs cpio archive..."
624
	    create_devfs_cpio
625
	fi
626
	
627
#	if [ "${UDEV}" -eq '1' ]
628
#	then
629
#	    print_info 1 "        >> Creating udev cpio archive..."
630
#	    create_udev_cpio
631
#	fi
632
	
633
	if [ "${UNIONFS}" -eq '1' ]
634
	then
635
	    print_info 1 "        >> Creating unionfs modules cpio archive..."
636
	    create_unionfs_modules_cpio
637
	    print_info 1 "        >> Creating unionfs tools cpio archive..."
638
	    create_unionfs_tools_cpio
639
	fi
640
641
	if [ "${SUSPEND}" -eq '1' ]
642
	then
643
	    print_info 1 "        >> Creating suspend cpio archive..."
644
	    create_suspend_cpio
645
	fi
646
	
647
	if [ "${LVM2}" -eq '1' ]
648
	then
649
	    
650
	    print_info 1 "        >> Creating lvm2 cpio archive..."
651
	    create_lvm2_cpio
652
	fi
653
	
654
	if [ "${DMRAID}" -eq '1' ]
655
	then
656
	    print_info 1 "        >> Creating dmraid cpio archive..."
657
	    create_dmraid_cpio
658
	fi
659
	
660
	if [ "${EVMS2}" -eq '1' -a -e '/sbin/evms_activate' ]
661
	then
662
		print_info 1 "        >> Creating evms2 cpio archive..."
663
		create_evms2_cpio
664
	fi
665
	
666
	if [ "${NOINITRDMODULES}" = '' ]
667
	then
668
		print_info 1 "        >> Creating insmod cpio archive..."
669
		create_insmod_cpio
670
		print_info 1 "        >> Creating modules cpio archive..."
671
		create_initramfs_modules
672
	else
673
		print_info 1 "initramfs: Not copying modules..."
674
	fi
675
	
676
	if [ "${DISKLABEL}" -eq '1' ]
677
	then
678
		print_info 1 "        >> Creating blkid cpio archive..."
679
		create_blkid_cpio
680
	fi
681
		
682
	create_gensplash
683
	
684
	if [ "${INITRAMFS_OVERLAY}" != '' ]
685
	then
686
		print_info 1 "        >> Creating initramfs_overlay cpio archive..."
687
		create_initramfs_overlay_cpio
688
	fi
689
	
690
	merge_initramfs_cpio_archives
691
525
692
	if ! isTrue "${CMD_NOINSTALL}"
526
	if ! isTrue "${CMD_NOINSTALL}"
693
	then
527
	then
(-)genkernel-3.4.5/gen_determineargs.sh (-1 lines)
Lines 196-202 determine_real_args() { Link Here
196
	fi
196
	fi
197
197
198
	CACHE_DIR=`arch_replace "${CACHE_DIR}"`
198
	CACHE_DIR=`arch_replace "${CACHE_DIR}"`
199
	CACHE_CPIO_DIR="${CACHE_DIR}/cpio"
200
	BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"`
199
	BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"`
201
	MODULE_INIT_TOOLS_BINCACHE=`cache_replace "${MODULE_INIT_TOOLS_BINCACHE}"`
200
	MODULE_INIT_TOOLS_BINCACHE=`cache_replace "${MODULE_INIT_TOOLS_BINCACHE}"`
202
	MODUTILS_BINCACHE=`cache_replace "${MODUTILS_BINCACHE}"`
201
	MODUTILS_BINCACHE=`cache_replace "${MODUTILS_BINCACHE}"`
(-)genkernel-3.4.5/genkernel (-4 lines)
Lines 45-54 cleanup(){ Link Here
45
	    CLEAR_CACHE_DIR='yes'
45
	    CLEAR_CACHE_DIR='yes'
46
	    setup_cache_dir
46
	    setup_cache_dir
47
	    echo
47
	    echo
48
	    print_info 1 "CACHE_CPIO_DIR: ${CACHE_CPIO_DIR}"
49
	    CLEAR_CPIO_CACHE='yes'
50
	    clear_cpio_dir
51
	    echo
52
	    print_info 1 "TMPDIR: ${TMPDIR}"
48
	    print_info 1 "TMPDIR: ${TMPDIR}"
53
	    clear_tmpdir
49
	    clear_tmpdir
54
	    fi
50
	    fi
(-)genkernel-3.4.5/genkernel.conf (-3 lines)
Lines 33-41 USECOLOR="yes" Link Here
33
# Add new kernel to grub?
33
# Add new kernel to grub?
34
# BOOTLOADER="grub"
34
# BOOTLOADER="grub"
35
35
36
# Clear initramfs cpio cache dir
37
# CLEAR_CPIO_CACHE="yes"
38
39
# Clear build cache dir
36
# Clear build cache dir
40
# CLEAR_CACHE_DIR="yes"
37
# CLEAR_CACHE_DIR="yes"
41
38

Return to bug 156611