summaryrefslogtreecommitdiffstats
path: root/install-usb
blob: 39f84cd928d77138eb2697e04cbeff23e84297e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/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

[ ! -f $SYSLINUX/Makefile ] && $ROOT_DIR/contrib/syslinux/fetch.sh

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