pxe-network-installer: fix kernel options in pxelinux.cfg.files
[pti/rtp.git] / meta-stx / recipes-core / stx-metal / pxe-network-installer.inc
1 #
2 ## Copyright (C) 2019 Wind River Systems, Inc.
3 #
4 #  Licensed under the Apache License, Version 2.0 (the "License");
5 #  you may not use this file except in compliance with the License.
6 #  You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #  Unless required by applicable law or agreed to in writing, software
11 #  distributed under the License is distributed on an "AS IS" BASIS,
12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  See the License for the specific language governing permissions and
14 #  limitations under the License.
15
16 PACKAGES += " pxe-network-installer"
17
18 DEPENDS += " syslinux"
19 RDEPENDS_pxe-network-installer += " \
20         bash \
21         syslinux \
22         syslinux-chain \
23         syslinux-misc \
24         syslinux-pxelinux \
25         "
26
27 do_configure_prepend () {
28         :
29
30
31 do_compile_prepend () {
32         :
33 }
34
35 do_install_prepend () {
36         cd ${S}/installer/pxe-network-installer/pxe-network-installer
37         install -d -m 0755 ${D}/pxeboot
38         install -d -m 0755 ${D}/pxeboot/pxelinux.cfg.files
39         install -d -m 0755 ${D}/pxeboot/rel-${STX_REL}
40         install -d -m 0755 ${D}/pxeboot/EFI
41         install -d -m 0755 ${D}/pxeboot/EFI/poky-stx
42         ln -fs poky-stx ${D}/pxeboot/EFI/centos
43         ln -fs ${libdir}/grub/x86_64-efi ${D}/pxeboot/EFI/poky-stx/
44
45         install -d -m 0755 ${D}/${sbindir}
46         install -m 755 pxeboot-update.sh ${D}/${sbindir}/pxeboot-update-${STX_REL}.sh
47
48         install -m 644 ${S}/bsp-files/kickstarts/post_clone_iso_ks.cfg ${D}/pxeboot/post_clone_iso_ks.cfg
49         install -m 644 default ${D}/pxeboot/pxelinux.cfg.files/default
50         install -m 644 default.static ${D}/pxeboot/pxelinux.cfg.files/default.static
51         install -m 644 centos-pxe-controller-install ${D}/pxeboot/pxelinux.cfg.files/pxe-controller-install-${STX_REL}
52         install -m 644 centos-pxe-worker-install ${D}/pxeboot/pxelinux.cfg.files/pxe-worker-install-${STX_REL}
53         install -m 644 centos-pxe-smallsystem-install ${D}/pxeboot/pxelinux.cfg.files/pxe-smallsystem-install-${STX_REL}
54         install -m 644 centos-pxe-storage-install ${D}/pxeboot/pxelinux.cfg.files/pxe-storage-install-${STX_REL}
55         install -m 644 centos-pxe-worker_lowlatency-install ${D}/pxeboot/pxelinux.cfg.files/pxe-worker_lowlatency-install-${STX_REL}
56         install -m 644 centos-pxe-smallsystem_lowlatency-install ${D}/pxeboot/pxelinux.cfg.files/pxe-smallsystem_lowlatency-install-${STX_REL}
57
58         # UEFI support
59         install -m 644 pxe-grub.cfg ${D}/pxeboot/pxelinux.cfg.files/grub.cfg
60         install -m 644 pxe-grub.cfg.static ${D}/pxeboot/pxelinux.cfg.files/grub.cfg.static
61
62         install -m 644 efi-centos-pxe-controller-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-controller-install-${STX_REL}
63         install -m 644 efi-centos-pxe-worker-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-worker-install-${STX_REL}
64         install -m 644 efi-centos-pxe-smallsystem-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-smallsystem-install-${STX_REL}
65         install -m 644 efi-centos-pxe-storage-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-storage-install-${STX_REL}
66         install -m 644 efi-centos-pxe-worker_lowlatency-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-worker_lowlatency-install-${STX_REL}
67         install -m 644 efi-centos-pxe-smallsystem_lowlatency-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-smallsystem_lowlatency-install-${STX_REL}
68
69         sed -i -e "s/xxxSW_VERSIONxxx/${STX_REL}/g" \
70                -e "s/inst.ks/ks/g" \
71                -e "s/\(xxxAPPEND_OPTIONSxxx\)/LABEL=initrd-install \1/" \
72                ${D}/pxeboot/pxelinux.cfg.files/pxe-* ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-*
73         
74         # Copy Titanium grub.cfg. It will be used to create ISO on the Controller.
75         install -m 0644 ${S}/bsp-files/grub.cfg ${D}/pxeboot/EFI/ 
76
77         # UEFI bootloader expect the grub.cfg file to be in /pxeboot/ so create a symlink for it
78         ln -fs pxelinux.cfg/grub.cfg ${D}/pxeboot/grub.cfg
79 }
80
81 pkg_postinst_pxe-network-installer() {
82         install -m 0644 $D${datadir}/syslinux/menu.c32 $D/pxeboot
83         install -m 0644 $D${datadir}/syslinux/vesamenu.c32 $D/pxeboot
84         install -m 0644 $D${datadir}/syslinux/chain.c32 $D/pxeboot
85         install -m 0644 $D${datadir}/syslinux/ldlinux.c32 $D/pxeboot
86         install -m 0644 $D${datadir}/syslinux/linux.c32 $D/pxeboot
87         install -m 0644 $D${datadir}/syslinux/libutil.c32 $D/pxeboot
88         install -m 0644 $D${datadir}/syslinux/reboot.c32 $D/pxeboot
89         install -m 0644 $D${datadir}/syslinux/pxechn.c32 $D/pxeboot
90         install -m 0644 $D${datadir}/syslinux/pxelinux.0 $D/pxeboot
91 }
92
93 FILES_pxe-network-installer = " \
94         /pxeboot \
95         ${sbindir}/pxeboot-update-${STX_REL}.sh \
96         "