From 87fb99154575a7f9a4ada817de3f858fff089a77 Mon Sep 17 00:00:00 2001 From: Edward Cragg Date: Thu, 19 Feb 2015 13:56:03 +0000 Subject: Rename the Linux chunk morph for the armv8l64 BSP --- strata/bsp-armv8l64-generic.morph | 2 +- .../bsp-armv8l64-generic.morph | 104 --------------------- .../linux-armv8l64-generic.morph | 104 +++++++++++++++++++++ 3 files changed, 105 insertions(+), 105 deletions(-) delete mode 100644 strata/bsp-armv8l64-generic/bsp-armv8l64-generic.morph create mode 100644 strata/bsp-armv8l64-generic/linux-armv8l64-generic.morph diff --git a/strata/bsp-armv8l64-generic.morph b/strata/bsp-armv8l64-generic.morph index 702858de..63c4ff5b 100644 --- a/strata/bsp-armv8l64-generic.morph +++ b/strata/bsp-armv8l64-generic.morph @@ -9,7 +9,7 @@ build-depends: - morph: strata/core.morph chunks: - name: linux-armv8l64-generic - morph: strata/bsp-armv8l64-generic/bsp-armv8l64-generic.morph + morph: strata/bsp-armv8l64-generic/linux-armv8l64-generic.morph repo: upstream:linux ref: 5f06398ae6a04f414932243de38b5cf3d264ff84 unpetrify-ref: baserock/apm-xgene-m400-moonshot-cartridge diff --git a/strata/bsp-armv8l64-generic/bsp-armv8l64-generic.morph b/strata/bsp-armv8l64-generic/bsp-armv8l64-generic.morph deleted file mode 100644 index 120239b9..00000000 --- a/strata/bsp-armv8l64-generic/bsp-armv8l64-generic.morph +++ /dev/null @@ -1,104 +0,0 @@ -name: linux-armv8l64-generic -kind: chunk -configure-commands: -- make ARCH=arm64 defconfig -- scripts/config -e PACKET -- scripts/config -e SATA_AHCI -- scripts/config -e ATA_GENERIC -- scripts/config -e HAVE_IDE -- scripts/config -d BLK_DEV_IDE_SATA -- scripts/config -e BTRFS_FS -- scripts/config -e BTRFS_FS_POSIX_ACL -- scripts/config -e DEVTMPFS -- scripts/config -e DEVTMPFS_MOUNT -- scripts/config -e CONFIG_FHANDLE -- scripts/config -e CGROUPS -- scripts/config -e AUTOFS4_FS -- scripts/config --set-str UEVENT_HELPER_PATH '' -- scripts/config -e EXT2_FS -- scripts/config -e EXT2_FS_XATTR -- scripts/config -e EXT2_FS_POSIX_ACL -- scripts/config -e EXT2_FS_SECURITY -- scripts/config -e EXT2_FS_XIP -- scripts/config -e EXT3_FS -- scripts/config -d EXT3_DEFAULTS_TO_ORDERED -- scripts/config -e EXT3_FS_XATTR -- scripts/config -e EXT3_FS_POSIX_ACL -- scripts/config -e EXT3_FS_SECURITY -- scripts/config -e EXT4_FS -- scripts/config -e EXT4_FS_XATTR -- scripts/config -e EXT4_FS_POSIX_ACL -- scripts/config -e EXT4_FS_SECURITY -- scripts/config -d EXT4_DEBUG -- scripts/config -d JBD_DEBUG -- scripts/config -d JBD2_DEBUG -- scripts/config -e BLK_DEV_LOOP -- scripts/config -d BLK_DEV_CRYPTOLOOP -- scripts/config -e CEPH_FS -- scripts/config --set-val BLK_DEV_LOOP_MIN_COUNT 8 -- scripts/config -e VIRTIO -- scripts/config -e VIRTIO_RING -- scripts/config -e VIRTIO_PCI -- scripts/config -e VIRTIO_BALLOON -- scripts/config -e VIRTIO_BLK -- scripts/config -e VIRTIO_NET -- scripts/config -e VIRTIO_CONSOLE -- scripts/config -e HW_RANDOM_VIRTIO -- scripts/config -e 9P_FS -- scripts/config -e 9P_FSCACHE -- scripts/config -e 9P_FS_POSIX_ACL -- scripts/config -e NET_9P -- scripts/config -e NET_9P_VIRTIO -- scripts/config -e R8169 -- scripts/config -e 8139TOO -- scripts/config -e 8139CP -- scripts/config -e IKCONFIG -- scripts/config -e IKCONFIG_PROC -- scripts/config -e SECCOMP -- scripts/config -d DEBUG_STACK_TRACE -- scripts/config -e NFSD -- scripts/config -e NFSD_V3 -- scripts/config -e KVM -- scripts/config -e TUN -- scripts/config -e BRIDGE -- scripts/config -e VHOST_NET -- scripts/config -e NF_NAT -- scripts/config -e NF_NAT_IPV4 -- scripts/config -e IP_NF_TARGET_MASQUERADE -- scripts/config -e FB_VESA -- scripts/config -e HOTPLUG_PCI -- scripts/config -e HOTPLUG_PCI_ACPI -- scripts/config -e VLAN_8021Q -- scripts/config -e BRIDGE_VLAN_FILTERING -# Required for M400 -- scripts/config -e SATA_AHCI_PLATFORM -- scripts/config -e AHCI_XGENE -- scripts/config -e GENERIC_PHY -- scripts/config -e PHY_XGENE -- scripts/config -e NET_VENDOR_MELLANOX -- scripts/config -e MLX4_EN -- scripts/config -e MLX4_EN_DCB -- scripts/config -e MLX4_EN_VXLAN -- scripts/config -e MLX4_CORE -- scripts/config -e MLX5_CORE -- scripts/config -e NET_IP_TUNNEL -- scripts/config -e VXLAN -- scripts/config -e UIO -- scripts/config -e UIO_PDRV_GENIRQ -- scripts/config -e GPIO_DWAPB -- scripts/config -e KEYBOARD_GPIO -- scripts/config -e INPUT_POLLDEV -- scripts/config -e KEYBOARD_GPIO_POLLED -- scripts/config -d DMA_CMA -- scripts/config -e POWER_RESET -- scripts/config -e POWER_RESET_GPIO -- scripts/config -e POWER_RESET_SYSCON -- scripts/config -e POWER_AVS -- yes '' | make ARCH=arm64 oldconfig -build-commands: -# Only generate Image here, uImage generated in deployment -# due to availability of mkimage build systems -- make vmlinux dtbs $MAKEFLAGS -install-commands: -- mkdir -p "$DESTDIR"/boot -- make install dtbs_install INSTALL_PATH="$DESTDIR/boot" diff --git a/strata/bsp-armv8l64-generic/linux-armv8l64-generic.morph b/strata/bsp-armv8l64-generic/linux-armv8l64-generic.morph new file mode 100644 index 00000000..120239b9 --- /dev/null +++ b/strata/bsp-armv8l64-generic/linux-armv8l64-generic.morph @@ -0,0 +1,104 @@ +name: linux-armv8l64-generic +kind: chunk +configure-commands: +- make ARCH=arm64 defconfig +- scripts/config -e PACKET +- scripts/config -e SATA_AHCI +- scripts/config -e ATA_GENERIC +- scripts/config -e HAVE_IDE +- scripts/config -d BLK_DEV_IDE_SATA +- scripts/config -e BTRFS_FS +- scripts/config -e BTRFS_FS_POSIX_ACL +- scripts/config -e DEVTMPFS +- scripts/config -e DEVTMPFS_MOUNT +- scripts/config -e CONFIG_FHANDLE +- scripts/config -e CGROUPS +- scripts/config -e AUTOFS4_FS +- scripts/config --set-str UEVENT_HELPER_PATH '' +- scripts/config -e EXT2_FS +- scripts/config -e EXT2_FS_XATTR +- scripts/config -e EXT2_FS_POSIX_ACL +- scripts/config -e EXT2_FS_SECURITY +- scripts/config -e EXT2_FS_XIP +- scripts/config -e EXT3_FS +- scripts/config -d EXT3_DEFAULTS_TO_ORDERED +- scripts/config -e EXT3_FS_XATTR +- scripts/config -e EXT3_FS_POSIX_ACL +- scripts/config -e EXT3_FS_SECURITY +- scripts/config -e EXT4_FS +- scripts/config -e EXT4_FS_XATTR +- scripts/config -e EXT4_FS_POSIX_ACL +- scripts/config -e EXT4_FS_SECURITY +- scripts/config -d EXT4_DEBUG +- scripts/config -d JBD_DEBUG +- scripts/config -d JBD2_DEBUG +- scripts/config -e BLK_DEV_LOOP +- scripts/config -d BLK_DEV_CRYPTOLOOP +- scripts/config -e CEPH_FS +- scripts/config --set-val BLK_DEV_LOOP_MIN_COUNT 8 +- scripts/config -e VIRTIO +- scripts/config -e VIRTIO_RING +- scripts/config -e VIRTIO_PCI +- scripts/config -e VIRTIO_BALLOON +- scripts/config -e VIRTIO_BLK +- scripts/config -e VIRTIO_NET +- scripts/config -e VIRTIO_CONSOLE +- scripts/config -e HW_RANDOM_VIRTIO +- scripts/config -e 9P_FS +- scripts/config -e 9P_FSCACHE +- scripts/config -e 9P_FS_POSIX_ACL +- scripts/config -e NET_9P +- scripts/config -e NET_9P_VIRTIO +- scripts/config -e R8169 +- scripts/config -e 8139TOO +- scripts/config -e 8139CP +- scripts/config -e IKCONFIG +- scripts/config -e IKCONFIG_PROC +- scripts/config -e SECCOMP +- scripts/config -d DEBUG_STACK_TRACE +- scripts/config -e NFSD +- scripts/config -e NFSD_V3 +- scripts/config -e KVM +- scripts/config -e TUN +- scripts/config -e BRIDGE +- scripts/config -e VHOST_NET +- scripts/config -e NF_NAT +- scripts/config -e NF_NAT_IPV4 +- scripts/config -e IP_NF_TARGET_MASQUERADE +- scripts/config -e FB_VESA +- scripts/config -e HOTPLUG_PCI +- scripts/config -e HOTPLUG_PCI_ACPI +- scripts/config -e VLAN_8021Q +- scripts/config -e BRIDGE_VLAN_FILTERING +# Required for M400 +- scripts/config -e SATA_AHCI_PLATFORM +- scripts/config -e AHCI_XGENE +- scripts/config -e GENERIC_PHY +- scripts/config -e PHY_XGENE +- scripts/config -e NET_VENDOR_MELLANOX +- scripts/config -e MLX4_EN +- scripts/config -e MLX4_EN_DCB +- scripts/config -e MLX4_EN_VXLAN +- scripts/config -e MLX4_CORE +- scripts/config -e MLX5_CORE +- scripts/config -e NET_IP_TUNNEL +- scripts/config -e VXLAN +- scripts/config -e UIO +- scripts/config -e UIO_PDRV_GENIRQ +- scripts/config -e GPIO_DWAPB +- scripts/config -e KEYBOARD_GPIO +- scripts/config -e INPUT_POLLDEV +- scripts/config -e KEYBOARD_GPIO_POLLED +- scripts/config -d DMA_CMA +- scripts/config -e POWER_RESET +- scripts/config -e POWER_RESET_GPIO +- scripts/config -e POWER_RESET_SYSCON +- scripts/config -e POWER_AVS +- yes '' | make ARCH=arm64 oldconfig +build-commands: +# Only generate Image here, uImage generated in deployment +# due to availability of mkimage build systems +- make vmlinux dtbs $MAKEFLAGS +install-commands: +- mkdir -p "$DESTDIR"/boot +- make install dtbs_install INSTALL_PATH="$DESTDIR/boot" -- cgit v1.2.1 From 2986b002abaf98d7ce279c76e6ed2d3f6e278bd5 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 24 Feb 2015 17:55:34 +0000 Subject: Add missing python-core stratum to armv8l64 systems --- systems/build-system-armv8l64.morph | 2 ++ systems/devel-system-armv8l64.morph | 2 ++ 2 files changed, 4 insertions(+) diff --git a/systems/build-system-armv8l64.morph b/systems/build-system-armv8l64.morph index 7715ecb7..01d70c61 100644 --- a/systems/build-system-armv8l64.morph +++ b/systems/build-system-armv8l64.morph @@ -12,6 +12,8 @@ strata: morph: strata/core.morph - name: foundation morph: strata/foundation.morph +- name: python-core + morph: strata/python-core.morph - name: bsp-armv8l64-generic morph: strata/bsp-armv8l64-generic.morph - name: tools diff --git a/systems/devel-system-armv8l64.morph b/systems/devel-system-armv8l64.morph index 27080535..e292e780 100644 --- a/systems/devel-system-armv8l64.morph +++ b/systems/devel-system-armv8l64.morph @@ -30,6 +30,8 @@ strata: morph: strata/baserock-import.morph - name: nfs morph: strata/nfs.morph +- name: python-core + morph: strata/python-core.morph - name: python-tools morph: strata/python-tools.morph - name: devtools -- cgit v1.2.1 From 6a4c12cf6bbae77dae1a9245cb6d9b644da639db Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Fri, 20 Feb 2015 14:42:33 +0000 Subject: Install 'Image' in the /boot directory --- strata/bsp-armv8l64-generic/linux-armv8l64-generic.morph | 1 + 1 file changed, 1 insertion(+) diff --git a/strata/bsp-armv8l64-generic/linux-armv8l64-generic.morph b/strata/bsp-armv8l64-generic/linux-armv8l64-generic.morph index 120239b9..4eb92de4 100644 --- a/strata/bsp-armv8l64-generic/linux-armv8l64-generic.morph +++ b/strata/bsp-armv8l64-generic/linux-armv8l64-generic.morph @@ -102,3 +102,4 @@ build-commands: install-commands: - mkdir -p "$DESTDIR"/boot - make install dtbs_install INSTALL_PATH="$DESTDIR/boot" +- cp arch/arm64/boot/Image "$DESTDIR/boot/vmlinux" -- cgit v1.2.1 From 7a1b589138d654151227d590ea23d898fca1df7d Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Thu, 19 Feb 2015 14:10:33 +0000 Subject: pxeboot: fix keyword argument name passed to remote_kernel() --- pxeboot.write | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxeboot.write b/pxeboot.write index e33da527..a0cae1e7 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -660,7 +660,7 @@ class PXEBoot(morphlib.writeexts.WriteExtension): url = urlparse.urlsplit(rootfs_rsync) nfsroot = os.environ.get('PXEBOOT_ROOTFS_NFSROOT', '%s:%s' % (url.hostname, url.path)) - with self.remote_kernel(rootfs=temp_root, url=kernel_tftpaddr, + with self.remote_kernel(rootfs=temp_root, tftp_url=kernel_tftpaddr, macaddr=macaddr) as kernel_subpath, \ self.remote_nfsroot(rootfs=temp_root, rsync_url=rootfs_rsync)\ as rootfs_subpath, \ -- cgit v1.2.1 From d2f7b1d768b324bd75c09475c62ff0ed96bef760 Mon Sep 17 00:00:00 2001 From: Edward Cragg Date: Fri, 20 Feb 2015 14:46:48 +0000 Subject: pxeboot: fix input argument to urlunsplit() --- pxeboot.write | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pxeboot.write b/pxeboot.write index a0cae1e7..848c6026 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -365,8 +365,8 @@ class PXEBoot(morphlib.writeexts.WriteExtension): template = os.path.join(url.path, 'nfsroot.XXXXXXXXXX') with self._remote_tempdir(hostname=url.hostname, template=template) \ as tempdir: - nfsroot = urlparse.urlunsplit(url.scheme, url.netloc, tempdir, - url.query, url.fragment) + nfsroot = urlparse.urlunsplit((url.scheme, url.netloc, tempdir, + url.query, url.fragment)) cliapp.runcmd(['rsync', '-asXSPH', '--delete', rootfs, nfsroot], stdin=None, stdout=None, stderr=None) yield basename -- cgit v1.2.1 From dfb6501478a1888e0447faf50a2fa3e01dbe96c9 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 24 Feb 2015 14:48:12 +0000 Subject: pxeboot: add missing macaddr argument --- pxeboot.write | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pxeboot.write b/pxeboot.write index 848c6026..0a6b7fc1 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -662,8 +662,8 @@ class PXEBoot(morphlib.writeexts.WriteExtension): '%s:%s' % (url.hostname, url.path)) with self.remote_kernel(rootfs=temp_root, tftp_url=kernel_tftpaddr, macaddr=macaddr) as kernel_subpath, \ - self.remote_nfsroot(rootfs=temp_root, rsync_url=rootfs_rsync)\ - as rootfs_subpath, \ + self.remote_nfsroot(rootfs=temp_root, rsync_url=rootfs_rsync, \ + macaddr=macaddr) as rootfs_subpath, \ self.remote_pxeboot_config(tftproot=config_tftpaddr, kernel_tftproot=kernel_tftproot, kernel_subpath=kernel_subpath, -- cgit v1.2.1 From e100fddd212608f6b485c766163af4cf48e02bfe Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 24 Feb 2015 14:55:25 +0000 Subject: pxeboot: yield the correct value in remote_nfsroot() --- pxeboot.write | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pxeboot.write b/pxeboot.write index 0a6b7fc1..d19d5c03 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -369,7 +369,8 @@ class PXEBoot(morphlib.writeexts.WriteExtension): url.query, url.fragment)) cliapp.runcmd(['rsync', '-asXSPH', '--delete', rootfs, nfsroot], stdin=None, stdout=None, stderr=None) - yield basename + yield os.path.join(os.path.basename(tempdir), + os.path.basename(rootfs)) @staticmethod def _write_pxe_config(fh, kernel_tftp_url, rootfs_nfs_url, extra_args=''): -- cgit v1.2.1 From e2e87985b06fd0a05ada1f99e9a8b4a5612ed621 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 24 Feb 2015 15:02:20 +0000 Subject: pxeboot: fix usage of undefined variable --- pxeboot.write | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxeboot.write b/pxeboot.write index d19d5c03..ef88228d 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -403,7 +403,7 @@ class PXEBoot(morphlib.writeexts.WriteExtension): @contextlib.contextmanager def remote_pxeboot_config(self, tftproot, kernel_tftproot, kernel_subpath, rootfs_nfsroot, rootfs_subpath, macaddr): - rootfs_nfs_url = '{}:{}/{}'.format(ip, rootfs_nfsroot, rootfs_subpath) + rootfs_nfs_url = '{}/{}'.format(rootfs_nfsroot, rootfs_subpath) kernel_tftp_url = '{}/{}'.format(kernel_tftproot, kernel_subpath) pxe_cfg_filename = _normalise_macaddr(macaddr) url = urlparse.urlsplit(tftproot) -- cgit v1.2.1 From e5a646f600d9da11804791e5e5cd565feea92eca Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 24 Feb 2015 14:55:57 +0000 Subject: pxeboot: avoid setting stdout=None when running rsync If stdout=None, rsync hangs and the following error occurs error: uncaptured python exception, closing channel (:unsupported format character 'k' (0x6b) at index 29 [/usr/lib/python2.7/asyncore.py|readwrite|108] [/usr/lib/python2.7/asyncore.py|handle_read_event|449] [/usr/lib/python2.7/asynchat.py|handle_read|165] [/usr/lib/python2.7/site-packages/morphlib/extensions.py|found_terminator|196] [/usr/lib/python2.7/site-packages/morphlib/plugins/deploy_plugin.py|_report_extension_stdout|615] [/usr/lib/python2.7/site-packages/morphlib/app.py|status|345]) --- pxeboot.write | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pxeboot.write b/pxeboot.write index ef88228d..38fa4846 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -368,7 +368,8 @@ class PXEBoot(morphlib.writeexts.WriteExtension): nfsroot = urlparse.urlunsplit((url.scheme, url.netloc, tempdir, url.query, url.fragment)) cliapp.runcmd(['rsync', '-asXSPH', '--delete', rootfs, nfsroot], - stdin=None, stdout=None, stderr=None) + stdin=None, stdout=open(os.devnull, 'w'), + stderr=None) yield os.path.join(os.path.basename(tempdir), os.path.basename(rootfs)) -- cgit v1.2.1 From 7298d113860abb651fabdeaf35b5bcbda20cbe5a Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Wed, 25 Feb 2015 10:13:44 +0000 Subject: pxeboot: disable preserving extended attributes Running rsync with the '-X' option causes the following error to occur: ERROR: pxeboot.write failed with code 1: rsync: get_xattr_names: llistxattr(""/src/tmp/deployments/tmpcMabnt/tmp0jCu5s"",1024) failed: Function not implemented (38) This requires more investigation to understand why it is failing (the attr devel libraries were installed). AFAIK we are not using extended attributes in the rootfs that we create, so disable this option for the time being. --- pxeboot.write | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxeboot.write b/pxeboot.write index 38fa4846..c2148081 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -367,7 +367,7 @@ class PXEBoot(morphlib.writeexts.WriteExtension): as tempdir: nfsroot = urlparse.urlunsplit((url.scheme, url.netloc, tempdir, url.query, url.fragment)) - cliapp.runcmd(['rsync', '-asXSPH', '--delete', rootfs, nfsroot], + cliapp.runcmd(['rsync', '-asSPH', '--delete', rootfs, nfsroot], stdin=None, stdout=open(os.devnull, 'w'), stderr=None) yield os.path.join(os.path.basename(tempdir), -- cgit v1.2.1 From a6d7d3a8537215d0315a8dad66565ba26294b8b8 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 24 Feb 2015 14:58:57 +0000 Subject: pxeboot: support u-boot pxe configuration file lookup u-boot will look for a pxelinux configuration file on the TFTP server whose name corresponds to the normalized MAC address of the NIC prefixed with '01-' (Leading 01 means Ethernet). This support is only being added to remote deployments for now. --- pxeboot.write | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/pxeboot.write b/pxeboot.write index c2148081..3fdda5f2 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -330,6 +330,16 @@ class PXEBoot(morphlib.writeexts.WriteExtension): finally: cliapp.ssh_runcmd(hostname, ['rm', dst]) + @contextlib.contextmanager + def _remote_symlink(self, hostname, src, dst): + cliapp.ssh_runcmd(hostname, + ['ln', '-s', '-f', src, dst], + stdin=None, stdout=None, stderr=None) + try: + yield + finally: + cliapp.ssh_runcmd(hostname, ['rm', '-f', dst]) + @contextlib.contextmanager def remote_kernel(self, rootfs, tftp_url, macaddr): for name in ('vmlinuz', 'zImage', 'uImage'): @@ -408,14 +418,21 @@ class PXEBoot(morphlib.writeexts.WriteExtension): kernel_tftp_url = '{}/{}'.format(kernel_tftproot, kernel_subpath) pxe_cfg_filename = _normalise_macaddr(macaddr) url = urlparse.urlsplit(tftproot) - inst_cfg_path = os.path.join(url.path, 'pxelinux.cfg', - pxe_cfg_filename) + inst_cfg_path = os.path.join(url.path, 'pxelinux.cfg') with tempfile.NamedTemporaryFile() as f: - self._write_pxe_config(fh=f, kernel_tftp_url=kernel_tftp_url, - rootfs_nfs_url=rootfs_nfs_url, - extra_args=os.environ.get('KERNEL_ARGS','')) - with self._remote_copy(hostname=url.hostname, src=f.name, - dst=inst_cfg_path): + self._write_pxe_config( + fh=f, kernel_tftp_url=kernel_tftp_url, + rootfs_nfs_url=rootfs_nfs_url, + extra_args=os.environ.get('KERNEL_ARGS','')) + with self._remote_copy( + hostname=url.hostname, src=f.name, + dst=os.path.join(inst_cfg_path, + pxe_cfg_filename)), \ + self._remote_symlink( + hostname=url.hostname, + src=pxe_cfg_filename, + dst=os.path.join(inst_cfg_path, + '01-' + pxe_cfg_filename)): yield @contextlib.contextmanager -- cgit v1.2.1 From 16b3c231f2dcfe6474909d78a0b267601ddd17e3 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 24 Feb 2015 17:38:17 +0000 Subject: pxeboot: improve compatibility with u-boot pxe u-boot pxe doesn't understand the tftp:// URIs. Workaround by making the kernel download URL in the pxelinux.cfg file to be of the following form: : --- pxeboot.write | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pxeboot.write b/pxeboot.write index 3fdda5f2..8c46bcbe 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -415,7 +415,8 @@ class PXEBoot(morphlib.writeexts.WriteExtension): def remote_pxeboot_config(self, tftproot, kernel_tftproot, kernel_subpath, rootfs_nfsroot, rootfs_subpath, macaddr): rootfs_nfs_url = '{}/{}'.format(rootfs_nfsroot, rootfs_subpath) - kernel_tftp_url = '{}/{}'.format(kernel_tftproot, kernel_subpath) + url = urlparse.urlsplit(kernel_tftproot) + kernel_tftp_url = '{}:{}'.format(url.netloc, kernel_subpath) pxe_cfg_filename = _normalise_macaddr(macaddr) url = urlparse.urlsplit(tftproot) inst_cfg_path = os.path.join(url.path, 'pxelinux.cfg') -- cgit v1.2.1 From 7f7372a6230d852cb89e4a5fa66bf0cf7a7adeae Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 24 Feb 2015 14:23:50 +0000 Subject: pxeboot: document KERNEL_ARGS --- pxeboot.write.help | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pxeboot.write.help b/pxeboot.write.help index 58a86957..4ffdb501 100644 --- a/pxeboot.write.help +++ b/pxeboot.write.help @@ -121,3 +121,17 @@ help: > If it is possible for the target to notify you that it has finished installing, you can put a command in here to wait for the event. + + + # Misc + + + ## KERNEL_ARGS + + + Additional kernel command line options. Note that the following + options + + root=/dev/nfs ip=dhcp nfsroot=$NFSROOT` + + are implicitly added by the extension. -- cgit v1.2.1 From 588917e4c52dff7d8650ca6480ed5bbf3916389b Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 24 Feb 2015 14:04:46 +0000 Subject: pxeboot: add support for specifying a device tree The support is only being added to remote deployments for now. --- pxeboot.write | 27 +++++++++++++++++++++++++-- pxeboot.write.help | 7 +++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/pxeboot.write b/pxeboot.write index 8c46bcbe..0f541998 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -355,6 +355,21 @@ class PXEBoot(morphlib.writeexts.WriteExtension): dst=target_path): yield basename + @contextlib.contextmanager + def remote_fdt(self, rootfs, tftp_url, macaddr): + fdt_rel_path = os.environ.get('DTB_PATH', '') + if fdt_rel_path == '': + yield + fdt_abs_path = os.path.join(rootfs, fdt_rel_path) + if not fdt_abs_path: + raise cliapp.AppException('Failed to locate Flattened Device Tree') + url = urlparse.urlsplit(tftp_url) + basename = '{}-fdt'.format(_normalise_macaddr(macaddr)) + target_path = os.path.join(url.path, basename) + with self._remote_copy(hostname=url.hostname, src=fdt_abs_path, + dst=target_path): + yield basename + @contextlib.contextmanager def local_nfsroot(self, rootfs, target_ip): nfsroot = target_ip + ':' + rootfs @@ -384,7 +399,8 @@ class PXEBoot(morphlib.writeexts.WriteExtension): os.path.basename(rootfs)) @staticmethod - def _write_pxe_config(fh, kernel_tftp_url, rootfs_nfs_url, extra_args=''): + def _write_pxe_config(fh, kernel_tftp_url, rootfs_nfs_url, + fdt_subpath=None, extra_args=''): fh.write(textwrap.dedent('''\ DEFAULT default LABEL default @@ -392,6 +408,8 @@ class PXEBoot(morphlib.writeexts.WriteExtension): APPEND root=/dev/nfs ip=dhcp nfsroot={rootfs_nfs_url} {extra_args} ''').format(kernel_url=kernel_tftp_url, rootfs_nfs_url=rootfs_nfs_url, extra_args=extra_args)) + if fdt_subpath is not None: + fh.write("FDT {}\n".format(fdt_subpath)) fh.flush() @contextlib.contextmanager @@ -413,7 +431,8 @@ class PXEBoot(morphlib.writeexts.WriteExtension): @contextlib.contextmanager def remote_pxeboot_config(self, tftproot, kernel_tftproot, kernel_subpath, - rootfs_nfsroot, rootfs_subpath, macaddr): + fdt_subpath, rootfs_nfsroot, rootfs_subpath, + macaddr): rootfs_nfs_url = '{}/{}'.format(rootfs_nfsroot, rootfs_subpath) url = urlparse.urlsplit(kernel_tftproot) kernel_tftp_url = '{}:{}'.format(url.netloc, kernel_subpath) @@ -423,6 +442,7 @@ class PXEBoot(morphlib.writeexts.WriteExtension): with tempfile.NamedTemporaryFile() as f: self._write_pxe_config( fh=f, kernel_tftp_url=kernel_tftp_url, + fdt_subpath=fdt_subpath, rootfs_nfs_url=rootfs_nfs_url, extra_args=os.environ.get('KERNEL_ARGS','')) with self._remote_copy( @@ -682,11 +702,14 @@ class PXEBoot(morphlib.writeexts.WriteExtension): '%s:%s' % (url.hostname, url.path)) with self.remote_kernel(rootfs=temp_root, tftp_url=kernel_tftpaddr, macaddr=macaddr) as kernel_subpath, \ + self.remote_fdt(rootfs=temp_root, tftp_url=kernel_tftpaddr, + macaddr=macaddr) as fdt_subpath, \ self.remote_nfsroot(rootfs=temp_root, rsync_url=rootfs_rsync, \ macaddr=macaddr) as rootfs_subpath, \ self.remote_pxeboot_config(tftproot=config_tftpaddr, kernel_tftproot=kernel_tftproot, kernel_subpath=kernel_subpath, + fdt_subpath=fdt_subpath, rootfs_nfsroot=nfsroot, rootfs_subpath=rootfs_subpath, macaddr=macaddr): diff --git a/pxeboot.write.help b/pxeboot.write.help index 4ffdb501..0e5242ca 100644 --- a/pxeboot.write.help +++ b/pxeboot.write.help @@ -135,3 +135,10 @@ help: > root=/dev/nfs ip=dhcp nfsroot=$NFSROOT` are implicitly added by the extension. + + + ## DTB_PATH + + + Location in the deployed root filesystem of the Flattened Device + Tree blob (FDT) to use. -- cgit v1.2.1 From 226129ec54cdcbee879076c535c3834b98a07a9a Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Wed, 25 Feb 2015 16:11:51 +0000 Subject: pxeboot: add support for a PXE_INSTALLER option If PXE_INSTALLER is set to `no` or `False`, the remotely installed rootfs, Kernel, bootloader config file and device tree blob if specified, will not be removed after the deployment finishes. --- pxeboot.write | 20 ++++++++++++++------ pxeboot.write.help | 10 ++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/pxeboot.write b/pxeboot.write index 0f541998..06c44a31 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -223,11 +223,13 @@ class PXEBoot(morphlib.writeexts.WriteExtension): @contextlib.contextmanager def _remote_tempdir(self, hostname, template): + persist = os.environ.get('PXE_INSTALLER') in ('no', 'False') td = cliapp.ssh_runcmd(hostname, ['mktemp', '-d', template]).strip() try: yield td finally: - cliapp.ssh_runcmd(hostname, ['find', td, '-delete']) + if not persist: + cliapp.ssh_runcmd(hostname, ['find', td, '-delete']) def _serve_tftpd(self, sock, host, port, interface, tftproot): self.settings.progname = 'tftp server' @@ -321,6 +323,7 @@ class PXEBoot(morphlib.writeexts.WriteExtension): @contextlib.contextmanager def _remote_copy(self, hostname, src, dst): + persist = os.environ.get('PXE_INSTALLER') in ('no', 'False') with open(src, 'r') as f: cliapp.ssh_runcmd(hostname, ['install', '-D', '-m644', '/proc/self/fd/0', @@ -328,17 +331,20 @@ class PXEBoot(morphlib.writeexts.WriteExtension): try: yield finally: - cliapp.ssh_runcmd(hostname, ['rm', dst]) + if not persist: + cliapp.ssh_runcmd(hostname, ['rm', dst]) @contextlib.contextmanager def _remote_symlink(self, hostname, src, dst): + persist = os.environ.get('PXE_INSTALLER') in ('no', 'False') cliapp.ssh_runcmd(hostname, ['ln', '-s', '-f', src, dst], stdin=None, stdout=None, stderr=None) try: yield finally: - cliapp.ssh_runcmd(hostname, ['rm', '-f', dst]) + if not persist: + cliapp.ssh_runcmd(hostname, ['rm', '-f', dst]) @contextlib.contextmanager def remote_kernel(self, rootfs, tftp_url, macaddr): @@ -713,9 +719,11 @@ class PXEBoot(morphlib.writeexts.WriteExtension): rootfs_nfsroot=nfsroot, rootfs_subpath=rootfs_subpath, macaddr=macaddr): - self.ipmi_pxe_reboot_target() - self.wait_for_target_to_install() - self.ipmi_reboot_target() + persist = os.environ.get('PXE_INSTALLER') in ('no', 'False') + if not persist: + self.ipmi_pxe_reboot_target() + self.wait_for_target_to_install() + self.ipmi_reboot_target() else: cliapp.AppException('Invalid PXEBOOT_MODE: %s' % mode) diff --git a/pxeboot.write.help b/pxeboot.write.help index 0e5242ca..3aefe75e 100644 --- a/pxeboot.write.help +++ b/pxeboot.write.help @@ -142,3 +142,13 @@ help: > Location in the deployed root filesystem of the Flattened Device Tree blob (FDT) to use. + + + ## PXE_INSTALLER + + + If set to `no`, `False` or any other YAML value for false, the + remotely installed rootfs, kernel, bootloader config file and + device tree blob if specified, will not be removed after the + deployment finishes. This variable is only meanful on the + `existing-server` mode. -- cgit v1.2.1 From edd80e91c1105657f93163b614faef66c80a98c2 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Wed, 25 Feb 2015 16:16:30 +0000 Subject: pxeboot: improve naming of remote rootfs directories Construct its name based on the MAC address of the NIC, as it is already being done for the kernel and device tree blob. --- pxeboot.write | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pxeboot.write b/pxeboot.write index 06c44a31..399914f5 100755 --- a/pxeboot.write +++ b/pxeboot.write @@ -393,7 +393,8 @@ class PXEBoot(morphlib.writeexts.WriteExtension): @contextlib.contextmanager def remote_nfsroot(self, rootfs, rsync_url, macaddr): url = urlparse.urlsplit(rsync_url) - template = os.path.join(url.path, 'nfsroot.XXXXXXXXXX') + template = os.path.join(url.path, + _normalise_macaddr(macaddr) + '.XXXXXXXXXX') with self._remote_tempdir(hostname=url.hostname, template=template) \ as tempdir: nfsroot = urlparse.urlunsplit((url.scheme, url.netloc, tempdir, -- cgit v1.2.1 From 709c416d5891adac91c3d41af6812409abc9b2b1 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Thu, 19 Feb 2015 14:13:05 +0000 Subject: Add PXE-based deployment support to an HP Moonshot node --- clusters/moonshot-pxe-armv8l64.morph | 22 ++++++++++++++++++++++ moonshot-kernel.configure | 33 +++++++++++++++++++++++++++++++++ moonshot/boot/m400-1003.dtb | Bin 0 -> 18063 bytes moonshot/manifest | 2 ++ systems/build-system-armv8l64.morph | 1 + systems/devel-system-armv8l64.morph | 1 + 6 files changed, 59 insertions(+) create mode 100644 clusters/moonshot-pxe-armv8l64.morph create mode 100644 moonshot-kernel.configure create mode 100644 moonshot/boot/m400-1003.dtb create mode 100644 moonshot/manifest diff --git a/clusters/moonshot-pxe-armv8l64.morph b/clusters/moonshot-pxe-armv8l64.morph new file mode 100644 index 00000000..3286c72e --- /dev/null +++ b/clusters/moonshot-pxe-armv8l64.morph @@ -0,0 +1,22 @@ +name: moonshot-m400-armv8l64-netboot +kind: cluster +description: | + Deploy an armv8l64 devel system into a HP Moonshot node + + The system will be configured to boot through PXE from existing DHCP, + TFTP and NFS servers. +systems: +- morph: systems/devel-system-armv8l64.morph + deploy: + netboot: + type: pxeboot + location: 14:58:d0:57:7f:42 + PXEBOOT_MODE: existing-server + PXEBOOT_CONFIG_TFTP_ADDRESS: sftp://192.168.0.1/srv/nfsboot/tftp/ + PXEBOOT_ROOTFS_RSYNC_ADDRESS: rsync://192.168.0.1/srv/nfsboot/ + KERNEL_ARGS: console=ttyS0,9600n8r rw + DTB_PATH: boot/m400-1003.dtb + HOSTNAME: baserock-m400-node31 + MOONSHOT_KERNEL: yes + INSTALL_FILES: moonshot/manifest + PXE_INSTALLER: no diff --git a/moonshot-kernel.configure b/moonshot-kernel.configure new file mode 100644 index 00000000..11d01751 --- /dev/null +++ b/moonshot-kernel.configure @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Copyright (C) 2014 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# This is a "morph deploy" configuration extension to convert a plain +# kernel Image to uImage, for an HP Moonshot m400 cartridge + +set -eu + +case "$MOONSHOT_KERNEL" in + True|yes) + echo "Converting kernel image for Moonshot" + mkimage -A arm -O linux -C none -T kernel -a 0x00080000 \ + -e 0x00080000 -n Linux -d "$1/boot/vmlinux" "$1/boot/uImage" + ;; + *) + echo Unrecognised option "$MOONSHOT_KERNEL" to MOONSHOT_KERNEL + exit 1 + ;; +esac diff --git a/moonshot/boot/m400-1003.dtb b/moonshot/boot/m400-1003.dtb new file mode 100644 index 00000000..d6fd83ee Binary files /dev/null and b/moonshot/boot/m400-1003.dtb differ diff --git a/moonshot/manifest b/moonshot/manifest new file mode 100644 index 00000000..dd80fe49 --- /dev/null +++ b/moonshot/manifest @@ -0,0 +1,2 @@ +0040755 0 0 /boot +0100744 0 0 /boot/m400-1003.dtb diff --git a/systems/build-system-armv8l64.morph b/systems/build-system-armv8l64.morph index 01d70c61..2fcb1e8c 100644 --- a/systems/build-system-armv8l64.morph +++ b/systems/build-system-armv8l64.morph @@ -41,3 +41,4 @@ configuration-extensions: - fstab - mason - cloud-init +- moonshot-kernel diff --git a/systems/devel-system-armv8l64.morph b/systems/devel-system-armv8l64.morph index e292e780..88495e48 100644 --- a/systems/devel-system-armv8l64.morph +++ b/systems/devel-system-armv8l64.morph @@ -43,3 +43,4 @@ configuration-extensions: - nfsboot - install-files - cloud-init +- moonshot-kernel -- cgit v1.2.1