pxe-network-installer: align with stx 3.0

- Correct some directories
- Change stx_thud to poky-stx
- Add dependency on several syslinux sub packages
- Fix the postinst script
- Move the installation of installer images to kickstart file
  since they are not available before building anaconda

Issue-ID: INF-130
Issue-ID: INF-131
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Change-Id: Ie8c936f8937b8a07145d2d99c8c145292abef3cd
diff --git a/meta-stx/conf/distro/files/pkglist/poky-stx-aio-pkg-list.cfg b/meta-stx/conf/distro/files/pkglist/poky-stx-aio-pkg-list.cfg
index cc9b7cc..ff1f9f3 100644
--- a/meta-stx/conf/distro/files/pkglist/poky-stx-aio-pkg-list.cfg
+++ b/meta-stx/conf/distro/files/pkglist/poky-stx-aio-pkg-list.cfg
@@ -5448,6 +5448,9 @@
 sysinv-1.0.0-r0.corei7_64
 sysinv-agent-1.0.0-r0.corei7_64
 syslinux-6.04+pre2-r0.corei7_64
+syslinux-chain-6.04+pre2-r0.corei7_64
+syslinux-misc-6.04+pre2-r0.corei7_64
+syslinux-pxelinux-6.04+pre2-r0.corei7_64
 syslog-ng-3.19.1-r0.corei7_64
 syslog-ng-config-1.0.0-r0.corei7_64
 sysstat-12.1.3-r0.corei7_64
diff --git a/meta-stx/conf/distro/files/pkglist/poky-stx-aio-rt-pkg-list.cfg b/meta-stx/conf/distro/files/pkglist/poky-stx-aio-rt-pkg-list.cfg
index 950fab1..b3ab314 100644
--- a/meta-stx/conf/distro/files/pkglist/poky-stx-aio-rt-pkg-list.cfg
+++ b/meta-stx/conf/distro/files/pkglist/poky-stx-aio-rt-pkg-list.cfg
@@ -5442,6 +5442,9 @@
 sysinv-1.0.0-r0.corei7_64
 sysinv-agent-1.0.0-r0.corei7_64
 syslinux-6.04+pre2-r0.corei7_64
+syslinux-chain-6.04+pre2-r0.corei7_64
+syslinux-misc-6.04+pre2-r0.corei7_64
+syslinux-pxelinux-6.04+pre2-r0.corei7_64
 syslog-ng-3.19.1-r0.corei7_64
 syslog-ng-config-1.0.0-r0.corei7_64
 sysstat-12.1.3-r0.corei7_64
diff --git a/meta-stx/recipes-core/stx-metal/pxe-network-installer.inc b/meta-stx/recipes-core/stx-metal/pxe-network-installer.inc
index 524c0d6..881c4d6 100644
--- a/meta-stx/recipes-core/stx-metal/pxe-network-installer.inc
+++ b/meta-stx/recipes-core/stx-metal/pxe-network-installer.inc
@@ -17,9 +17,12 @@
 
 DEPENDS += " syslinux"
 RDEPENDS_pxe-network-installer += " \
-		syslinux \
-		bash \
-		"
+	bash \
+	syslinux \
+	syslinux-chain \
+	syslinux-misc \
+	syslinux-pxelinux \
+	"
 
 do_configure_prepend () {
 	:
@@ -34,23 +37,14 @@
 	install -d -m 0755 ${D}/pxeboot
 	install -d -m 0755 ${D}/pxeboot/pxelinux.cfg.files
 	install -d -m 0755 ${D}/pxeboot/rel-${STX_REL}
-	install -d -m 0755 ${D}/pxeboot/rel-${STX_REL}/LiveOS/
 	install -d -m 0755 ${D}/pxeboot/EFI
-	install -d -m 0755 ${D}/pxeboot/EFI/stx_thud
+	install -d -m 0755 ${D}/pxeboot/EFI/poky-stx
+	ln -fs poky-stx ${D}/pxeboot/EFI/centos
+	ln -fs ${libdir}/grub/x86_64-efi ${D}/pxeboot/EFI/poky-stx/
+
 	install -d -m 0755 ${D}/${sbindir}
-	ln -fs /pxeboot/stx_thud ${D}/pxeboot/centos
-	ln -fs ${libdir}/grub/x86_64-efi ${D}/pxeboot/EFI/stx_thud/
-
-	# Install the files:
-	if [ ! -z "${INSTALLER_IMG_DIR}" ]; then
-		install -m 0644 ${INSTALLER_IMG_DIR}/vmlinuz ${D}/pxeboot/stx_thud/rel-${STX_REL}/installer-bzImage_1.0
-		install -m 0644 ${INSTALLER_IMG_DIR}/initrd.img ${D}/pxeboot/stx_thud/rel-${STX_REL}/installer-intel-x86-64-initrd_1.0
-		install -m 0644 ${INSTALLER_IMG_DIR}/squashfs.img ${D}/pxeboot/stx_thud/rel-${STX_REL}/LiveOS/squashfs.img
-		ln -fs installer-bzImage_1.0 ${D}/pxeboot/rel-${STX_REL}/installer-bzImage
-		ln -fs installer-intel-x86-64-initrd_1.0 ${D}/pxeboot/rel-${STX_REL}/installer-initrd
-	fi
-
 	install -m 755 pxeboot-update.sh ${D}/${sbindir}/pxeboot-update-${STX_REL}.sh
+
 	install -m 644 ${S}/bsp-files/kickstarts/post_clone_iso_ks.cfg ${D}/pxeboot/post_clone_iso_ks.cfg
 	install -m 644 default ${D}/pxeboot/pxelinux.cfg.files/default
 	install -m 644 default.static ${D}/pxeboot/pxelinux.cfg.files/default.static
@@ -65,10 +59,6 @@
 	install -m 644 pxe-grub.cfg ${D}/pxeboot/pxelinux.cfg.files/grub.cfg
 	install -m 644 pxe-grub.cfg.static ${D}/pxeboot/pxelinux.cfg.files/grub.cfg.static
 
-	# Copy EFI boot image. It will be used to create ISO on the Controller.
-	if [ ! -z "${INSTALLER_IMG_DIR}" ]; then
-		install -m 644 efiboot.img ${D}/pxeboot/rel-${STX_REL}/
-	fi
 	install -m 644 efi-centos-pxe-controller-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-controller-install-${STX_REL}
 	install -m 644 efi-centos-pxe-worker-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-worker-install-${STX_REL}
 	install -m 644 efi-centos-pxe-smallsystem-install ${D}/pxeboot/pxelinux.cfg.files/efi-pxe-smallsystem-install-${STX_REL}
@@ -80,25 +70,25 @@
 	
 	# Copy Titanium grub.cfg. It will be used to create ISO on the Controller.
 	install -m 0644 ${S}/bsp-files/grub.cfg ${D}/pxeboot/EFI/ 
+
 	# UEFI bootloader expect the grub.cfg file to be in /pxeboot/ so create a symlink for it
 	ln -fs pxelinux.cfg/grub.cfg ${D}/pxeboot/grub.cfg
 }
 
-pkg_postinst_ontarget_pxe-network_installer() {
-	install -m 0644 /usr/share/syslinux/menu.c32 /pxeboot
-	install -m 0644 /usr/share/syslinux/vesamenu.c32 /pxeboot
-	install -m 0644 /usr/share/syslinux/chain.c32 /pxeboot
-	install -m 0644 /usr/share/syslinux/linux.c32 /pxeboot
-	install -m 0644 /usr/share/syslinux/reboot.c32 /pxeboot
-	install -m 0644 /usr/share/syslinux/pxechn.c32 /pxeboot
-	install -m 0644 /usr/share/syslinux/pxelinux.0 /pxeboot
-	install -m 0644 /usr/share/syslinux/gpxelinux.0 /pxeboot
+pkg_postinst_pxe-network-installer() {
+	install -m 0644 $D${datadir}/syslinux/menu.c32 $D/pxeboot
+	install -m 0644 $D${datadir}/syslinux/vesamenu.c32 $D/pxeboot
+	install -m 0644 $D${datadir}/syslinux/chain.c32 $D/pxeboot
+	install -m 0644 $D${datadir}/syslinux/ldlinux.c32 $D/pxeboot
+	install -m 0644 $D${datadir}/syslinux/linux.c32 $D/pxeboot
+	install -m 0644 $D${datadir}/syslinux/libutil.c32 $D/pxeboot
+	install -m 0644 $D${datadir}/syslinux/reboot.c32 $D/pxeboot
+	install -m 0644 $D${datadir}/syslinux/pxechn.c32 $D/pxeboot
+	install -m 0644 $D${datadir}/syslinux/pxelinux.0 $D/pxeboot
+	install -m 0644 $D${datadir}/syslinux/gpxelinux.0 $D/pxeboot
 }
 
 FILES_pxe-network-installer = " \
 	/pxeboot \
 	${sbindir}/pxeboot-update-${STX_REL}.sh \
 	"
-	
-
-