forked from xdissent/ievms
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,815 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# coding: utf-8 | ||
|
||
source :rubygems | ||
|
||
gem "vagrant" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
archive-tar-minitar (0.5.2) | ||
childprocess (0.3.7) | ||
ffi (~> 1.0, >= 1.0.6) | ||
erubis (2.7.0) | ||
ffi (1.3.1) | ||
i18n (0.6.1) | ||
json (1.5.4) | ||
log4r (1.1.10) | ||
net-scp (1.0.4) | ||
net-ssh (>= 1.99.1) | ||
net-ssh (2.2.2) | ||
vagrant (1.0.6) | ||
archive-tar-minitar (= 0.5.2) | ||
childprocess (~> 0.3.1) | ||
erubis (~> 2.7.0) | ||
i18n (~> 0.6.0) | ||
json (~> 1.5.1) | ||
log4r (~> 1.1.9) | ||
net-scp (~> 1.0.4) | ||
net-ssh (~> 2.2.2) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
vagrant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# coding: utf-8 | ||
|
||
Vagrant::Config.run do |config| | ||
config.vm.box = "precise32" | ||
config.vm.box_url = "http://files.vagrantup.com/precise32.box" | ||
config.vm.provision :shell, :path => "control/build.sh" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Caution is a virtue | ||
set -o nounset | ||
set -o errtrace | ||
set -o errexit | ||
set -o pipefail | ||
|
||
log() { printf "$*\n" ; return $? ; } | ||
|
||
fail() { log "\nERROR: $*\n" ; exit 1 ; } | ||
|
||
create_home() { | ||
ievms_home="${HOME}/ievms" | ||
mkdir -p "${ievms_home}" | ||
cd "${ievms_home}" | ||
} | ||
|
||
install_packages() { | ||
apt-get install -y uck curl unzip | ||
} | ||
|
||
download_cross_compiler() { | ||
url="http://landley.net/aboriginal/downloads/binaries/cross-compiler-i686.tar.bz2" | ||
archive=`basename "${url}"` | ||
log "Downloading cross compiler archive from ${url} to ${ievms_home}/${archive}" | ||
if [[ ! -e "${archive}" ]] && ! curl -L "${url}" -o "${archive}" | ||
then | ||
fail "Failed to download ${url} to ${ievms_home}/${archive} using 'curl', error code ($?)" | ||
fi | ||
} | ||
|
||
extract_cross_compiler() { | ||
cross_compiler=`basename "${archive}" .tar.bz2` | ||
log "Extracting cross compiler archive from ${archive} to ${ievms_home}/${cross_compiler}" | ||
if [[ ! -e "${cross_compiler}" ]] && ! tar -jxf "${archive}" | ||
then | ||
fail "Failed to extract ${archive} to ${ievms_home}/${cross_compiler} using 'tar', error code ($?)" | ||
fi | ||
} | ||
|
||
download_kernel() { | ||
url="http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.5.tar.bz2" | ||
archive=`basename "${url}"` | ||
log "Downloading kernel archive from ${url} to ${ievms_home}/${archive}" | ||
if [[ ! -e "${archive}" ]] && ! curl -L "${url}" -o "${archive}" | ||
then | ||
fail "Failed to download ${url} to ${ievms_home}/${archive} using 'curl', error code ($?)" | ||
fi | ||
} | ||
|
||
extract_kernel() { | ||
kernel_src=`basename "${archive}" .tar.bz2` | ||
log "Extracting kernel archive from ${archive} to ${ievms_home}/${kernel_src}" | ||
if [[ ! -e "${kernel_src}" ]] && ! tar -jxf "${archive}" | ||
then | ||
fail "Failed to extract ${archive} to ${ievms_home}/${kernel_src} using 'tar', error code ($?)" | ||
fi | ||
} | ||
|
||
configure_kernel() { | ||
kernel_config="/vagrant/control/kernel.config" | ||
log "Configuring kernel from ${kernel_config} to ${ievms_home}/${kernel_src}/.config" | ||
cp "${kernel_config}" "${kernel_src}/.config" | ||
} | ||
|
||
build_kernel() { | ||
kernel="${ievms_home}/${kernel_src}/arch/x86/boot/bzImage" | ||
cd "${kernel_src}" | ||
log "Building kernel in ${ievms_home}/${kernel_src} to ${kernel}" | ||
if [[ ! -e "${kernel}" ]] && ! make | ||
then | ||
fail "Failed to build kernel in ${ievms_home}/${kernel_src} using 'make', error code ($?)" | ||
fi | ||
cd - | ||
} | ||
|
||
download_iso() { | ||
url="http://pogostick.net/~pnh/ntpasswd/cd110511.zip" | ||
archive=`basename "${url}"` | ||
log "Downloading ntpasswd ISO archive from ${url} to ${ievms_home}/${archive}" | ||
if [[ ! -e "${archive}" ]] && ! curl -L "${url}" -o "${archive}" | ||
then | ||
fail "Failed to download ${url} to ${ievms_home}/${archive} using 'curl', error code ($?)" | ||
fi | ||
} | ||
|
||
extract_iso() { | ||
iso=`basename "${archive}" .zip`.iso | ||
log "Extracting ntpasswd ISO archive from ${archive} to ${ievms_home}/${iso}" | ||
if [[ ! -e "${iso}" ]] && ! unzip "${archive}" | ||
then | ||
fail "Failed to extract ${archive} to ${ievms_home}/${iso} using 'unzip', error code ($?)" | ||
fi | ||
} | ||
|
||
unpack_iso() { | ||
remaster_iso="${HOME}/tmp/remaster-iso" | ||
log "Unpacking ntpasswd ISO from ${iso} to ${remaster_iso}" | ||
if [[ ! -e "${remaster_iso}" ]] && ! uck-remaster-unpack-iso "${iso}" | ||
then | ||
fail "Failed to unpack ${iso} to ${remaster_iso} using 'uck-remaster-unpack-iso', error code ($?)" | ||
fi | ||
} | ||
|
||
extract_initrd() { | ||
initrd="${ievms_home}/initrd" | ||
initrd_cgz="${remaster_iso}/initrd.cgz" | ||
mkdir -p "${initrd}" | ||
cd "${initrd}" | ||
log "Extracting initrd from ${initrd_cgz} to ${initrd}" | ||
if ! gzip -cd "${initrd_cgz}" | cpio -i -d -H newc --no-absolute-filenames | ||
then | ||
fail "Failed to extract ${initrd_cgz} to ${initrd} using 'gzip | cpio', error code ($?)" | ||
fi | ||
} | ||
|
||
copy_scripts() { | ||
log "Copying scripts" | ||
cp "/vagrant/control/stage2" "${initrd}/scripts/" | ||
cp "/vagrant/control/ievms.reg" "${initrd}/scripts/" | ||
cp "/vagrant/control/isolinux.cfg" "${remaster_iso}/isolinux.cfg" | ||
cp "/vagrant/control/isolinux.cfg" "${remaster_iso}/syslinux.cfg" | ||
cp "${kernel}" "${remaster_iso}/" | ||
chmod 755 "${remaster_iso}/bzImage" | ||
rm -f "${remaster_iso}/vmlinuz" "${remaster_iso}/scsi.cgz" "${remaster_iso}/readme.txt" | ||
} | ||
|
||
compress_initrd() { | ||
cd "${initrd}" | ||
log "Compressing initrd from ${initrd} to ${initrd_cgz}" | ||
if ! find . | cpio -o -H newc | gzip > "${initrd_cgz}" | ||
then | ||
fail "Failed to compress ${initrd} to ${initrd_cgz} using 'cpio | gzip', error code ($?)" | ||
fi | ||
} | ||
|
||
pack_iso() { | ||
iso_out="/vagrant/ievms-control.iso" | ||
log "Packing ievms ISO from ${remaster_iso} to ${iso_out}" | ||
if ! genisoimage -o "${iso_out}" -b isolinux.bin -c boot.cat -p "ievms" -no-emul-boot -boot-load-size 4 -boot-info-table -V "IEVMS" -cache-inodes -r -J -l -joliet-long "${remaster_iso}" | ||
then | ||
fail "Failed to pack ${remaster_iso} to ${iso_out} using 'genisoimage', error code ($?)" | ||
fi | ||
} | ||
|
||
create_home | ||
install_packages | ||
download_cross_compiler | ||
extract_cross_compiler | ||
export PATH="${ievms_home}/${cross_compiler}/bin:$PATH" | ||
download_kernel | ||
extract_kernel | ||
configure_kernel | ||
build_kernel | ||
download_iso | ||
extract_iso | ||
unpack_iso | ||
extract_initrd | ||
copy_scripts | ||
compress_initrd | ||
pack_iso |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
default boot | ||
display boot.msg | ||
timeout 0 | ||
prompt 0 | ||
label boot | ||
kernel bzImage | ||
|
||
append rw vga=1 initrd=initrd.cgz |
Oops, something went wrong.