summaryrefslogblamecommitdiffstats
path: root/install-usb
blob: 49c1a6219f1de348e331e3df12311b60d060c6a3 (plain) (tree)





















                                           
                          










                                                                            

                                                                      












                                                                   
                    




                                                                      






                                                                     










                                                                      
#!/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

if [ -z $OUT_DEV ]; then
    echo "no dev"
    exit 1
fi

for i in 1 2 3 4 5 6 7 8 9; do
   umount /dev/${OUT_DEV}$i &> /dev/null
done

cat $SYSLINUX/mbr/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

$SYSLINUX/extlinux/extlinux -i /media/openslx-stick/boot

bash $ROOT_DIR/bin/build-preboot-kernel
cp -v $ROOT_DIR/build/kernel-preboot-latest /media/openslx-stick/boot/kernel

bash $ROOT_DIR/bin/initramfs.update
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
  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 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

sync
umount /media/openslx-stick