-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_iso.sh
77 lines (62 loc) · 2.09 KB
/
create_iso.sh
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
76
77
#!/bin/bash
# Creates a bootable ISO for aenix.
# Arguments: A list of modules to load at boot
# Dependencies: genisoimage
# check if the program grub-mkrescue is in the path
GENISOIMAGE_PATH=`which genisoimage`
if [ -z $GENISOIMAGE_PATH ]; then
echo "ERROR: The program genisoimage must be installed"
exit 1
fi
set -e # fail as soon as one command fails
MODULES="$@"
ISO_FOLDER="iso"
STAGE2_ELTORITO="../tools/grub/stage2_eltorito"
# create the ISO catalog structure
mkdir -p $ISO_FOLDER/boot/grub
mkdir $ISO_FOLDER/modules
# copy the stage2_eltorito into the correct place
cp $STAGE2_ELTORITO $ISO_FOLDER/boot/grub/
# copy the kernel to the correct location
KERNEL=kernel/kernel.elf
cp $KERNEL $ISO_FOLDER/boot/kernel.elf
# copy all the modules
for m in $MODULES
do
cp $m $ISO_FOLDER/modules/
done
# create the menu.lst file
# set default=0: boot from the first entry (which will be aenix)
# set timeout=0: immediatly boot from the first entry
MENU="default=0
timeout=0
"
# add the menu entry for our os
MENU="$MENU
title OUR LITTLE OS
kernel /boot/kernel.elf"
# create one entry for each module
for m in $MODULES
do
MENU="$MENU
module /modules/$m"
done
echo "$MENU" > $ISO_FOLDER/boot/grub/menu.lst
# build the ISO image
# -R: Use the Rock Ridge protocol (needed by GRUB)
# -b file: The file to boot from (relative to the root folder of
# the ISO)
# -no-emul-boot: Do not perform any disk emulation
# -boot-load-size sz: The number 512 byte sectors to load. Apparently most
# BIOS likes the number 4.
# -boot-info-table: Writes information about the ISO layout to ISO (needed
# by GRUB)
# -o name: The name of the iso
# -A name: The label of the iso
# -input-charset cs: The charset for the input files
# -quiet: Disable any output from genisoimage
genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 \
-A os -input-charset utf8 -quiet -boot-info-table \
-o os.iso $ISO_FOLDER
# clean up
rm -r $ISO_FOLDER