summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian2011-04-26 19:38:11 +0200
committerSebastian2011-04-26 19:38:11 +0200
commite8f2057c4ba4e366f132e2a8780324232c725fd3 (patch)
tree9b411c31c01a20e397b633ae672b27a24858f998
parentupdate fbgui... (diff)
downloadusb-boot-stick-e8f2057c4ba4e366f132e2a8780324232c725fd3.tar.gz
usb-boot-stick-e8f2057c4ba4e366f132e2a8780324232c725fd3.tar.xz
usb-boot-stick-e8f2057c4ba4e366f132e2a8780324232c725fd3.zip
create installer working ..
-rw-r--r--.gitignore3
-rwxr-xr-xbin/build.initramfs.sh10
-rwxr-xr-xbin/build.kernel.sh12
-rwxr-xr-xbin/env.setup-kernel.sh12
-rwxr-xr-xbin/env.setup-syslinux.sh6
-rwxr-xr-xcreate-installer46
-rwxr-xr-xinstaller/tpl/installer.tpl.sh48
7 files changed, 117 insertions, 20 deletions
diff --git a/.gitignore b/.gitignore
index cfda7b7..38f35f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,9 @@ build/initramfs-default*
build/*.tar.bz2
build/*.tbz2
build/log
+installer/tmp
+installer/*.bz2
+installer/*installer
contrib/syslinux/sys*
.project
diff --git a/bin/build.initramfs.sh b/bin/build.initramfs.sh
index 36ee4eb..692c5e8 100755
--- a/bin/build.initramfs.sh
+++ b/bin/build.initramfs.sh
@@ -3,8 +3,8 @@
ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..)
cd ${ROOT_DIR}/build/rootfs
-echo "[build-initramfs] \t Create initramfs."
-find . | cpio -H newc -o > ../initramfs-default.cpio
+echo -e "[build-initramfs] \t Create initramfs."
+find . | cpio --quiet -H newc -o > ../initramfs-default.cpio
cd ..
gzip initramfs-default.cpio
@@ -13,6 +13,6 @@ INITRAMFS_SIZE=$(stat -c %s ${ROOT_DIR}/build/initramfs-default)
cd - > /dev/null 2>&1
-echo "[build-initramfs] \t New initramfs created."
-echo "\t\t\t Location: ${ROOT_DIR}/build/initramfs-default."
-echo "\t\t\t Size: ${INITRAMFS_SIZE} bytes."
+echo -e "[build-initramfs] \t New initramfs created."
+echo -e "\t\t\t Location: ${ROOT_DIR}/build/initramfs-default."
+echo -e "\t\t\t Size: ${INITRAMFS_SIZE} bytes."
diff --git a/bin/build.kernel.sh b/bin/build.kernel.sh
index 309e24a..937ebe3 100755
--- a/bin/build.kernel.sh
+++ b/bin/build.kernel.sh
@@ -7,11 +7,11 @@ ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..)
cd $ROOT_DIR/build
if [ ! -d linux-${kernel_version} ]; then
- echo "[build-kernel] \t\t Can't find kernel-sources. Re-run kernel env setup."
+ echo -e "[build-kernel] \t\t Can't find kernel-sources. Re-run kernel env setup."
$ROOT_DIR/bin/env.setup-kernel.sh
fi
-echo "[build-kernel]\t\t Update Kernel config."
+echo -e "[build-kernel]\t\t Update Kernel config."
cd linux-${kernel_version}
cp ${ROOT_DIR}/config/kernel.config ./.config
@@ -19,15 +19,15 @@ mkdir -p $ROOT_DIR/build/log
yes "" | linux32 make oldconfig > $ROOT_DIR/build/log/kernel-oldconfig.log 2>&1
-echo "[build-kernel]\t\t Build Kernel (Could take some time)."
+echo -e "[build-kernel]\t\t Build Kernel (Could take some time)."
linux32 make -j $make_num_jobs > $ROOT_DIR/build/log/kernel-compile.log 2>&1
cp arch/x86/boot/bzImage ../kernel-preboot-latest
KERNEL_SIZE=$(stat -c %s ${ROOT_DIR}/build/kernel-preboot-latest)
-echo "[build-kernel] \t\t New Kernel build successfully."
-echo "\t\t\t Location: ${ROOT_DIR}/build/kernel-preboot-latest ."
-echo "\t\t\t Size: ${KERNEL_SIZE} bytes."
+echo -e "[build-kernel] \t\t New Kernel build successfully."
+echo -e "\t\t\t Location: ${ROOT_DIR}/build/kernel-preboot-latest ."
+echo -e "\t\t\t Size: ${KERNEL_SIZE} bytes."
cd - >/dev/null 2>&1
diff --git a/bin/env.setup-kernel.sh b/bin/env.setup-kernel.sh
index 82a8c4a..a16804e 100755
--- a/bin/env.setup-kernel.sh
+++ b/bin/env.setup-kernel.sh
@@ -6,27 +6,27 @@ ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..)
cd $ROOT_DIR/build
if [ ! -f linux-${kernel_version}.tar.bz2 ]; then
- echo "[setup-kernel]\t\t Download Kernel ($kernel_version)."
+ echo -e "[setup-kernel]\t\t Download Kernel ($kernel_version)."
wget -q -c "$kernel_url"
else
- echo "[setup-kernel]\t\t Found Kernel package - skip download."
+ echo -e "[setup-kernel]\t\t Found Kernel package - skip download."
fi
if [ ! -d linux-${kernel_version} ]; then
- echo "[setup-kernel]\t\t Unpack Kernel."
+ echo -e "[setup-kernel]\t\t Unpack Kernel."
tar xjf linux-${kernel_version}.tar.bz2
else
- echo "[setup-kernel]\t\t Found unpacked kernel - continue."
+ echo -e "[setup-kernel]\t\t Found unpacked kernel - continue."
fi
-echo "[setup-kernel]\t\t Update Kernel config."
+echo -e "[setup-kernel]\t\t Update Kernel config."
cd linux-${kernel_version}
cp ${ROOT_DIR}/config/kernel.config ./.config
mkdir -p $ROOT_DIR/build/log
yes "" | linux32 make oldconfig > $ROOT_DIR/build/log/kernel-oldconfig.log 2>&1
-echo "[setup-kernel]\t\t Details can be found in the log file: $ROOT_DIR/build/log/kernel-oldconfig.log"
+echo -e "[setup-kernel]\t\t Details can be found in the log file: $ROOT_DIR/build/log/kernel-oldconfig.log"
cd - >/dev/null 2>&1
diff --git a/bin/env.setup-syslinux.sh b/bin/env.setup-syslinux.sh
index 065b4e9..0c89950 100755
--- a/bin/env.setup-syslinux.sh
+++ b/bin/env.setup-syslinux.sh
@@ -29,13 +29,13 @@ cd $ROOT_DIR/contrib/syslinux
if [ "x$(readlink -e latest)" != "x" ]; then
if [ "$(basename $(readlink -e latest))" = "$SYSLINUX_VERSION" ]; then
- echo "[setup-syslinux] \t Found up-to-date syslinux ($SYSLINUX_VERSION)"
+ echo -e "[setup-syslinux] \t Found up-to-date syslinux ($SYSLINUX_VERSION)"
else
- echo "[setup-syslinux] \t Found different syslinux version ($(basename $(readlink -e latest))). Switch to $SYSLINUX_VERSION."
+ echo -e "[setup-syslinux] \t Found different syslinux version ($(basename $(readlink -e latest))). Switch to $SYSLINUX_VERSION."
get_syslinux
fi
else
- echo "[setup-syslinux] \t Install $SYSLINUX_VERSION."
+ echo -e "[setup-syslinux] \t Install $SYSLINUX_VERSION."
get_syslinux
fi
diff --git a/create-installer b/create-installer
new file mode 100755
index 0000000..ce7ad58
--- /dev/null
+++ b/create-installer
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+ROOT_DIR=$(dirname $(readlink -f $0))
+
+if [ $(whoami) != "root" ]; then
+ echo "you should be root"
+ exit 1;
+fi
+
+OUT_DEV=$1
+SYSLINUX=$ROOT_DIR/contrib/syslinux/latest
+
+PBSI=$ROOT_DIR/installer/pbstick-installer
+
+PATH="$PATH:$ROOT_DIR/bin/"
+
+[ ! -f $SYSLINUX/Makefile ] && env.setup-syslinux.sh
+
+rm -rf $ROOT_DIR/installer/tmp
+rm -f $ROOT_DIR/installer/stick-payload.tar.bz2
+
+mkdir -p $ROOT_DIR/installer/tmp/share \
+ $ROOT_DIR/installer/tmp/bin \
+ $ROOT_DIR/installer/tmp/boot
+
+cp -f $SYSLINUX/mbr/mbr.bin $ROOT_DIR/installer/tmp/share
+cp -f $SYSLINUX/extlinux/extlinux -i $ROOT_DIR/installer/tmp/bin
+
+[ ! -f $ROOT_DIR/build/kernel-preboot-latest ] && build.kernel.sh
+cp -f $ROOT_DIR/build/kernel-preboot-latest $ROOT_DIR/installer/tmp/boot/kernel
+
+build.initramfs.sh
+cp -f $ROOT_DIR/build/initramfs-default $ROOT_DIR/installer/tmp/boot/initramfs
+
+cp -f $SYSLINUX/com32/menu/menu.c32 $ROOT_DIR/installer/tmp/boot/
+cp -f $SYSLINUX/com32/menu/vesamenu.c32 $ROOT_DIR/installer/tmp/boot/
+cp -f $ROOT_DIR/config/extlinux/* $ROOT_DIR/installer/tmp/boot/
+
+cd $ROOT_DIR/installer/tmp/
+tar cjf ../stick-payload.tar.bz2 *
+cd $ROOT_DIR
+
+cat $ROOT_DIR/installer/tpl/installer.tpl.sh > $PBSI
+echo "PAYLOAD:" >> $PBSI
+cat $ROOT_DIR/installer/stick-payload.tar.bz2 | uuencode - >> $PBSI
+chmod +rx $PBSI
diff --git a/installer/tpl/installer.tpl.sh b/installer/tpl/installer.tpl.sh
new file mode 100755
index 0000000..8e335e3
--- /dev/null
+++ b/installer/tpl/installer.tpl.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+ROOT_DIR=$(dirname $(readlink -f $0))
+SELF=$(readlink -f $0)
+TMP_DIR="/tmp/pbstick-$$"
+
+OUT_DEV=$1
+
+if [ $(whoami) != "root" ]; then
+ echo "you should be root"
+ exit 1;
+fi
+
+if [ -z $OUT_DEV ]; then
+ echo "no outputdev specified - usage $0 [devicename of usbstick] (eg sdc for /dev/sdc)"
+ exit 1
+fi
+
+mkdir -p $TMP_DIR
+
+match=$(grep --text --line-number '^PAYLOAD:$' $SELF | cut -d ':' -f 1)
+payload_start=$((match + 1))
+cd $TMP_DIR
+tail -n +$payload_start $SELF | uudecode | tar -xjvf -
+cd $ROOT_DIR
+
+
+PATH="$PATH:$TMP_DIR/bin/"
+
+for i in 1 2 3 4 5 6 7 8 9; do
+ umount /dev/${OUT_DEV}$i &> /dev/null
+done
+
+cat $TMP_DIR/share/mbr.bin > /dev/${OUT_DEV}
+mkfs.ext2 /dev/${OUT_DEV}1
+
+mkdir -p /media/openslx-stick
+mount /dev/${OUT_DEV}1 /media/openslx-stick
+
+mkdir -p /media/openslx-stick/boot
+
+$TMP_DIR/bin/extlinux -i /media/openslx-stick/boot
+
+cp -v $TMP_DIR/boot/* /media/openslx-stick/boot/
+
+sync
+umount /media/openslx-stick
+exit 1