summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Schmelzer2011-04-21 15:36:16 +0200
committerSebastian Schmelzer2011-04-21 15:36:16 +0200
commitc61ac386c2dbf70c629d8e5364c5872563510aed (patch)
tree5f5dd1451866093afeab1edd72a1029d292fd7d0
parentfbgui update (shutdowm button fix...) (diff)
downloadusb-boot-stick-c61ac386c2dbf70c629d8e5364c5872563510aed.tar.gz
usb-boot-stick-c61ac386c2dbf70c629d8e5364c5872563510aed.tar.xz
usb-boot-stick-c61ac386c2dbf70c629d8e5364c5872563510aed.zip
script tuning :) + vesamenu
-rw-r--r--.gitignore3
-rw-r--r--bin/build-preboot-kernel26
-rwxr-xr-xbin/build.initramfs.sh18
-rwxr-xr-xbin/build.kernel.sh33
-rwxr-xr-xbin/env.setup-kernel.sh33
-rwxr-xr-xbin/env.setup-syslinux.sh44
-rwxr-xr-xbin/initramfs.update9
-rw-r--r--config/extlinux/extlinux.conf63
-rw-r--r--config/extlinux/pbs2.pngbin0 -> 20132 bytes
-rw-r--r--config/setup.conf6
-rwxr-xr-xcontrib/syslinux/fetch.sh12
l---------contrib/syslinux/latest2
-rwxr-xr-xinstall-usb40
13 files changed, 208 insertions, 81 deletions
diff --git a/.gitignore b/.gitignore
index 6fde91d..cfda7b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,7 @@ build/kernel-preboot*
build/initramfs-default*
build/*.tar.bz2
build/*.tbz2
+build/log
contrib/syslinux/sys*
+.project
+
diff --git a/bin/build-preboot-kernel b/bin/build-preboot-kernel
deleted file mode 100644
index d03810d..0000000
--- a/bin/build-preboot-kernel
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-
-ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..)
-
-. $ROOT_DIR/config/setup.conf
-
-
-
-cd $ROOT_DIR/build
-if [ ! -f linux-${kernel_version}.tar.bz2 ]; then
- echo "download kernel"
- wget -c "$kernel_url"
-fi
-
-if [ ! -d linux-${kernel_version} ]; then
- echo "unpack kernel"
- tar xjf linux-${kernel_version}.tar.bz2
-fi
-
-cd linux-${kernel_version}
-cp ${ROOT_DIR}/config/kernel.config ./.config
-
-linux32 make oldconfig
-linux32 make -j 4
-
-cp arch/x86/boot/bzImage ../kernel-preboot-latest
diff --git a/bin/build.initramfs.sh b/bin/build.initramfs.sh
new file mode 100755
index 0000000..36ee4eb
--- /dev/null
+++ b/bin/build.initramfs.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+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
+cd ..
+gzip initramfs-default.cpio
+
+mv initramfs-default.cpio.gz initramfs-default
+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."
diff --git a/bin/build.kernel.sh b/bin/build.kernel.sh
new file mode 100755
index 0000000..309e24a
--- /dev/null
+++ b/bin/build.kernel.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..)
+
+. $ROOT_DIR/config/setup.conf
+
+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."
+ $ROOT_DIR/bin/env.setup-kernel.sh
+fi
+
+echo "[build-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 "[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."
+
+cd - >/dev/null 2>&1
diff --git a/bin/env.setup-kernel.sh b/bin/env.setup-kernel.sh
new file mode 100755
index 0000000..82a8c4a
--- /dev/null
+++ b/bin/env.setup-kernel.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..)
+
+. $ROOT_DIR/config/setup.conf
+
+cd $ROOT_DIR/build
+if [ ! -f linux-${kernel_version}.tar.bz2 ]; then
+ echo "[setup-kernel]\t\t Download Kernel ($kernel_version)."
+ wget -q -c "$kernel_url"
+else
+ echo "[setup-kernel]\t\t Found Kernel package - skip download."
+fi
+
+if [ ! -d linux-${kernel_version} ]; then
+ echo "[setup-kernel]\t\t Unpack Kernel."
+ tar xjf linux-${kernel_version}.tar.bz2
+else
+ echo "[setup-kernel]\t\t Found unpacked kernel - continue."
+fi
+
+echo "[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"
+
+cd - >/dev/null 2>&1
+
+
diff --git a/bin/env.setup-syslinux.sh b/bin/env.setup-syslinux.sh
new file mode 100755
index 0000000..065b4e9
--- /dev/null
+++ b/bin/env.setup-syslinux.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..)
+
+. $ROOT_DIR/config/setup.conf
+
+if [ "$syslinux_use_testing" = "1" ]; then
+ SYSLINUX_URL=$syslinux_testing_url
+ SYSLINUX_VERSION=$syslinux_testing_version
+ SYSLINUX_TESTING="x"
+else
+ SYSLINUX_URL=$syslinux_stable_url
+ SYSLINUX_VERSION=$syslinux_stable_version
+ SYSLINUX_STABLE="x"
+fi
+
+
+get_syslinux ()
+{
+ wget -q $SYSLINUX_URL
+ tar xjf $SYSLINUX_VERSION.tar.bz2
+ rm $SYSLINUX_VERSION.tar.bz2
+ rm latest
+ ln -sf $SYSLINUX_VERSION/ latest
+}
+
+
+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)"
+ else
+ echo "[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."
+ get_syslinux
+fi
+
+cd - 2>&1 > /dev/null
+
+
diff --git a/bin/initramfs.update b/bin/initramfs.update
deleted file mode 100755
index b194705..0000000
--- a/bin/initramfs.update
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0))/..)
-
-cd ${ROOT_DIR}/build/rootfs
-find . | cpio -H newc -o > ../initramfs-default.cpio
-cd ..
-gzip initramfs-default.cpio
-mv initramfs-default.cpio.gz initramfs-default
diff --git a/config/extlinux/extlinux.conf b/config/extlinux/extlinux.conf
new file mode 100644
index 0000000..c4df314
--- /dev/null
+++ b/config/extlinux/extlinux.conf
@@ -0,0 +1,63 @@
+TIMEOUT 100
+PROMPT 0
+DEFAULT vesamenu.c32
+
+MENU BACKGROUND pbs2.png
+MENU WIDTH 78
+MENU MARGIN 9
+MENU PASSWORDMARGIN 9
+MENU ROWS 10
+MENU TABMSGROW 16
+MENU CMDLINEROW 16
+MENU ENDROW -1
+MENU PASSWORDROW 16
+MENU TIMEOUTROW 20
+MENU HELPMSGROW 16
+MENU HELPMSGENDROW -1
+MENU HSHIFT 0
+MENU VSHIFT 7
+
+#menu color screen 37;40 #80ffffff #00000000 std
+menu color border 37;40 #00000000 #00000000 std
+menu color title 1 #ee004a99 #00000000 all
+menu color unsel 37;40 #ff4f75aa #00000000 all
+menu color hotkey 1;37;40 #ffff8b00 #ff8093a1 std
+menu color sel 7;37;40 #ff1c2a33 #667799bb all
+#menu color hotsel 1;7;37;40 #ffff8b00 #667799bb all
+#menu color disabled 1;37;40 #ffff8b00 #ff8093a1 std
+#menu color scrollbar 37;40 #40000000 #ee000000 std
+#menu color tabmsg 37;40 #ffff8b00 #ff8093a1 std
+#menu color cmdmark 1;37;40 #ffff8b00 #ff8093a1 std
+#menu color cmdline 37;40 #fff0f0f0 #ff8093a1 std
+#menu color pwdborder 37;40 #40000000 #ff8093a1 std
+#menu color pwdheader 37;40 #ffff8b00 #ff8093a1 std
+#menu color pwdentry 37;40 #ffff8b00 #ff8093a1 std
+#menu color timeout_msg 37;40 #fff0f0f0 #ff8093a1 std
+#menu color timeout 1;37;40 #ffff8b00 #ff8093a1 std
+#menu color help 37;40 #ff1c2a33 #00000000 none
+MENU MSGCOLOR #ff1c2a33 #00000000 none
+
+MENU TITLE Welcome to OpenSLX PreBoot USB Ext2/3 (Mini Linux/Kexec)
+LABEL SLXSTDBOOT
+ MENU LABEL OpenSLX PreBoot - Stateless Netboot Linux ...
+ KERNEL kernel
+ APPEND initrd=init vga=0x317
+ TEXT HELP
+ Use this (default) entry if you have configured your client.
+ You have chance to edit the kernel commandline by hitting the
+ TAB key (e.g. for adding debug=3 to it for bug hunting) ...
+ ENDTEXT
+LABEL DEBUGBOOT
+ MENU LABEL OpenSLX PreBoot - Debug Mode
+ KERNEL kernel
+ APPEND initrd=init vga=0x317 debug=3
+ TEXT HELP
+ Use this to start the preboot environment with debug shells.
+ ENDTEXT
+LABEL LOCALBOOT
+ MENU LABEL LOCALBOOT
+ LOCALBOOT -1
+ TEXT HELP
+ Gets you out of here by booting from next device in BIOS boot
+ order.
+ ENDTEXT \ No newline at end of file
diff --git a/config/extlinux/pbs2.png b/config/extlinux/pbs2.png
new file mode 100644
index 0000000..602a983
--- /dev/null
+++ b/config/extlinux/pbs2.png
Binary files differ
diff --git a/config/setup.conf b/config/setup.conf
index 4bbc1ec..e2adf31 100644
--- a/config/setup.conf
+++ b/config/setup.conf
@@ -1,3 +1,9 @@
kernel_version=2.6.38.3
kernel_url=http://www.kernel.org/pub/linux/kernel/v2.6/linux-${kernel_version}.tar.bz2
+syslinux_use_testing=0
+syslinux_stable_version=syslinux-4.04
+syslinux_stable_url=http://www.kernel.org/pub/linux/utils/boot/syslinux/4.xx/${syslinux_stable_version}.tar.bz2
+syslinux_testing_version=syslinux-4.04-pre22
+syslinux_testing_url=http://www.kernel.org/pub/linux/utils/boot/syslinux/Testing/${syslinux_testing_version}.tar.bz2
+make_num_jobs=4
base_dir=~/work/preboot
diff --git a/contrib/syslinux/fetch.sh b/contrib/syslinux/fetch.sh
deleted file mode 100755
index efd525d..0000000
--- a/contrib/syslinux/fetch.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-ROOT_DIR=$(readlink -f $(dirname $(readlink -f $0)))
-
-
-cd $ROOT_DIR
-
-wget http://www.kernel.org/pub/linux/utils/boot/syslinux/Testing/syslinux-4.04-pre22.tar.bz2
-tar xjfv syslinux*.tar.bz2
-rm *.tar.bz2
-
-cd -
diff --git a/contrib/syslinux/latest b/contrib/syslinux/latest
index 41a2b6b..eaf91cf 120000
--- a/contrib/syslinux/latest
+++ b/contrib/syslinux/latest
@@ -1 +1 @@
-syslinux-4.04-pre22/ \ No newline at end of file
+syslinux-4.04/ \ No newline at end of file
diff --git a/install-usb b/install-usb
index 5b63c67..f6f2246 100755
--- a/install-usb
+++ b/install-usb
@@ -10,7 +10,9 @@ fi
OUT_DEV=$1
SYSLINUX=$ROOT_DIR/contrib/syslinux/latest
-[ ! -f $SYSLINUX/Makefile ] && $ROOT_DIR/contrib/syslinux/fetch.sh
+PATH="$PATH:$ROOT_DIR/bin/"
+
+[ ! -f $SYSLINUX/Makefile ] && env.setup-syslinux.sh
if [ -z $OUT_DEV ]; then
echo "no dev"
@@ -31,45 +33,17 @@ mkdir -p /media/openslx-stick/boot
$SYSLINUX/extlinux/extlinux -i /media/openslx-stick/boot
-bash $ROOT_DIR/bin/build-preboot-kernel
+[ ! -f $ROOT_DIR/build/kernel-preboot-latest ] && build.kernel.sh
cp -v $ROOT_DIR/build/kernel-preboot-latest /media/openslx-stick/boot/kernel
-bash $ROOT_DIR/bin/initramfs.update
+#[ ! -f $ROOT_DIR/build/initramfs-default ] && build.initramfs.sh
+build.initramfs.sh
cp -v $ROOT_DIR/build/initramfs-default /media/openslx-stick/boot/init
cp -v $SYSLINUX/com32/menu/menu.c32 /media/openslx-stick/boot/
cp -v $SYSLINUX/com32/menu/vesamenu.c32 /media/openslx-stick/boot/
-cat > /media/openslx-stick/boot/extlinux.conf << EOF
-TIMEOUT 100
-PROMPT 0
-DEFAULT menu.c32
-
-MENU TITLE Welcome to OpenSLX PreBoot USB Ext2/3 (Mini Linux/Kexec)
-LABEL SLXSTDBOOT
- MENU LABEL OpenSLX PreBoot - Stateless Netboot Linux ...
- KERNEL kernel
- APPEND initrd=init vga=0x317
- TEXT HELP
- Use this (default) entry if you have configured your client.
- You have chance to edit the kernel commandline by hitting the
- TAB key (e.g. for adding debug=3 to it for bug hunting) ...
- ENDTEXT
-LABEL DEBUGBOOT
- MENU LABEL OpenSLX PreBoot - Debug Mode
- KERNEL kernel
- APPEND initrd=init vga=0x317 debug=3
- TEXT HELP
- Use this to start the preboot environment with debug shells.
- ENDTEXT
-LABEL LOCALBOOT
- MENU LABEL LOCALBOOT
- LOCALBOOT -1
- TEXT HELP
- Gets you out of here by booting from next device in BIOS boot
- order.
- ENDTEXT
-EOF
+cp -v $ROOT_DIR/config/extlinux/* /media/openslx-stick/boot
sync
umount /media/openslx-stick