summaryrefslogtreecommitdiffstats
path: root/meta/classes/syslinux.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/syslinux.bbclass')
-rw-r--r--meta/classes/syslinux.bbclass68
1 files changed, 60 insertions, 8 deletions
diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass
index 0cc6b851bc..6eb804b75c 100644
--- a/meta/classes/syslinux.bbclass
+++ b/meta/classes/syslinux.bbclass
@@ -2,7 +2,63 @@
2# Copyright (C) 2004-2006, Advanced Micro Devices, Inc. All Rights Reserved 2# Copyright (C) 2004-2006, Advanced Micro Devices, Inc. All Rights Reserved
3# Released under the MIT license (see packages/COPYING) 3# Released under the MIT license (see packages/COPYING)
4 4
5# This creates a configuration file suitable for use with syslinux. 5# Provide syslinux specific functions for building bootable images.
6
7# External variables
8# ${INITRD} - indicates a filesystem image to use as an initrd (optional)
9# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
10# ${AUTO_SYSLINUXMENU} - set this to 1 to enable creating an automatic menu
11# ${LABELS} - a list of targets for the automatic config
12# ${APPEND} - an override list of append strings for each label
13# ${SYSLINUX_OPTS} - additional options to add to the syslinux file ';' delimited
14
15do_bootimg[depends] += "syslinux:do_populate_sysroot \
16 syslinux-native:do_populate_sysroot"
17
18SYSLINUXCFG = "syslinux.cfg"
19SYSLINUXMENU = "menu"
20
21SYSLINUX_ISODIR = "${ISODIR}/isolinux"
22SYSLINUX_HDDDIR = "${HDDDIR}"
23ISO_BOOTIMG = "isolinux/isolinux.bin"
24ISO_BOOTCAT = "isolinux/boot.cat"
25MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table"
26
27syslinux_populate() {
28 DEST=$1
29 CFGNAME=$2
30
31 install -d ${DEST}
32
33 # Install the kernel, initrd, and rootfs
34 install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage ${DEST}/vmlinuz
35 if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then
36 install -m 0644 ${INITRD} ${DEST}/initrd
37 fi
38 if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then
39 install -m 0644 ${ROOTFS} ${DEST}/rootfs.img
40 fi
41
42 # Install the config files
43 install -m 0644 ${SYSLINUXCFG} ${DEST}/${CFGNAME}
44 if [ -f ${SYSLINUXMENU} ]; then
45 install -m 0644 ${SYSLINUXMENU} ${DEST}
46 fi
47}
48
49syslinux_iso_populate() {
50 syslinux_populate ${SYSLINUX_ISODIR} isolinux.cfg
51 install -m 0644 ${STAGING_LIBDIR}/syslinux/isolinux.bin ${SYSLINUX_ISODIR}
52}
53
54syslinux_hddimg_populate() {
55 syslinux_populate ${SYSLINUX_HDDDIR} syslinux.cfg
56 install -m 0444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${SYSLINUX_HDDDIR}/ldlinux.sys
57}
58
59syslinux_hddimg_install() {
60 syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
61}
6 62
7python build_syslinux_menu () { 63python build_syslinux_menu () {
8 import copy 64 import copy
@@ -26,10 +82,8 @@ python build_syslinux_menu () {
26 if not cfile: 82 if not cfile:
27 raise bb.build.FuncFailed('Unable to read SYSLINUXMENU') 83 raise bb.build.FuncFailed('Unable to read SYSLINUXMENU')
28 84
29 bb.mkdirhier(os.path.dirname(cfile))
30
31 try: 85 try:
32 cfgfile = file(cfile, 'w') 86 cfgfile = file(cfile, 'w')
33 except OSError: 87 except OSError:
34 raise bb.build.funcFailed('Unable to open %s' % (cfile)) 88 raise bb.build.funcFailed('Unable to open %s' % (cfile))
35 89
@@ -85,10 +139,8 @@ python build_syslinux_cfg () {
85 if not cfile: 139 if not cfile:
86 raise bb.build.FuncFailed('Unable to read SYSLINUXCFG') 140 raise bb.build.FuncFailed('Unable to read SYSLINUXCFG')
87 141
88 bb.mkdirhier(os.path.dirname(cfile))
89
90 try: 142 try:
91 cfgfile = file(cfile, 'w') 143 cfgfile = file(cfile, 'w')
92 except OSError: 144 except OSError:
93 raise bb.build.funcFailed('Unable to open %s' % (cfile)) 145 raise bb.build.funcFailed('Unable to open %s' % (cfile))
94 146
@@ -103,7 +155,7 @@ python build_syslinux_cfg () {
103 if opts: 155 if opts:
104 for opt in opts.split(';'): 156 for opt in opts.split(';'):
105 cfgfile.write('%s\n' % opt) 157 cfgfile.write('%s\n' % opt)
106 158
107 cfgfile.write('ALLOWOPTIONS 1\n'); 159 cfgfile.write('ALLOWOPTIONS 1\n');
108 cfgfile.write('DEFAULT %s\n' % (labels.split()[0])) 160 cfgfile.write('DEFAULT %s\n' % (labels.split()[0]))
109 161