Add initial meta-stx to support StarlingX build
[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                 syslinux \
21                 bash \
22                 "
23
24 do_configure_prepend () {
25         :
26
27
28 do_compile_prepend () {
29         :
30 }
31
32 do_install_prepend () {
33         cd ${S}/installer/pxe-network-installer/pxe-network-installer
34         install -d -m 0755 ${D}/pxeboot
35         install -d -m 0755 ${D}/pxeboot/pxelinux.cfg.files
36         install -d -m 0755 ${D}/pxeboot/rel-${STX_REL}
37         install -d -m 0755 ${D}/pxeboot/rel-${STX_REL}/LiveOS/
38         install -d -m 0755 ${D}/pxeboot/EFI
39         install -d -m 0755 ${D}/pxeboot/EFI/stx_thud
40         install -d -m 0755 ${D}/${sbindir}
41         ln -fs /pxeboot/stx_thud ${D}/pxeboot/centos
42         ln -fs ${libdir}/grub/x86_64-efi ${D}/pxeboot/EFI/stx_thud/
43
44         # Install the files:
45         if [ ! -z "${INSTALLER_IMG_DIR}" ]; then
46                 install -m 0644 ${INSTALLER_IMG_DIR}/vmlinuz ${D}/pxeboot/stx_thud/rel-${STX_REL}/installer-bzImage_1.0
47                 install -m 0644 ${INSTALLER_IMG_DIR}/initrd.img ${D}/pxeboot/stx_thud/rel-${STX_REL}/installer-intel-x86-64-initrd_1.0
48                 install -m 0644 ${INSTALLER_IMG_DIR}/squashfs.img ${D}/pxeboot/stx_thud/rel-${STX_REL}/LiveOS/squashfs.img
49                 ln -fs installer-bzImage_1.0 ${D}/pxeboot/rel-${STX_REL}/installer-bzImage
50                 ln -fs installer-intel-x86-64-initrd_1.0 ${D}/pxeboot/rel-${STX_REL}/installer-initrd
51         fi
52
53         install -m 755 pxeboot-update.sh ${D}/${sbindir}/pxeboot-update-${STX_REL}.sh
54         install -m 644 ${S}/bsp-files/kickstarts/post_clone_iso_ks.cfg ${D}/pxeboot/post_clone_iso_ks.cfg
55         install -m 644 default ${D}/pxeboot/pxelinux.cfg.files/default
56         install -m 644 default.static ${D}/pxeboot/pxelinux.cfg.files/default.static
57         install -m 644 centos-pxe-controller-install ${D}/pxeboot/pxelinux.cfg.files/pxe-controller-install-${STX_REL}
58         install -m 644 centos-pxe-worker-install ${D}/pxeboot/pxelinux.cfg.files/pxe-worker-install-${STX_REL}
59         install -m 644 centos-pxe-smallsystem-install ${D}/pxeboot/pxelinux.cfg.files/pxe-smallsystem-install-${STX_REL}
60         install -m 644 centos-pxe-storage-install ${D}/pxeboot/pxelinux.cfg.files/pxe-storage-install-${STX_REL}
61         install -m 644 centos-pxe-worker_lowlatency-install ${D}/pxeboot/pxelinux.cfg.files/pxe-worker_lowlatency-install-${STX_REL}
62         install -m 644 centos-pxe-smallsystem_lowlatency-install ${D}/pxeboot/pxelinux.cfg.files/pxe-smallsystem_lowlatency-install-${STX_REL}
63
64         # UEFI support
65         install -m 644 pxe-grub.cfg ${D}/pxeboot/pxelinux.cfg.files/grub.cfg
66         install -m 644 pxe-grub.cfg.static ${D}/pxeboot/pxelinux.cfg.files/grub.cfg.static
67
68         # Copy EFI boot image. It will be used to create ISO on the Controller.
69         if [ ! -z "${INSTALLER_IMG_DIR}" ]; then
70                 install -m 644 efiboot.img ${D}/pxeboot/rel-${STX_REL}/
71         fi
72         install -m 644 efi-centos-pxe-controller-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-controller-install-${STX_REL}
73         install -m 644 efi-centos-pxe-worker-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-worker-install-${STX_REL}
74         install -m 644 efi-centos-pxe-smallsystem-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-smallsystem-install-${STX_REL}
75         install -m 644 efi-centos-pxe-storage-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-storage-install-${STX_REL}
76         install -m 644 efi-centos-pxe-worker_lowlatency-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-worker_lowlatency-install-${STX_REL}
77         install -m 644 efi-centos-pxe-smallsystem_lowlatency-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-smallsystem_lowlatency-install-${STX_REL}
78
79         sed -i "s/xxxSW_VERSIONxxx/${STX_REL}/g" ${D}/pxeboot/pxelinux.cfg.files/pxe-* ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-* 
80         
81         # Copy Titanium grub.cfg. It will be used to create ISO on the Controller.
82         install -m 0644 ${S}/bsp-files/grub.cfg ${D}/pxeboot/EFI/ 
83         # UEFI bootloader expect the grub.cfg file to be in /pxeboot/ so create a symlink for it
84         ln -fs pxelinux.cfg/grub.cfg ${D}/pxeboot/grub.cfg
85 }
86
87 pkg_postinst_ontarget_pxe-network_installer() {
88         install -m 0644 /usr/share/syslinux/menu.c32 /pxeboot
89         install -m 0644 /usr/share/syslinux/vesamenu.c32 /pxeboot
90         install -m 0644 /usr/share/syslinux/chain.c32 /pxeboot
91         install -m 0644 /usr/share/syslinux/linux.c32 /pxeboot
92         install -m 0644 /usr/share/syslinux/reboot.c32 /pxeboot
93         install -m 0644 /usr/share/syslinux/pxechn.c32 /pxeboot
94         install -m 0644 /usr/share/syslinux/pxelinux.0 /pxeboot
95         install -m 0644 /usr/share/syslinux/gpxelinux.0 /pxeboot
96 }
97
98 FILES_pxe-network-installer = " \
99         /pxeboot \
100         ${sbindir}/pxeboot-update-${STX_REL}.sh \
101         "
102         
103
104