40 lines
		
	
	
	
		
			830 B
		
	
	
	
		
			Text
		
	
	
	
	
	
		
		
			
		
	
	
			40 lines
		
	
	
	
		
			830 B
		
	
	
	
		
			Text
		
	
	
	
	
	
| 
								 | 
							
								#!/bin/sh
							 | 
						||
| 
								 | 
							
								# Nico Schottelius
							 | 
						||
| 
								 | 
							
								# build, install and test cinit in an uml image
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								set -e
							 | 
						||
| 
								 | 
							
								set -x
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								###################### Params ########################################
							 | 
						||
| 
								 | 
							
								# where the cinit source can be found
							 | 
						||
| 
								 | 
							
								CINIT=/root/cinit-0.1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# the image you want to put cinit on (I am using gentoo stage3)
							 | 
						||
| 
								 | 
							
								IMG=stage3-p4.img
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# where to mount the image
							 | 
						||
| 
								 | 
							
								MNT=/mnt/uml
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# what fsck to use
							 | 
						||
| 
								 | 
							
								FSCK=fsck.jfs
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# the uml-linux-kernel
							 | 
						||
| 
								 | 
							
								LINUX=./linux-2.6.11.11
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# parameters to kernel - should not needed to be changed
							 | 
						||
| 
								 | 
							
								LINUX_PARAM="ubd0=$IMG umid=cinit$$ init=/sbin/cinit"
							 | 
						||
| 
								 | 
							
								######################################################################
							 | 
						||
| 
								 | 
							
								HIER=$(pwd)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								"$FSCK" "$IMG"
							 | 
						||
| 
								 | 
							
								mount "$IMG" "$MNT" -o loop
							 | 
						||
| 
								 | 
							
								echo "$MNT" > "$CINIT/conf/destdir"
							 | 
						||
| 
								 | 
							
								make -C "$CINIT" clean all install
							 | 
						||
| 
								 | 
							
								umount "$MNT"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								"$FSCK" "$IMG"
							 | 
						||
| 
								 | 
							
								"$LINUX" $LINUX_PARAM
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								# restore console, if broken
							 | 
						||
| 
								 | 
							
								#reset
							 |