summaryrefslogblamecommitdiffstats
path: root/install-usb
blob: d4e568a1e3f86b1425dc28141828605acf52b3fc (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.ext3 /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/build-preboot-initramfs
cp -v $ROOT_DIR/build/initramfs-preboot /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 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