diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..4d1b7b433 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ +### Summary of Changes + +TODO: Include a high-level description of the changes in this pull request. + + +### Justification + +TODO: Justify why this contribution should be part of the project. Link to an AZDO work item with `AB#${AZDO ID}`. + + +### Testing + +TODO: Detail what testing has been done to ensure this submission meets requirements. + +* [ ] I have built the core package feed with this PR in place. (`bitbake packagefeed-ni-core`) + + +### Procedure + +* [ ] I certify that the contents of this pull request complies with the [Developer Certificate of Origin](https://github.com/ni/nilrt/blob/HEAD/docs/CONTRIBUTING.md#developer-certificate-of-origin-dco). diff --git a/conf/distro/nilrt.conf b/conf/distro/nilrt.conf index d948cd9c1..abe8438af 100644 --- a/conf/distro/nilrt.conf +++ b/conf/distro/nilrt.conf @@ -1,10 +1,10 @@ DISTRO_NAME = "NI Linux Real-Time" -DISTRO_VERSION = "10.1" +DISTRO_VERSION = "11.0" DISTRO_CODENAME = "${LAYERSERIES_COMPAT_meta-nilrt}" -NILRT_FEED_NAME ?= "2024Q1" +NILRT_FEED_NAME ?= "2024Q4" DISTRO_FEATURES:append:x64 = "\ x11 \ diff --git a/conf/layer.conf b/conf/layer.conf index ff6fb4a6a..8e412e87d 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -9,4 +9,4 @@ BBFILE_COLLECTIONS += "meta-nilrt" BBFILE_PATTERN_meta-nilrt = "^${LAYERDIR}/" BBFILE_PRIORITY_meta-nilrt = "25" -LAYERSERIES_COMPAT_meta-nilrt = "kirkstone" +LAYERSERIES_COMPAT_meta-nilrt = "scarthgap" diff --git a/conf/bblayers.conf.sample b/conf/templates/default/bblayers.conf.sample similarity index 100% rename from conf/bblayers.conf.sample rename to conf/templates/default/bblayers.conf.sample diff --git a/conf/local.conf.sample b/conf/templates/default/local.conf.sample similarity index 100% rename from conf/local.conf.sample rename to conf/templates/default/local.conf.sample diff --git a/files/group b/files/group index 4b09a0a59..7fcb64e26 100644 --- a/files/group +++ b/files/group @@ -6,6 +6,8 @@ ni:x:500: openvpn:x:499: niwscerts:x:498: # free space +arpwatch:x:402: +ptest:x:401: ossec:x:400: mysql:x:399: datetime:x:398: diff --git a/files/passwd b/files/passwd index 6cf8186f8..92630f824 100644 --- a/files/passwd +++ b/files/passwd @@ -6,6 +6,8 @@ webserv:x:501:::: lvuser:x:500:::: openvpn:x:499:::: # free space +arpwatch:x:402:::: +ptest:x:401:::: ossec:x:400:::: mysql:x:399:::: polkitd:x:398:::: diff --git a/recipes-apps/mousepad/mousepad_0.5.%.bbappend b/recipes-apps/mousepad/mousepad_0.6.%.bbappend similarity index 100% rename from recipes-apps/mousepad/mousepad_0.5.%.bbappend rename to recipes-apps/mousepad/mousepad_0.6.%.bbappend diff --git a/recipes-bsp/grub/grub/add-inbit-command-to-io-module.patch b/recipes-bsp/grub/grub/add-inbit-command-to-io-module.patch index ded519bb5..a0233a45b 100644 --- a/recipes-bsp/grub/grub/add-inbit-command-to-io-module.patch +++ b/recipes-bsp/grub/grub/add-inbit-command-to-io-module.patch @@ -1,16 +1,19 @@ -From 48de0b2faec205e874099e0afdc14ab70919e702 Mon Sep 17 00:00:00 2001 +From 8267085891ed1efd3a8f46aff8ae172f94caaab7 Mon Sep 17 00:00:00 2001 From: Adrian Papp Date: Thu, 20 Feb 2014 15:01:05 +0200 Subject: [PATCH] add inbit command to io module * grub-core/commands/iorw.c: Add grub_cmd_read_bit and register inbit command + +Upstream-Status: Inappropriate [NI specific] + --- grub-core/commands/iorw.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/grub-core/commands/iorw.c b/grub-core/commands/iorw.c -index 584baec8f..45a79ed7f 100644 +index 584baec..45a79ed 100644 --- a/grub-core/commands/iorw.c +++ b/grub-core/commands/iorw.c @@ -27,6 +27,7 @@ @@ -81,6 +84,3 @@ index 584baec8f..45a79ed7f 100644 grub_unregister_command (cmd_write_byte); grub_unregister_command (cmd_write_word); grub_unregister_command (cmd_write_dword); --- -2.25.1 - diff --git a/recipes-bsp/grub/grub/cmd-test-Add-bitwise-AND-document-the-feature.patch b/recipes-bsp/grub/grub/cmd-test-Add-bitwise-AND-document-the-feature.patch index bd8bd9612..667ddcc6f 100644 --- a/recipes-bsp/grub/grub/cmd-test-Add-bitwise-AND-document-the-feature.patch +++ b/recipes-bsp/grub/grub/cmd-test-Add-bitwise-AND-document-the-feature.patch @@ -1,4 +1,4 @@ -From 1dfdfdfa97910081e50e70df9b3e78162987130a Mon Sep 17 00:00:00 2001 +From 2fa7700d70f71fa96061b78dabefbda536e63d9d Mon Sep 17 00:00:00 2001 From: Brad Mouring Date: Thu, 8 Dec 2016 11:03:42 -0600 Subject: [PATCH] cmd: test: Add bitwise AND, document the feature @@ -11,17 +11,20 @@ Here, we add a more generic ability to test the bitwise AND of a value available to the grub scripting environment. This obviates the need for the inbit command. +Upstream-Status: Inappropriate [NI specific] + Signed-off-by: Brad Mouring + --- docs/grub.texi | 2 ++ grub-core/commands/test.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi -index f829684ec..37aef949b 100644 +index a225f9a..51ae3e0 100644 --- a/docs/grub.texi +++ b/docs/grub.texi -@@ -5034,6 +5034,8 @@ the strings are not equal +@@ -5817,6 +5817,8 @@ the strings are not equal @var{integer1} is less than @var{integer2} @item @var{integer1} @code{-ne} @var{integer2} @var{integer1} is not equal to @var{integer2} @@ -31,7 +34,7 @@ index f829684ec..37aef949b 100644 @var{integer1} is greater than @var{integer2} after stripping off common non-numeric @var{prefix}. @item @var{prefix}@var{integer1} @code{-plt} @var{prefix}@var{integer2} diff --git a/grub-core/commands/test.c b/grub-core/commands/test.c -index 5f06642f6..af4fad728 100644 +index 62d3fb3..a34a8ed 100644 --- a/grub-core/commands/test.c +++ b/grub-core/commands/test.c @@ -290,6 +290,16 @@ test_parse (char **args, int *argn, int argc) @@ -51,6 +54,3 @@ index 5f06642f6..af4fad728 100644 /* -nt and -ot tests. GRUB extension: when doing -?t bias will be added to the first mtime. */ if (grub_memcmp (args[*argn + 1], "-nt", 3) == 0 --- -2.25.1 - diff --git a/recipes-bsp/grub/grub/grub-advertise-NI-NILRT-over-GNU-GRUB.patch b/recipes-bsp/grub/grub/grub-advertise-NI-NILRT-over-GNU-GRUB.patch index 5c9db01c7..ce09569a8 100644 --- a/recipes-bsp/grub/grub/grub-advertise-NI-NILRT-over-GNU-GRUB.patch +++ b/recipes-bsp/grub/grub/grub-advertise-NI-NILRT-over-GNU-GRUB.patch @@ -1,4 +1,4 @@ -From 83f4667406917c3ea089f7cbb4da3f6e8a48c1fe Mon Sep 17 00:00:00 2001 +From 464ac648e9df45779754fadccbc0088042a3c441 Mon Sep 17 00:00:00 2001 From: Ioan-Adrian Ratiu Date: Thu, 15 Dec 2016 14:04:40 +0200 Subject: [PATCH] grub: advertise NI NILRT over GNU GRUB @@ -8,27 +8,30 @@ they can be entered anyway. Presumably advanced users already know about them and can use them without being told and this discourages behaviour like "uu what does this button do?" from unknowledgeable users. +Upstream-Status: Inappropriate [NI specific] + Signed-off-by: Ioan-Adrian Ratiu + --- grub-core/normal/main.c | 2 +- grub-core/normal/menu_text.c | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 78a70a8bf..0a93eef30 100644 +index bd44310..d556012 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -208,7 +208,7 @@ grub_normal_init_page (struct grub_term_output *term, - +@@ -209,7 +209,7 @@ grub_normal_init_page (struct grub_term_output *term, + grub_term_cls (term); - msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION); + msg_formatted = grub_xasprintf (_("NI Linux Real-Time Boot Options")); if (!msg_formatted) return; - + diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c -index e22bb91f6..d2411750b 100644 +index b1321eb..50a77b7 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -181,17 +181,13 @@ command-line or ESC to discard edits and return to the GRUB menu."), @@ -49,8 +52,5 @@ index e22bb91f6..d2411750b 100644 - "or `c' for a command-line."), + (_("Press enter to boot the selected OS. "), STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); - } + } } --- -2.25.1 - diff --git a/recipes-core/base-files/base-files/safemode-ps1.sh b/recipes-core/base-files/base-files/safemode-ps1.sh index cf7e0a7a5..892c91cfb 100644 --- a/recipes-core/base-files/base-files/safemode-ps1.sh +++ b/recipes-core/base-files/base-files/safemode-ps1.sh @@ -1,3 +1,3 @@ -if [ -f /etc/natinst/safemode ] || /sbin/runlevel | egrep -q ' 4$' ; then +if [ -f /etc/natinst/safemode ] || /sbin/runlevel | grep -Eq ' 4$' ; then PS1="(safemode) $PS1" fi diff --git a/recipes-core/busybox/busybox/0001-ifplugd.c-Increase-buffer-size-for-netlink-binding.patch b/recipes-core/busybox/busybox/0001-ifplugd.c-Increase-buffer-size-for-netlink-binding.patch index e5326c8e0..3de24371d 100644 --- a/recipes-core/busybox/busybox/0001-ifplugd.c-Increase-buffer-size-for-netlink-binding.patch +++ b/recipes-core/busybox/busybox/0001-ifplugd.c-Increase-buffer-size-for-netlink-binding.patch @@ -17,8 +17,9 @@ for x64-based systems. Signed-off-by: Charlie Johnston -Upstream-Status: Inappropriate [Large numbers of adapters -are uncommon on embedded systems] +Upstream-Status: Inappropriate [NI specific] + +Large numbers of adapters are uncommon on embedded systems --- networking/ifplugd.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/recipes-core/busybox/busybox/zcip-allow-action-script-to-reject-chosen-IP.patch b/recipes-core/busybox/busybox/zcip-allow-action-script-to-reject-chosen-IP.patch index df6151f5b..cd06b465e 100644 --- a/recipes-core/busybox/busybox/zcip-allow-action-script-to-reject-chosen-IP.patch +++ b/recipes-core/busybox/busybox/zcip-allow-action-script-to-reject-chosen-IP.patch @@ -13,6 +13,8 @@ delegate the complexity of this problem to the action script, by letting it reject the chosen IP by returning error 67 (ASCII 'C'). It is assumed that the action script has left the interface deconfigured. +Upstream-Status: Inappropriate [NI specific] + Signed-off-by: Richard Tollerton --- networking/zcip.c | 11 ++++++++++- diff --git a/recipes-core/busybox/files/ifplugd.action b/recipes-core/busybox/files/ifplugd.action index a192b0b03..bd3211d7a 100755 --- a/recipes-core/busybox/files/ifplugd.action +++ b/recipes-core/busybox/files/ifplugd.action @@ -10,9 +10,6 @@ export INTERFACE=$1 -# If there are drivers that need priorities changed, do it -update_driver_priorities - case "$2" in up) # On link-up, we're not guaranteed to be on the same network as diff --git a/recipes-core/glibc/glibc/cp936_support.patch b/recipes-core/glibc/glibc/0001-glibc-add-cp936-support.patch similarity index 99% rename from recipes-core/glibc/glibc/cp936_support.patch rename to recipes-core/glibc/glibc/0001-glibc-add-cp936-support.patch index 0f17b7246..11e0bcd31 100644 --- a/recipes-core/glibc/glibc/cp936_support.patch +++ b/recipes-core/glibc/glibc/0001-glibc-add-cp936-support.patch @@ -1,7 +1,11 @@ -From a78510f2e89476bd1405ff6ded58c45e65790db9 Mon Sep 17 00:00:00 2001 +From 04db7826a114d2a3f506155a22a781694549381c Mon Sep 17 00:00:00 2001 From: Ben Shelton Date: Fri, 19 Jun 2020 14:15:16 -0500 +Subject: [PATCH] glibc: add cp936 support +Upstream-Status: Inappropriate [NI-specific] + +Signed-off-by: Alex Stewart --- iconv/skeleton.c | 4 + iconvdata/Makefile | 2 +- @@ -10,10 +14,10 @@ Date: Fri, 19 Jun 2020 14:15:16 -0500 create mode 100644 iconvdata/cp936.c diff --git a/iconv/skeleton.c b/iconv/skeleton.c -index 1dc642e2fc..4c46b079db 100644 +index 9b74a3853c..003e997b3a 100644 --- a/iconv/skeleton.c +++ b/iconv/skeleton.c -@@ -168,6 +168,10 @@ +@@ -167,6 +167,10 @@ # endif #endif @@ -25,10 +29,10 @@ index 1dc642e2fc..4c46b079db 100644 #ifndef MAX_NEEDED_FROM # define MAX_NEEDED_FROM MIN_NEEDED_FROM diff --git a/iconvdata/Makefile b/iconvdata/Makefile -index c83962f351..0015fde589 100644 +index ea019ce5c0..88602a05e5 100644 --- a/iconvdata/Makefile +++ b/iconvdata/Makefile -@@ -61,7 +61,7 @@ modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \ +@@ -62,7 +62,7 @@ modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \ IBM5347 IBM9030 IBM9066 IBM9448 IBM12712 IBM16804 \ IBM1364 IBM1371 IBM1388 IBM1390 IBM1399 ISO_11548-1 MIK BRF \ MAC-CENTRALEUROPE KOI8-RU ISO8859-9E \ diff --git a/recipes-core/glibc/glibc/cp936_charmap_support.patch b/recipes-core/glibc/glibc/0002-glibc-add-CP936-charmap-and-zh_CN.CP936-locale.patch similarity index 99% rename from recipes-core/glibc/glibc/cp936_charmap_support.patch rename to recipes-core/glibc/glibc/0002-glibc-add-CP936-charmap-and-zh_CN.CP936-locale.patch index f61f1f0e1..747619139 100644 --- a/recipes-core/glibc/glibc/cp936_charmap_support.patch +++ b/recipes-core/glibc/glibc/0002-glibc-add-CP936-charmap-and-zh_CN.CP936-locale.patch @@ -1,8 +1,9 @@ -From 50acca0fba51a116e108b6549f4a88ce38d8ac80 Mon Sep 17 00:00:00 2001 +From 317d15193531d2beafaffcb7d8dff1f43951578f Mon Sep 17 00:00:00 2001 From: Charlie Johnston Date: Wed, 25 May 2022 10:37:37 -0500 -Subject: [PATCH] Adding CP936 charmap and zh_CN.CP936 locale. These are - equivalent to the GBK charmap and zh_CN.GBK locale. +Subject: [PATCH] glibc: add CP936 charmap and zh_CN.CP936 locale + +These are equivalent to the GBK charmap and zh_CN.GBK locale. Some NI Software expects that the charmap for Chinese language specifically be CP936. While this is equivalent to the GBK charmap, the naming appears @@ -10,6 +11,10 @@ to matter. This patch adds in a CP936 charmap and equivalent locale with the expected values. Upstream-Status: Inappropriate [NI-specific changes] + +Reapplied to glibc-2.39-22-g0244a37d2c. + +Signed-off-by: Alex Stewart --- localedata/SUPPORTED | 1 + localedata/charmaps/CP936 | 22037 ++++++++++++++++++++++++++++++++++++ @@ -17,13 +22,13 @@ Upstream-Status: Inappropriate [NI-specific changes] create mode 100644 localedata/charmaps/CP936 diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED -index 1ee5b5e8c8..0bf665834d 100644 +index f3ea3267f3..c7efe08ae4 100644 --- a/localedata/SUPPORTED +++ b/localedata/SUPPORTED -@@ -475,6 +475,7 @@ yi_US/CP1255 \ - yo_NG/UTF-8 \ +@@ -485,6 +485,7 @@ yo_NG/UTF-8 \ yue_HK/UTF-8 \ yuw_PG/UTF-8 \ + zgh_MA/UTF-8 \ +zh_CN.CP936/CP936 \ zh_CN.GB18030/GB18030 \ zh_CN.GBK/GBK \ @@ -22071,6 +22076,3 @@ index 0000000000..a469702bee +WIDTH +... 2 +END WIDTH --- -2.30.2 - diff --git a/recipes-core/glibc/glibc_2.%.bbappend b/recipes-core/glibc/glibc_2.%.bbappend index 165a49729..34ef4ca15 100644 --- a/recipes-core/glibc/glibc_2.%.bbappend +++ b/recipes-core/glibc/glibc_2.%.bbappend @@ -4,15 +4,15 @@ FILESEXTRAPATHS:prepend := "${THISDIR}:${THISDIR}/${PN}:" # Chinese support. #file://cp936-gconv-modules.patch SRC_URI =+ " \ - file://cp936_support.patch \ file://gconv-modules-extra-remove-CP936-to-GBK-mapping.patch \ + file://0001-glibc-add-cp936-support.patch \ " # Add patches to build the ja_JP.WINDOWS-31J and zh_CN.CP936 locales for # LabVIEW Japanese and Chinese language support. SRC_URI =+ " \ file://windows-31j_support.patch \ - file://cp936_charmap_support.patch \ + file://0002-glibc-add-CP936-charmap-and-zh_CN.CP936-locale.patch \ " # Add patch to alias custom LabVIEW locales to the equivalent diff --git a/recipes-core/images/nilrt-base-system-image.bb b/recipes-core/images/nilrt-base-system-image.bb index dc47ccfe2..6005c049b 100644 --- a/recipes-core/images/nilrt-base-system-image.bb +++ b/recipes-core/images/nilrt-base-system-image.bb @@ -18,7 +18,7 @@ ROOTFS_IMAGE = "nilrt-runmode-rootfs" do_rootfs[depends] += "${ROOTFS_IMAGE}:do_image_complete" bootimg_fixup() { - install -m 0644 "${DEPLOY_DIR_IMAGE}/${ROOTFS_IMAGE}-${MACHINE}.tar.gz" "${IMAGE_ROOTFS}/data.tar.gz" + install -m 0644 "${DEPLOY_DIR_IMAGE}/${ROOTFS_IMAGE}-${MACHINE}.rootfs.tar.gz" "${IMAGE_ROOTFS}/data.tar.gz" install -m 0755 "${THISDIR}/files/${BPN}.postinst" "${IMAGE_ROOTFS}/postinst" # Remove everything that is not data.tar.gz nor the postinst diff --git a/recipes-core/images/nilrt-recovery-media.bb b/recipes-core/images/nilrt-recovery-media.bb index 6a6ccc520..8a5ceb2cc 100644 --- a/recipes-core/images/nilrt-recovery-media.bb +++ b/recipes-core/images/nilrt-recovery-media.bb @@ -8,6 +8,8 @@ PACKAGE_INSTALL = "${ROOTFS_BOOTSTRAP_INSTALL} \ IMAGE_FEATURES += "empty-root-password" +IMAGE_INSTALL_NODEPS += "nirtcfg" + DEPENDS += "init-restore-mode" INITRAMFS_MAXSIZE = "524288" @@ -38,7 +40,7 @@ bootimg_fixup() { } symlink_iso () { - ln -sf ${PN}-${MACHINE}.wic ${DEPLOY_DIR_IMAGE}/${PN}-${MACHINE}.iso + ln -sf ${PN}-${MACHINE}.rootfs.wic ${DEPLOY_DIR_IMAGE}/${PN}-${MACHINE}.iso } ROOTFS_POSTPROCESS_COMMAND += "symlink_iso;" diff --git a/recipes-core/initrdscripts/files/efifix b/recipes-core/initrdscripts/files/efifix deleted file mode 100755 index 156c75a63..000000000 --- a/recipes-core/initrdscripts/files/efifix +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -if [ -e /ni_provisioning.common ]; then - source /ni_provisioning.common -else - printf "\n***Error: File ni_provisioning.common not found!\n" - printf "PROVISIONING FAILED!" - exit 1 -fi - -die() -{ - echo -e "${RED}\n***Error: $1\nEFI Recovery FAILED!${NC}" - cleanup_and_exit 1 -} - -show_help() -{ - >&3 echo -e "\nUsage: $0 [-hv] [-t DEVICE]\n" - >&3 echo -e "Options\n" - >&3 echo " -h : Show help." - >&3 echo " -v : Verbose mode." - >&3 echo " -t DEVICE : DEVICE is the device name for the disk to update. (e.g /dev/sda)" - >&3 echo " If DEVICE is not specificed, the first non-removable block device" - >&3 echo " that is not the recovery tool is used." -} - -check_partition() -{ - local label=`lsblk ${TARGET_DISK}$1 -n -o LABEL 2>/dev/null` - if [[ "$label" != "$2" ]]; then - (( verbose_mode )) && die "Expected ${TARGET_DISK}$1 to have disk label $2." - fi - - mkdir -p /mnt/partition - NILRT_ERROR=`mount -t vfat ${TARGET_DISK}$1 /mnt/partition 2>&1` || die "$NILRT_ERROR" - if ! [[ -f /mnt/partition/efi/nilrt/bootx64.efi ]]; then - NILRT_ERROR="File not found: /efi/nilrt/bootx64.efi on ${TARGET_DISK}$1" - fi - umount /mnt/partition - rmdir /mnt/partition - [ -z $NILRT_ERROR ] || die "$NILRT_ERROR" -} - -early_setup "$@" - -# Verify disk labels on selected device -check_partition 1 niboota -check_partition 2 nibootb - -# Delete any existing entries matching a known spec -for ENTRY in $(efibootmgr | egrep -i '(LabVIEW RT)|(niboota)|(nibootb)' | egrep -o '[0-9A-Fa-f]{4}' || true); -do - do_silent echo "Drop entry $ENTRY" - EFIMGR=$(efibootmgr -b "$ENTRY" -B 2>&1) || print_warning "efibootmgr -b $ENTRY -B failed with: $EFIMGR" -done - -# Add nibootX entries reversed order so niboota is booted first -do_silent efibootmgr -c -d "$TARGET_DISK" -p 2 -L 'nibootb' -l '\efi\nilrt\bootx64.efi' -do_silent efibootmgr -c -d "$TARGET_DISK" -p 1 -L 'niboota' -l '\efi\nilrt\bootx64.efi' - -echo "EFI boot configuration:" -efibootmgr -v -echo "---" - -echo -e ${GREEN}"EFI Recovery SUCCESSFUL!"${NC} 1>&3 2>&4 - diff --git a/recipes-core/initrdscripts/files/ni_provisioning b/recipes-core/initrdscripts/files/ni_provisioning index 33f78835b..79a2835b8 100755 --- a/recipes-core/initrdscripts/files/ni_provisioning +++ b/recipes-core/initrdscripts/files/ni_provisioning @@ -3,7 +3,7 @@ INVALID_NILRT_ID_MSG="Invalid value for PROVISION_PART_NILRT_ID. Use UUID= or PARTUUID= or auto." # verify required tools are installed -for toolName in poweroff reboot mount umount sync ls rm ln mkdir cp echo printf dirname basename find grep egrep tar bzip2 bunzip2 lsblk cut udevadm date sleep head; do +for toolName in poweroff reboot mount umount sync ls rm ln mkdir cp echo printf dirname basename find grep tar bzip2 bunzip2 lsblk cut udevadm date sleep head; do if ! type "$toolName" >/dev/null; then printf "\n***Error: Missing $toolName\n" printf "PROVISIONING FAILED!" @@ -102,10 +102,33 @@ elif [[ $restore == "provision" ]]; then restore_runmode_image "$nilrt_path" "$uuid" "$PROVISION_PART_NILRT_LABEL" fi fi - elif [[ $restore == "migrate" ]]; then PROVISION_REBOOT_METHOD="reboot" provision_target onboard +elif [[ $restore == "get-image" ]]; then + echo "Get Image" + + # source user's answer file, if present + source_answer_file + echo + + source /sbin/nisystemreplication get + if [[ "${FORCE_PROVISIONING}" -eq 1 ]]; then + PROVISION_REBOOT_METHOD=${RESTART_OPTION} + fi + ASK_BEFORE_REBOOT=1 +elif [[ $restore == "set-image" ]]; then + echo "Set Image" + + # source user's answer file, if present + source_answer_file + echo + + source /sbin/nisystemreplication set + if [[ "${FORCE_PROVISIONING}" -eq 1 ]]; then + PROVISION_REBOOT_METHOD=${RESTART_OPTION} + fi + ASK_BEFORE_REBOOT=1 else die "Invalid restore mode." fi diff --git a/recipes-core/initrdscripts/files/ni_provisioning.answers.default b/recipes-core/initrdscripts/files/ni_provisioning.answers.default index cf8af1be4..7aeeccd1d 100755 --- a/recipes-core/initrdscripts/files/ni_provisioning.answers.default +++ b/recipes-core/initrdscripts/files/ni_provisioning.answers.default @@ -45,3 +45,7 @@ PROVISION_PART_NILRT_LABEL="nilrt" # A hostname to configure after provisioning. # An empty string means hostname is generated on first boot. PROVISION_HOSTNAME="" + +# System Image name used for "Get Image" and "Set Image" +# No spaces, no special characters except '-' +PROVISION_SYSTEMIMAGE_NAME="" diff --git a/recipes-core/initrdscripts/files/ni_provisioning.common b/recipes-core/initrdscripts/files/ni_provisioning.common index 302031a49..578655060 100755 --- a/recipes-core/initrdscripts/files/ni_provisioning.common +++ b/recipes-core/initrdscripts/files/ni_provisioning.common @@ -53,7 +53,7 @@ ask_for_continue() variable=${2:-"PROVISION_REPARTITION_TARGET"} BUILD_IDENTIFIER=$(get_image_info BUILD_IDENTIFIER) - IMAGE_DISPLAY_NAME=$(get_image_info IMAGE_DISPLAY_NAME) + IMAGE_DISPLAY_NAME=${3:-$(get_image_info IMAGE_DISPLAY_NAME)} printf "\nNI Linux Real-Time $type $BUILD_IDENTIFIER. \n\n" printf "Continuing will partition the disk, format, and install $IMAGE_DISPLAY_NAME to the target.\n\n" @@ -346,10 +346,11 @@ elif [ "$ARCH" = "x86_64" ]; then echo "Configuring EFI for A/B image boot..." # Delete existing NILRT entries with "-B" option - for ENTRY in $(efibootmgr | egrep -i '(LabVIEW RT)|(niboota)|(nibootb)' | egrep -o '[0-9A-Fa-f]{4}' || true); + for ENTRY in $(efibootmgr | grep -Ei '(LabVIEW RT)|(niboota)|(nibootb)' | grep -Eo 'Boot[0-9A-Fa-f]{4}' || true); do - do_silent echo "Drop entry $ENTRY" - EFIMGR=$(efibootmgr -b "$ENTRY" -B 2>&1) || print_warning "efibootmgr -b $ENTRY -B failed with: $EFIMGR" + ENTRY_NUMBER=${ENTRY: 4:4} + do_silent echo "Drop entry $ENTRY_NUMBER" + EFIMGR=$(efibootmgr -b "$ENTRY_NUMBER" -B 2>&1) || print_warning "efibootmgr -b $ENTRY_NUMBER -B failed with: $EFIMGR" done # Add nibootX entries with "-c" option @@ -383,19 +384,19 @@ elif [ "$ARCH" = "x86_64" ]; then # first two boot entries and niboota is BootNext echo -n "Check EFI boot configuration: " - boot_order=$(echo "$efi_boot_config" | egrep "^BootOrder: [0-9,]+" | cut -d" " -f2) + boot_order=$(echo "$efi_boot_config" | grep -E "^BootOrder: [0-9,]+" | cut -d" " -f2) boot_A_numb=$(echo "$boot_order" | cut -d"," -f1) boot_B_numb=$(echo "$boot_order" | cut -d"," -f2) - if ! echo "$efi_boot_config" | egrep -q "^Boot${boot_A_numb}.* niboota"$'\t'"+HD\(1,"; then + if ! echo "$efi_boot_config" | grep -Eq "^Boot${boot_A_numb}.* niboota"$'\t'"+HD\(1,"; then die "niboota is not at Boot${boot_A_numb}, boot_order=$boot_order" fi - if ! echo "$efi_boot_config" | egrep -q "^Boot${boot_B_numb}.* nibootb"$'\t'"+HD\(2,"; then + if ! echo "$efi_boot_config" | grep -Eq "^Boot${boot_B_numb}.* nibootb"$'\t'"+HD\(2,"; then die "nibootb is not at Boot${boot_B_numb}, boot_order=$boot_order" fi - boot_next=$(echo "$efi_boot_config" | egrep "^BootNext: [0-9]+ *$" | cut -d" " -f2) + boot_next=$(echo "$efi_boot_config" | grep -E "^BootNext: [0-9]+ *$" | cut -d" " -f2) [ "$boot_next" == "$boot_A_numb" ] || die "BootNext=$boot_next, expecting niboota at $boot_A_numb" echo "OK" @@ -599,7 +600,7 @@ check_answer_file() if [ -r "$filePath" ]; then # Answer file may only contain lines beginning with '#' or 'PROVISION_*=' variables if [ "`head -1 "$filePath"`" == "#NI_PROVISIONING_ANSWERS_V1" ]; then - if ! egrep -q -v '(^$|^#|^PROVISION_[A-Z0-9_]+=)' "$filePath"; then + if ! grep -E -q -v '(^$|^#|^PROVISION_[A-Z0-9_]+=)' "$filePath"; then return 0 fi fi diff --git a/recipes-core/initrdscripts/files/ni_provisioning.safemode b/recipes-core/initrdscripts/files/ni_provisioning.safemode index aba18fdfc..c7778bac7 100755 --- a/recipes-core/initrdscripts/files/ni_provisioning.safemode +++ b/recipes-core/initrdscripts/files/ni_provisioning.safemode @@ -1,415 +1,13 @@ #!/bin/bash set -e -ask_at_every_error="N" -grubenv_consoleoutenable=${grubenv_consoleoutenable:-""} -grubenv_bootdelay=${grubenv_bootdelay:-""} - -PART1_LABEL=nigrub -PART2_LABEL=nibootfs -PART3_LABEL=niconfig -PART4_LABEL=nirootfs - -# GPT partitions must assign a partition name -PART_STYLE=gpt -PART1_NAME=$PART1_LABEL -PART2_NAME=$PART2_LABEL -PART3_NAME=$PART3_LABEL -PART4_NAME=$PART4_LABEL - -. /usr/share/nisysinfo/smbios_helper - -print_info() -{ - if [ $verbose_mode -eq 1 ]; then - >&3 echo $1 - else - >&3 echo -n $1 - fi -} - -print_error() -{ - >&4 echo -e ${RED}"\n***Error: $1\n"${NC} - local continue_on_error="N" - if [[ "$ask_at_every_error" == "y" ]]; then - exec 2>&4 - read -p "Do you want to ignore this error?[y/N]" continue_on_error - exec 4>&2 - fi - if [[ "$continue_on_error" == "N" || "$continue_on_error" == "n" || "$continue_on_error" == "" ]]; then - >&4 echo -e ${RED}"PROVISIONING FAILED!"${NC} - cleanup_and_exit 1 - fi -} - -die() -{ - >&4 echo -e ${RED}"\n***Fatal Error: $1"${NC} - >&4 echo -e ${RED}"PROVISIONING FAILED!"${NC} - cleanup_and_exit 1 -} - -print_done() -{ - if [ $verbose_mode -eq 0 ]; then - >&3 echo "Done" - fi -} - -disable_automount() -{ - echo -e $TARGET_DISK >> /etc/udev/mount.blacklist - AUTOMOUNT_DISABLED=1 -} - -enable_automount() -{ - sed -ie "\#$TARGET_DISK#d" /etc/udev/mount.blacklist - AUTOMOUNT_DISABLED=0 -} -#waits until the four partitions are visible -wait_for_partitions() -{ - DEVICE_TMP=$1 - for i in 1 2 3 4 - do - #wait max 3 seconds for each partition - print_verbose "Waiting for $DEVICE_TMP$i " - MaxTries=30 - while [ ! -b ${DEVICE_TMP}${PART_SEPARATOR}$i -a $MaxTries -gt 0 ]; - do - print_verbose "." - #sleep 0.1 seconds - usleep 100000 - MaxTries=$(($MaxTries - 1)) - done - if [ $MaxTries -eq 0 ]; then - return 1 - fi - done -} - -handle_err() -{ - TMP_EVAL=`eval echo $5` - print_error "$1:$2 (fn=$3): Unexpected status code $4, while running command: '$TMP_EVAL'" ${NC} -} - -check_all_used_binaries() -{ - commands=(awk dmidecode e2label hexdump lsblk mkfs.ext4 mkfs.vfat parted sed sfdisk sgdisk udevadm modprobe dd) - for ind_command in ${commands[@]}; do - one_command=`command -v ${ind_command}` - if [[ -z $one_command ]]; then - die "Command \"${ind_command}\" not found. Please install ${ind_command}." - fi - done - -} - -override_primaryport_grubenv() -{ - # Add target-specific override of primary ethernet port if the lowest ifIndex is not to be used - local device_code=$(get_target_id) - # CVS-1458RT - if [[ x"$device_code" == x"77AA" ]]; then - # Set eth0 (note: renamed to eth0 via udev) as the primary port. Do not let the primary - # port selection logic decide since it selects the 'eth' port with the lowest ifIndex - # value. (Renaming the port via udev does not alter ifIndex, so eth0 is not the lowest) - grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "ethaddr=`cat /sys/class/net/eth0/address`" - fi -} - -add_USB_gadget_args_to_grubenv() -{ - local MAC=$(get_usbdev_mac) - local VID=$(get_usbdev_vid) - local PID=$(get_usbdev_pid) - local SN=$(get_serial_number) - local TID=$(get_target_id) - local PROD=$(get_target_name) - - if is_usbdev_target; then - - if [ -n "$MAC" -a -n "$VID" -a -n "$PID" -a -n "$SN" -a -n "$TID" -a -n "$PROD" ]; then - cat << EOF > $GRUB_MOUNTPOINT/grubvar_readonly -set usbgadgetethaddr=$MAC -set USBVendorID=$VID -set USBProductID=$PID -set SerialNum=$SN -set USBDevice=$TID -set USBProduct=$PROD -EOF - else - print_error "Details required for USB device mode are missing from SMBIOS! UPGRADE your BIOS if using NI Target. USB Gadget will not be functional." - return - fi - fi -} - -set_serial_port() -{ - if [ -d /sys/class/tty/ttyS0 ] && [ -f /sys/class/tty/ttyS0/type ] && [ `cat /sys/class/tty/ttyS0/type` -ne 0 ]; then - echo "set serial_port="`cat /sys/class/tty/ttyS0/port` >> $GRUB_MOUNTPOINT/grubvar_readonly - - local base_clock - if base_clock=$(get_serial_base_clock); then - echo "set GRUB_SERIAL_BASE_CLOCK=$base_clock" >> $GRUB_MOUNTPOINT/grubvar_readonly - fi - fi - -} - -partitioning_disk() -{ - umount "$TARGET_DISK"? 2>/dev/null || true - print_info "Partitioning TARGET_DISK=$TARGET_DISK (PART_STYLE=$PART_STYLE)..." - PARTED_ERROR=`parted -s $TARGET_DISK mklabel $PART_STYLE 2>&1` || die "$PARTED_ERROR" - PARTED_ERROR=`parted -s --align optimal $TARGET_DISK mkpart $PART1_NAME 1MB 16MB 2>&1` || die "$PARTED_ERROR" - PARTED_ERROR=`parted -s --align optimal $TARGET_DISK mkpart $PART2_NAME 16MB 200MB 2>&1` || die "$PARTED_ERROR" - PARTED_ERROR=`parted -s --align optimal $TARGET_DISK mkpart $PART3_NAME 200MB 216MB 2>&1` || die "$PARTED_ERROR" - PARTED_ERROR=`parted -s --align optimal $TARGET_DISK mkpart $PART4_NAME 216MB 100% 2>&1` || die "$PARTED_ERROR" - print_done - - print_info "Assigning EFI System Partition..." - # Per https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/ - # C12A7328-F81F-11D2-BA4B-00A0C93EC93B -- EFI System Partition - sgdisk --typecode="1:C12A7328-F81F-11D2-BA4B-00A0C93EC93B" $TARGET_DISK - print_done - - print_info "Probing partitions of TARGET_DISK=$TARGET_DISK ..." - partprobe -s "$TARGET_DISK" - print_done -} - -create_filesystems() -{ - print_info "Creating filesystems ..." - - MKFS_ERROR=`mkfs.vfat -n $PART1_LABEL ${TARGET_DISK}${PART_SEPARATOR}1 2>&1` || die "$MKFS_ERROR" - do_silent mkfs.ext4 $MKFS_ARGS ${TARGET_DISK}${PART_SEPARATOR}2 || die "Format failed!" - do_silent mkfs.ext4 $MKFS_ARGS ${TARGET_DISK}${PART_SEPARATOR}3 || die "Format failed!" - do_silent mkfs.ext4 $MKFS_ARGS ${TARGET_DISK}${PART_SEPARATOR}4 || die "Format failed!" - - LABEL_ERROR=`e2label ${TARGET_DISK}${PART_SEPARATOR}2 $PART2_LABEL 2>&1` || die "$LABEL_ERROR" - LABEL_ERROR=`e2label ${TARGET_DISK}${PART_SEPARATOR}3 $PART3_LABEL 2>&1` || die "$LABEL_ERROR" - LABEL_ERROR=`e2label ${TARGET_DISK}${PART_SEPARATOR}4 $PART4_LABEL 2>&1` || die "$LABEL_ERROR" - - print_done -} - -install_grub() -{ - GRUB_MOUNTPOINT=/var/volatile/grub - mkdir $GRUB_MOUNTPOINT -p - MOUNT_ERROR=`mount -L $PART1_LABEL $GRUB_MOUNTPOINT 2>&1` || die "$MOUNT_ERROR" - - print_info "Configuring EFI grub2..." - GRUB_TARGET_DIR=$GRUB_MOUNTPOINT/efi/boot - mkdir -p $GRUB_TARGET_DIR - GRUB_TARGET=$(uname -m) - cp /boot/EFI/BOOT/bootx64.efi $GRUB_TARGET_DIR - # Delete existing NILRT entries with "-B" option - for ENTRY in $(efibootmgr | egrep -i '(LabVIEW RT)|(niboota)|(nibootb)' | egrep -o '[0-9A-Fa-f]{4}' || true); - do - print_info " Drop entry $ENTRY." - EFIMGR=$(efibootmgr -b "$ENTRY" -B 2>&1) || print_warning "efibootmgr -b $ENTRY -B failed with: $EFIMGR" - done - efibootmgr $VERBOSE_ARGS -c -d ${TARGET_DISK} -p 1 -L 'LabVIEW RT' -l '\efi\boot\bootx64.efi' - print_done - - print_info "Installing grub.cfg..." - - cp $SOURCE_DIR/grub.cfg $GRUB_TARGET_DIR/grub.cfg - mkdir -p $GRUB_TARGET_DIR/fonts - cp $SOURCE_DIR/fonts/unicode.pf2 $GRUB_TARGET_DIR/fonts/ - print_done -} - -install_safemode() -{ - print_info "Installing safemode kernel and ramdisk..." - - BOOTFS_MOUNTPOINT=/var/volatile/bootfs - mkdir $BOOTFS_MOUNTPOINT -p - BOOTFS_ERROR=`mount -L $PART2_LABEL $BOOTFS_MOUNTPOINT 2>&1` || die "$BOOTFS_ERROR" - mkdir -p $BOOTFS_MOUNTPOINT/.safe - - cp "$SOURCE_DIR"/*Image "$BOOTFS_MOUNTPOINT/.safe/" - cp "$SOURCE_DIR"/ramdisk.* "$BOOTFS_MOUNTPOINT/.safe/" - cp "$SOURCE_DIR"/bootimage.* "$BOOTFS_MOUNTPOINT/.safe/" - - print_done -} - -install_bootmode_file() -{ - # write initial bootmode file - print_info "Installing bootmode file..." - echo "set BOOT_MODE=safemode" >$BOOTFS_MOUNTPOINT/bootmode - print_done -} - -install_grubenv() -{ - NI_TARGET="false" - - mkdir $BOOTFS_MOUNTPOINT/grub - touch $BOOTFS_MOUNTPOINT/grub/grubenv - touch $BOOTFS_MOUNTPOINT/.safe/SMBIOS_NI_vars - touch $BOOTFS_MOUNTPOINT/.safe/EFI_NI_vars - touch $BOOTFS_MOUNTPOINT/.safe/GRUB_NI_readonly_vars - if is_ni_device ; then - NI_TARGET="true" - cp $SOURCE_DIR/grubenv $BOOTFS_MOUNTPOINT/grub - cp $SOURCE_DIR/SMBIOS_NI_vars $BOOTFS_MOUNTPOINT/.safe - cp $SOURCE_DIR/EFI_NI_vars $BOOTFS_MOUNTPOINT/.safe - add_USB_gadget_args_to_grubenv - override_primaryport_grubenv - else - cp $SOURCE_DIR/grubenv_non_ni_target $BOOTFS_MOUNTPOINT/grub/grubenv - fi - - set_serial_port - - grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "BIOSBootMode=efi" - grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "NITarget=$NI_TARGET" - - # Mark aforementioned grub vars read-only - for varname in "BIOSBootMode" "NITarget" ; do - echo "$varname" >> "$BOOTFS_MOUNTPOINT/.safe/GRUB_NI_readonly_vars" - done - - # save rootfs UUID for grub to reference - ROOTUUID=`lsblk ${TARGET_DISK}${PART_SEPARATOR}4 -n -o PARTUUID` - echo set rootuuid=$ROOTUUID >> $GRUB_MOUNTPOINT/grubvar_readonly - - # set proper permissions on and backup firmware variable files - chown 0:500 $BOOTFS_MOUNTPOINT/grub/grubenv - chmod ug=rw,o=r $BOOTFS_MOUNTPOINT/grub/grubenv - cp -p $BOOTFS_MOUNTPOINT/grub/grubenv $BOOTFS_MOUNTPOINT/grub/grubenv.bak - chmod a=r $BOOTFS_MOUNTPOINT/.safe/SMBIOS_NI_vars - chmod a=r $BOOTFS_MOUNTPOINT/.safe/EFI_NI_vars - chmod a=r $BOOTFS_MOUNTPOINT/.safe/GRUB_NI_readonly_vars - - # Additional grubenv configuration, _NOT_ mirrored in grubenv.bak - - # If the target is a qemu vm, enable consoleout - if dmidecode |grep -qi "virtual machine" ; then - grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "consoleoutenable=True" - fi - - # If an initial value for console out was specified, write it to grubenv - if [ -n "$grubenv_consoleoutenable" ]; then - grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "consoleoutenable=$grubenv_consoleoutenable" - fi - - # Set quietbootdelay to show the boot menu on PXI controllers - # - # The reasoning behind this is that, for NI Linux RT support, Controller - # Software (the BIOS team) wants to keep the business logic out of - # BIOS as much as possible, and make the BIOS agnostic of the actual - # OS it is booting as much as possible (one exception being setting - # HT based on the EFI variable since this can only, practically, be - # handled in BIOS). - - if [ "`get_target_class`" == "PXI" ]; then - grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "quietbootdelay=3" - fi - - # If an initial value for bootdelay was specified, write it to grubenv - if [ -n "$grubenv_bootdelay" ]; then - grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "bootdelay=$grubenv_bootdelay" - fi -} - -set_versions() -{ - BUILD_IDENTIFIER=$(get_image_info BUILD_IDENTIFIER) - - echo "set ni_recoverytool_version=${BUILD_IDENTIFIER}" > $BOOTFS_MOUNTPOINT/grub/recoverytool-ni-version - - chmod 444 $BOOTFS_MOUNTPOINT/grub/recoverytool-ni-version -} - -fixup_configfs() -{ - CONFIG_MOUNTPOINT=/var/volatile/configfs - - mkdir -p $CONFIG_MOUNTPOINT - mount -L $PART3_LABEL $CONFIG_MOUNTPOINT - - # Set root dir ownership to lvuser:ni - chown 500:500 $CONFIG_MOUNTPOINT - chmod ug=rwx,o=rx $CONFIG_MOUNTPOINT - - # Set hostname, if configured - if [ -n "$PROVISION_HOSTNAME" ]; then - print_info "Setting hostname=\"$PROVISION_HOSTNAME\" in ni-rt.ini..." - - echo >$CONFIG_MOUNTPOINT/ni-rt.ini "[systemsettings]" - echo >>$CONFIG_MOUNTPOINT/ni-rt.ini "Host_Name=\"$PROVISION_HOSTNAME\"" - - # Set ownership to lvuser:ni - chown 500:500 $CONFIG_MOUNTPOINT/ni-rt.ini - chmod ug=rw,o=r $CONFIG_MOUNTPOINT/ni-rt.ini - - print_done - fi - - umount $CONFIG_MOUNTPOINT -} - -sanity_check() -{ - print_info "Sanity check TARGET_DISK=$TARGET_DISK..." - - # correct partition table type - parted -s --list "$TARGET_DISK" | grep -q "^Partition Table: $PART_STYLE" || die "Wrong partition style reported" - - attrib_list="NAME KNAME PARTUUID UUID LABEL" - if [[ "$PART_STYLE" == "gpt" ]]; then - attrib_list="$attrib_list PARTLABEL" - fi - - # unique attributes - for attrib_name in $attrib_list; do - sanity_list="`lsblk -nro "$attrib_name" "$TARGET_DISK"`" - sanity_list_len="`echo "$sanity_list" | wc -l`" - sanity_list_uniq_len="`echo "$sanity_list" | uniq | wc -l`" - [ "$sanity_list_len" -eq 5 ] || die "There should be 4 $attrib_name's (+1 blank line) on TARGET_DISK=$TARGET_DISK; found $sanity_list_len" - [ "$sanity_list_len" -eq "$sanity_list_uniq_len" ] || die "$attrib_name's not unique on TARGET_DISK=$TARGET_DISK; $sanity_list_len != $sanity_list_uniq_len" - done - - # can search by file system label - for fs_label in "$PART1_LABEL" "$PART2_LABEL" "$PART3_LABEL" "$PART4_LABEL"; do - fs_node_name="`lsblk -nro LABEL,NAME "$TARGET_DISK" | grep "^$fs_label " | cut -d" " -f2`" - [ "`echo "$fs_node_name" | wc -l`" -eq 1 ] || die "Invalid number of devnodes found" - [ -e "/dev/$fs_node_name" ] || die "No devnode for LABEL $fs_label" - done - - # can search by partition label, on gpt only - if [ "$PART_STYLE" == "gpt" ]; then - for part_label in "$PART1_NAME" "$PART2_NAME" "$PART3_NAME" "$PART4_NAME"; do - part_node_name="`lsblk -nro PARTLABEL,NAME "$TARGET_DISK" | grep "^$part_label " | cut -d" " -f2`" - [ "`echo "$part_node_name" | wc -l`" -eq 1 ] || die "Invalid number of devnodes found" - [ -e "/dev/$part_node_name" ] || die "No devnode for PARTLABEL $part_label" - done - fi - - # just in case meta-data is updated - sync - print_done -} +source /ni_provisioning.safemode.common check_all_used_binaries echo "Installing safemode to: $TARGET_DISK." echo 6 > /proc/sys/kernel/printk -SOURCE_DIR=/payload - print_info "Disabling automount..." disable_automount print_done @@ -420,6 +18,7 @@ create_filesystems prune_efi_crash_vars install_grub + install_safemode install_bootmode_file install_grubenv diff --git a/recipes-core/initrdscripts/files/ni_provisioning.safemode.common b/recipes-core/initrdscripts/files/ni_provisioning.safemode.common new file mode 100755 index 000000000..bfb873f1f --- /dev/null +++ b/recipes-core/initrdscripts/files/ni_provisioning.safemode.common @@ -0,0 +1,449 @@ +#!/bin/bash +set -e + +ask_at_every_error="N" +grubenv_consoleoutenable=${grubenv_consoleoutenable:-""} +grubenv_bootdelay=${grubenv_bootdelay:-""} + +PART1_LABEL=nigrub +PART2_LABEL=nibootfs +PART3_LABEL=niconfig +PART4_LABEL=nirootfs + +# GPT partitions must assign a partition name +PART_STYLE=gpt +PART1_NAME=$PART1_LABEL +PART2_NAME=$PART2_LABEL +PART3_NAME=$PART3_LABEL +PART4_NAME=$PART4_LABEL + +. /usr/share/nisysinfo/smbios_helper + +print_info() +{ + if [ $verbose_mode -eq 1 ]; then + >&3 echo $1 + else + >&3 echo -n $1 + fi +} + +print_error() +{ + >&4 echo -e ${RED}"\n***Error: $1\n"${NC} + local continue_on_error="N" + if [[ "$ask_at_every_error" == "y" ]]; then + exec 2>&4 + read -p "Do you want to ignore this error?[y/N]" continue_on_error + exec 4>&2 + fi + if [[ "$continue_on_error" == "N" || "$continue_on_error" == "n" || "$continue_on_error" == "" ]]; then + >&4 echo -e ${RED}"PROVISIONING FAILED!"${NC} + cleanup_and_exit 1 + fi +} + +die() +{ + >&4 echo -e ${RED}"\n***Fatal Error: $1"${NC} + >&4 echo -e ${RED}"PROVISIONING FAILED!"${NC} + cleanup_and_exit 1 +} + +print_done() +{ + if [ $verbose_mode -eq 0 ]; then + >&3 echo "Done" + fi +} + +disable_automount() +{ + echo -e $TARGET_DISK >> /etc/udev/mount.blacklist + AUTOMOUNT_DISABLED=1 +} + +enable_automount() +{ + sed -ie "\#$TARGET_DISK#d" /etc/udev/mount.blacklist + AUTOMOUNT_DISABLED=0 +} +#waits until the four partitions are visible +wait_for_partitions() +{ + DEVICE_TMP=$1 + for i in 1 2 3 4 + do + #wait max 3 seconds for each partition + print_verbose "Waiting for $DEVICE_TMP$i " + MaxTries=30 + while [ ! -b ${DEVICE_TMP}${PART_SEPARATOR}$i -a $MaxTries -gt 0 ]; + do + print_verbose "." + #sleep 0.1 seconds + usleep 100000 + MaxTries=$(($MaxTries - 1)) + done + if [ $MaxTries -eq 0 ]; then + return 1 + fi + done +} + +handle_err() +{ + TMP_EVAL=`eval echo $5` + print_error "$1:$2 (fn=$3): Unexpected status code $4, while running command: '$TMP_EVAL'" ${NC} +} + +check_all_used_binaries() +{ + commands=(awk dmidecode e2label hexdump lsblk mkfs.ext4 mkfs.vfat parted sed sfdisk sgdisk udevadm modprobe dd) + for ind_command in ${commands[@]}; do + one_command=`command -v ${ind_command}` + if [[ -z $one_command ]]; then + die "Command \"${ind_command}\" not found. Please install ${ind_command}." + fi + done + +} + +override_primaryport_grubenv() +{ + local grubenv_file=$1 + # Add target-specific override of primary ethernet port if the lowest ifIndex is not to be used + local device_code=$(get_target_id) + # CVS-1458RT + if [[ x"$device_code" == x"77AA" ]]; then + # Set eth0 (note: renamed to eth0 via udev) as the primary port. Do not let the primary + # port selection logic decide since it selects the 'eth' port with the lowest ifIndex + # value. (Renaming the port via udev does not alter ifIndex, so eth0 is not the lowest) + grub-editenv $grubenv_file set "ethaddr=`cat /sys/class/net/eth0/address`" + fi +} + +add_USB_gadget_args_to_grubenv() +{ + local MAC=$(get_usbdev_mac) + local VID=$(get_usbdev_vid) + local PID=$(get_usbdev_pid) + local SN=$(get_serial_number) + local TID=$(get_target_id) + local PROD=$(get_target_name) + + if is_usbdev_target; then + + if [ -n "$MAC" -a -n "$VID" -a -n "$PID" -a -n "$SN" -a -n "$TID" -a -n "$PROD" ]; then + cat << EOF > $GRUB_MOUNTPOINT/grubvar_readonly +set usbgadgetethaddr=$MAC +set USBVendorID=$VID +set USBProductID=$PID +set SerialNum=$SN +set USBDevice=$TID +set USBProduct=$PROD +EOF + else + print_error "Details required for USB device mode are missing from SMBIOS! UPGRADE your BIOS if using NI Target. USB Gadget will not be functional." + return + fi + fi +} + +set_serial_port() +{ + if [ -d /sys/class/tty/ttyS0 ] && [ -f /sys/class/tty/ttyS0/type ] && [ `cat /sys/class/tty/ttyS0/type` -ne 0 ]; then + echo "set serial_port="`cat /sys/class/tty/ttyS0/port` >> $GRUB_MOUNTPOINT/grubvar_readonly + + local base_clock + if base_clock=$(get_serial_base_clock); then + echo "set GRUB_SERIAL_BASE_CLOCK=$base_clock" >> $GRUB_MOUNTPOINT/grubvar_readonly + fi + fi + +} + +partitioning_disk() +{ + umount "$TARGET_DISK"? 2>/dev/null || true + print_info "Partitioning TARGET_DISK=$TARGET_DISK (PART_STYLE=$PART_STYLE)..." + PARTED_ERROR=`parted -s $TARGET_DISK mklabel $PART_STYLE 2>&1` || die "$PARTED_ERROR" + PARTED_ERROR=`parted -s --align optimal $TARGET_DISK mkpart $PART1_NAME 1MB 16MB 2>&1` || die "$PARTED_ERROR" + PARTED_ERROR=`parted -s --align optimal $TARGET_DISK mkpart $PART2_NAME 16MB 200MB 2>&1` || die "$PARTED_ERROR" + PARTED_ERROR=`parted -s --align optimal $TARGET_DISK mkpart $PART3_NAME 200MB 216MB 2>&1` || die "$PARTED_ERROR" + PARTED_ERROR=`parted -s --align optimal $TARGET_DISK mkpart $PART4_NAME 216MB 100% 2>&1` || die "$PARTED_ERROR" + print_done + + print_info "Assigning EFI System Partition..." + # Per https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/ + # C12A7328-F81F-11D2-BA4B-00A0C93EC93B -- EFI System Partition + sgdisk --typecode="1:C12A7328-F81F-11D2-BA4B-00A0C93EC93B" $TARGET_DISK + print_done + + print_info "Probing partitions of TARGET_DISK=$TARGET_DISK ..." + partprobe -s "$TARGET_DISK" + print_done +} + +create_filesystems() +{ + print_info "Creating filesystems ..." + + MKFS_ERROR=`mkfs.vfat -n $PART1_LABEL ${TARGET_DISK}${PART_SEPARATOR}1 2>&1` || die "$MKFS_ERROR" + do_silent mkfs.ext4 $MKFS_ARGS ${TARGET_DISK}${PART_SEPARATOR}2 || die "Format failed!" + do_silent mkfs.ext4 $MKFS_ARGS ${TARGET_DISK}${PART_SEPARATOR}3 || die "Format failed!" + do_silent mkfs.ext4 $MKFS_ARGS ${TARGET_DISK}${PART_SEPARATOR}4 || die "Format failed!" + + LABEL_ERROR=`e2label ${TARGET_DISK}${PART_SEPARATOR}2 $PART2_LABEL 2>&1` || die "$LABEL_ERROR" + LABEL_ERROR=`e2label ${TARGET_DISK}${PART_SEPARATOR}3 $PART3_LABEL 2>&1` || die "$LABEL_ERROR" + LABEL_ERROR=`e2label ${TARGET_DISK}${PART_SEPARATOR}4 $PART4_LABEL 2>&1` || die "$LABEL_ERROR" + + print_done +} + +set_efiboot_entry() +{ + # Delete existing NILRT entries with "-B" option + for ENTRY in $(efibootmgr | grep -Ei '(LabVIEW RT)|(niboota)|(nibootb)' | grep -Eo 'Boot[0-9A-Fa-f]{4}' || true); + do + ENTRY_NUMBER=${ENTRY: 4:4} + print_info " Drop entry $ENTRY_NUMBER." + EFIMGR=$(efibootmgr -b "$ENTRY_NUMBER" -B 2>&1) || print_warning "efibootmgr -b $ENTRY_NUMBER -B failed with: $EFIMGR" + done + efibootmgr $VERBOSE_ARGS -c -d ${TARGET_DISK} -p 1 -L 'LabVIEW RT' -l '\efi\boot\bootx64.efi' + print_done +} + +mount_grub_partition() +{ + GRUB_MOUNTPOINT=/var/volatile/grub + mkdir $GRUB_MOUNTPOINT -p + MOUNT_ERROR=`mount -L $PART1_LABEL $GRUB_MOUNTPOINT 2>&1` || die "$MOUNT_ERROR" +} + +install_grub() +{ + mount_grub_partition + + print_info "Configuring EFI grub2..." + GRUB_TARGET_DIR=$GRUB_MOUNTPOINT/efi/boot + mkdir -p $GRUB_TARGET_DIR + GRUB_TARGET=$(uname -m) + cp /boot/EFI/BOOT/bootx64.efi $GRUB_TARGET_DIR + + set_efiboot_entry + + print_info "Installing grub.cfg..." + + cp $SOURCE_DIR/grub.cfg $GRUB_TARGET_DIR/grub.cfg + mkdir -p $GRUB_TARGET_DIR/fonts + cp $SOURCE_DIR/fonts/unicode.pf2 $GRUB_TARGET_DIR/fonts/ + print_done +} + +mount_bootfs_partition() +{ + BOOTFS_MOUNTPOINT=/var/volatile/bootfs + mkdir $BOOTFS_MOUNTPOINT -p + BOOTFS_ERROR=`mount -L $PART2_LABEL $BOOTFS_MOUNTPOINT 2>&1` || die "$BOOTFS_ERROR" +} + +install_safemode() +{ + print_info "Installing safemode kernel and ramdisk..." + + mount_bootfs_partition + mkdir -p $BOOTFS_MOUNTPOINT/.safe + + cp "$SOURCE_DIR"/*Image "$BOOTFS_MOUNTPOINT/.safe/" + cp "$SOURCE_DIR"/ramdisk.* "$BOOTFS_MOUNTPOINT/.safe/" + cp "$SOURCE_DIR"/bootimage.* "$BOOTFS_MOUNTPOINT/.safe/" + + print_done +} + +install_bootmode_file() +{ + # write initial bootmode file + print_info "Installing bootmode file..." + echo "set BOOT_MODE=safemode" >$BOOTFS_MOUNTPOINT/bootmode + print_done +} + +add_rootuuid_to_grubenv() +{ + # save rootfs UUID for grub to reference + ROOTUUID=`lsblk ${TARGET_DISK}${PART_SEPARATOR}4 -n -o PARTUUID` + echo set rootuuid=$ROOTUUID >> $GRUB_MOUNTPOINT/grubvar_readonly +} + +install_grubenv() +{ + NI_TARGET="false" + + mkdir $BOOTFS_MOUNTPOINT/grub + touch $BOOTFS_MOUNTPOINT/grub/grubenv + touch $BOOTFS_MOUNTPOINT/.safe/SMBIOS_NI_vars + touch $BOOTFS_MOUNTPOINT/.safe/EFI_NI_vars + touch $BOOTFS_MOUNTPOINT/.safe/GRUB_NI_readonly_vars + if is_ni_device ; then + NI_TARGET="true" + cp $SOURCE_DIR/grubenv $BOOTFS_MOUNTPOINT/grub + cp $SOURCE_DIR/SMBIOS_NI_vars $BOOTFS_MOUNTPOINT/.safe + cp $SOURCE_DIR/EFI_NI_vars $BOOTFS_MOUNTPOINT/.safe + add_USB_gadget_args_to_grubenv + override_primaryport_grubenv $BOOTFS_MOUNTPOINT/grub/grubenv + else + cp $SOURCE_DIR/grubenv_non_ni_target $BOOTFS_MOUNTPOINT/grub/grubenv + fi + + set_serial_port + + grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "BIOSBootMode=efi" + grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "NITarget=$NI_TARGET" + + # Mark aforementioned grub vars read-only + for varname in "BIOSBootMode" "NITarget" ; do + echo "$varname" >> "$BOOTFS_MOUNTPOINT/.safe/GRUB_NI_readonly_vars" + done + + add_rootuuid_to_grubenv + + # set proper permissions on and backup firmware variable files + chown 0:500 $BOOTFS_MOUNTPOINT/grub/grubenv + chmod ug=rw,o=r $BOOTFS_MOUNTPOINT/grub/grubenv + cp -p $BOOTFS_MOUNTPOINT/grub/grubenv $BOOTFS_MOUNTPOINT/grub/grubenv.bak + chmod a=r $BOOTFS_MOUNTPOINT/.safe/SMBIOS_NI_vars + chmod a=r $BOOTFS_MOUNTPOINT/.safe/EFI_NI_vars + chmod a=r $BOOTFS_MOUNTPOINT/.safe/GRUB_NI_readonly_vars + + # Additional grubenv configuration, _NOT_ mirrored in grubenv.bak + + # If the target is a qemu vm, enable consoleout + if dmidecode |grep -qi "virtual machine" ; then + grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "consoleoutenable=True" + fi + + # If an initial value for console out was specified, write it to grubenv + if [ -n "$grubenv_consoleoutenable" ]; then + grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "consoleoutenable=$grubenv_consoleoutenable" + fi + + # Set quietbootdelay to show the boot menu on PXI controllers + # + # The reasoning behind this is that, for NI Linux RT support, Controller + # Software (the BIOS team) wants to keep the business logic out of + # BIOS as much as possible, and make the BIOS agnostic of the actual + # OS it is booting as much as possible (one exception being setting + # HT based on the EFI variable since this can only, practically, be + # handled in BIOS). + + if [ "`get_target_class`" == "PXI" ]; then + grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "quietbootdelay=3" + fi + + # If an initial value for bootdelay was specified, write it to grubenv + if [ -n "$grubenv_bootdelay" ]; then + grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "bootdelay=$grubenv_bootdelay" + fi +} + +fix_grubenv_after_usbreplication() +{ + # Fix files in nigrub filesystem + rm $GRUB_MOUNTPOINT/grubvar_readonly + if is_ni_device ; then + add_USB_gadget_args_to_grubenv + fi + set_serial_port + add_rootuuid_to_grubenv + + # Fix files in nibootfs filesystem + if is_ni_device ; then + override_primaryport_grubenv $BOOTFS_MOUNTPOINT/grub/grubenv + override_primaryport_grubenv $BOOTFS_MOUNTPOINT/grub/grubenv.bak + else + grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv set "serial#=ABCDEFG" + fi + grub-editenv $BOOTFS_MOUNTPOINT/grub/grubenv unset primaryethaddr +} + +set_versions() +{ + BUILD_IDENTIFIER=$(get_image_info BUILD_IDENTIFIER) + + echo "set ni_recoverytool_version=${BUILD_IDENTIFIER}" > $BOOTFS_MOUNTPOINT/grub/recoverytool-ni-version + + chmod 444 $BOOTFS_MOUNTPOINT/grub/recoverytool-ni-version +} + +fixup_configfs() +{ + CONFIG_MOUNTPOINT=/var/volatile/configfs + + mkdir -p $CONFIG_MOUNTPOINT + mount -L $PART3_LABEL $CONFIG_MOUNTPOINT + + # Set root dir ownership to lvuser:ni + chown 500:500 $CONFIG_MOUNTPOINT + chmod ug=rwx,o=rx $CONFIG_MOUNTPOINT + + # Set hostname, if configured + if [ -n "$PROVISION_HOSTNAME" ]; then + print_info "Setting hostname=\"$PROVISION_HOSTNAME\" in ni-rt.ini..." + + echo >$CONFIG_MOUNTPOINT/ni-rt.ini "[systemsettings]" + echo >>$CONFIG_MOUNTPOINT/ni-rt.ini "Host_Name=\"$PROVISION_HOSTNAME\"" + + # Set ownership to lvuser:ni + chown 500:500 $CONFIG_MOUNTPOINT/ni-rt.ini + chmod ug=rw,o=r $CONFIG_MOUNTPOINT/ni-rt.ini + + print_done + fi + + umount $CONFIG_MOUNTPOINT +} + +sanity_check() +{ + print_info "Sanity check TARGET_DISK=$TARGET_DISK..." + + # correct partition table type + parted -s --list "$TARGET_DISK" | grep -q "^Partition Table: $PART_STYLE" || die "Wrong partition style reported" + + attrib_list="NAME KNAME PARTUUID UUID LABEL" + if [[ "$PART_STYLE" == "gpt" ]]; then + attrib_list="$attrib_list PARTLABEL" + fi + + # unique attributes + for attrib_name in $attrib_list; do + sanity_list="`lsblk -nro "$attrib_name" "$TARGET_DISK"`" + sanity_list_len="`echo "$sanity_list" | wc -l`" + sanity_list_uniq_len="`echo "$sanity_list" | uniq | wc -l`" + [ "$sanity_list_len" -eq 5 ] || die "There should be 4 $attrib_name's (+1 blank line) on TARGET_DISK=$TARGET_DISK; found $sanity_list_len" + [ "$sanity_list_len" -eq "$sanity_list_uniq_len" ] || die "$attrib_name's not unique on TARGET_DISK=$TARGET_DISK; $sanity_list_len != $sanity_list_uniq_len" + done + + # can search by file system label + for fs_label in "$PART1_LABEL" "$PART2_LABEL" "$PART3_LABEL" "$PART4_LABEL"; do + fs_node_name="`lsblk -nro LABEL,NAME "$TARGET_DISK" | grep "^$fs_label " | cut -d" " -f2`" + [ "`echo "$fs_node_name" | wc -l`" -eq 1 ] || die "Invalid number of devnodes found" + [ -e "/dev/$fs_node_name" ] || die "No devnode for LABEL $fs_label" + done + + # can search by partition label, on gpt only + if [ "$PART_STYLE" == "gpt" ]; then + for part_label in "$PART1_NAME" "$PART2_NAME" "$PART3_NAME" "$PART4_NAME"; do + part_node_name="`lsblk -nro PARTLABEL,NAME "$TARGET_DISK" | grep "^$part_label " | cut -d" " -f2`" + [ "`echo "$part_node_name" | wc -l`" -eq 1 ] || die "Invalid number of devnodes found" + [ -e "/dev/$part_node_name" ] || die "No devnode for PARTLABEL $part_label" + done + fi + + # just in case meta-data is updated + sync + print_done +} + +SOURCE_DIR=/payload diff --git a/recipes-core/initrdscripts/init-restore-mode.bb b/recipes-core/initrdscripts/init-restore-mode.bb index c7c454a9b..7a0c14d8b 100644 --- a/recipes-core/initrdscripts/init-restore-mode.bb +++ b/recipes-core/initrdscripts/init-restore-mode.bb @@ -9,7 +9,6 @@ PV = "1.0" SRC_URI = "\ file://init-restore-mode.sh \ file://00-init-restore-mode.sh \ - file://efifix \ file://mmc_storage_device_codes.allow \ file://ni_provisioning \ file://ni_provisioning.common \ @@ -21,6 +20,7 @@ SRC_URI:append:xilinx-zynqhf = "\ " SRC_URI:append:x64 = "\ + file://ni_provisioning.safemode.common \ file://ni_provisioning.safemode \ file://disk_config_x64 \ file://grub.cfg \ @@ -33,7 +33,6 @@ do_install() { install -m 0644 ${WORKDIR}/mmc_storage_device_codes.allow ${D}${sysconfdir}/ni-provisioning/ install -m 0755 ${WORKDIR}/init-restore-mode.sh ${D}/init - install -m 0755 ${WORKDIR}/efifix ${D}/ install -m 0755 ${WORKDIR}/ni_provisioning ${D}/ install -m 0644 ${WORKDIR}/ni_provisioning.common ${D}/ install -m 0644 ${WORKDIR}/ni_provisioning.answers.default ${D}/ @@ -43,6 +42,7 @@ do_install() { } do_install:append:x64() { + install -m 0644 ${WORKDIR}/ni_provisioning.safemode.common ${D}/ install -m 0644 ${WORKDIR}/ni_provisioning.safemode ${D}/ install -m 0755 ${WORKDIR}/disk_config_x64 ${D}/disk_config install -m 0644 ${WORKDIR}/grub.cfg ${D}/ @@ -54,5 +54,5 @@ do_install:append:xilinx-zynqhf() { PACKAGE_ARCH = "${MACHINE_ARCH}" -FILES:${PN} += " /init /ni_provisioning* /disk_config /efifix /etc/profile.d/00-init-restore-mode.sh" +FILES:${PN} += " /init /ni_provisioning* /disk_config /etc/profile.d/00-init-restore-mode.sh" FILES:${PN}:append:x64 = " /grub.cfg " diff --git a/recipes-core/initscripts/initscripts-1.0/bootmisc_0001_make_hwclock_authoritative.patch b/recipes-core/initscripts/initscripts-1.0/bootmisc_0001_make_hwclock_authoritative.patch index f4e10b68d..16eab3376 100644 --- a/recipes-core/initscripts/initscripts-1.0/bootmisc_0001_make_hwclock_authoritative.patch +++ b/recipes-core/initscripts/initscripts-1.0/bootmisc_0001_make_hwclock_authoritative.patch @@ -1,3 +1,6 @@ +Upstream-Status: Inappropriate [NI specific] + +--- --- a/bootmisc.sh +++ b/bootmisc.sh @@ -63,10 +63,14 @@ diff --git a/recipes-core/initscripts/initscripts-1.0/bootmisc_0002_add_sanity_checks.patch b/recipes-core/initscripts/initscripts-1.0/bootmisc_0002_add_sanity_checks.patch index efcf3ab52..6179ce490 100644 --- a/recipes-core/initscripts/initscripts-1.0/bootmisc_0002_add_sanity_checks.patch +++ b/recipes-core/initscripts/initscripts-1.0/bootmisc_0002_add_sanity_checks.patch @@ -1,3 +1,6 @@ +Upstream-Status: Inappropriate [NI specific] + +--- --- a/bootmisc.sh +++ b/bootmisc.sh @@ -60,6 +60,20 @@ fi diff --git a/recipes-core/packagegroups/packagefeed-ni-core.bb b/recipes-core/packagegroups/packagefeed-ni-core.bb index ef4b9ba6c..4c669ebc2 100644 --- a/recipes-core/packagegroups/packagefeed-ni-core.bb +++ b/recipes-core/packagegroups/packagefeed-ni-core.bb @@ -6,6 +6,9 @@ inherit packagegroup RDEPENDS:${PN} = "\ packagegroup-base \ packagegroup-core-boot \ + packagegroup-core-standalone-sdk-target \ + packagegroup-core-x11 \ + packagegroup-kernel-module-build \ packagegroup-ni-base \ packagegroup-ni-contributors \ packagegroup-ni-crio \ @@ -16,11 +19,10 @@ RDEPENDS:${PN} = "\ packagegroup-ni-restoremode \ packagegroup-ni-runmode \ packagegroup-ni-safemode \ + packagegroup-ni-skyline \ + packagegroup-ni-snac \ packagegroup-ni-tzdata \ packagegroup-ni-wifi \ - packagegroup-core-x11 \ - packagegroup-core-standalone-sdk-target \ - packagegroup-kernel-module-build \ dkms \ bolt \ " diff --git a/recipes-core/packagegroups/packagefeed-ni-extra.bb b/recipes-core/packagegroups/packagefeed-ni-extra.bb index a4d283423..27cfbc275 100644 --- a/recipes-core/packagegroups/packagefeed-ni-extra.bb +++ b/recipes-core/packagegroups/packagefeed-ni-extra.bb @@ -14,7 +14,6 @@ RDEPENDS:${PN}:append:x64 = "\ geany \ gimp \ gnuplot \ - gnuradio \ gtk+3 \ iceauth \ fltk \ @@ -26,11 +25,9 @@ RDEPENDS:${PN}:append:x64 = "\ networkmanager \ numlockx \ openbox \ - onboard \ sessreg \ setxkbmap \ sysconfig-settings-ui \ - toscoterm \ tk \ twm \ upower \ @@ -194,7 +191,6 @@ RDEPENDS:${PN} += "\ nss-myhostname \ pinentry \ ptest-runner \ - sqlite \ " # openembedded-core/meta/recipes-kernel @@ -356,7 +352,6 @@ RDEPENDS:${PN}:append:x64 = "\ # meta-openembedded/meta-oe/recipes-multimedia RDEPENDS:${PN} += "\ - alsa-oss \ audiofile \ jack \ media-ctl \ @@ -498,19 +493,10 @@ RDEPENDS:${PN} += "\ tftp-hpa \ conntrack-tools \ ebtables \ - netkit-ftp \ - netkit-rpc \ - netkit-rsh-client \ - netkit-rsh-server \ - netkit-rwho-server \ - netkit-tftp-client \ - netkit-tftp-server \ - netkit-telnet \ net-snmp \ openflow \ openl2tp \ pptp-linux \ - quagga \ radiusclient-ng \ rp-pppoe \ xl2tpd \ diff --git a/recipes-core/packagegroups/packagegroup-ni-desirable.bb b/recipes-core/packagegroups/packagegroup-ni-desirable.bb index 9bec7bdcc..49c53f796 100644 --- a/recipes-core/packagegroups/packagegroup-ni-desirable.bb +++ b/recipes-core/packagegroups/packagegroup-ni-desirable.bb @@ -33,7 +33,6 @@ RDEPENDS:${PN} += "\ ldd \ ltrace \ ntp \ - ntpdate \ nvme-cli \ openssl-dev \ perf \ diff --git a/recipes-core/packagegroups/packagegroup-ni-graphical.bb b/recipes-core/packagegroups/packagegroup-ni-graphical.bb index 2601f3d9f..5ad251275 100644 --- a/recipes-core/packagegroups/packagegroup-ni-graphical.bb +++ b/recipes-core/packagegroups/packagegroup-ni-graphical.bb @@ -6,6 +6,5 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" inherit packagegroup RDEPENDS:${PN} = "\ - onboard \ packagegroup-ni-xfce \ " diff --git a/recipes-core/packagegroups/packagegroup-ni-internal-deps.bb b/recipes-core/packagegroups/packagegroup-ni-internal-deps.bb index 1a198469c..09f6e1419 100644 --- a/recipes-core/packagegroups/packagegroup-ni-internal-deps.bb +++ b/recipes-core/packagegroups/packagegroup-ni-internal-deps.bb @@ -16,7 +16,7 @@ RDEPENDS:${PN} += "\ " # nissl and nissleay -# Contact: Haris Okanovic +# Contact: Rich Tollerton RDEPENDS:${PN} += "\ apache-websocket \ apache2 \ @@ -60,7 +60,7 @@ RDEPENDS:${PN} += "\ libxml-parser-perl \ " -# Required for a mobilize step that installs a specific Python version +# Required for a mobilize step that installs a specific Python version # and requires building Python on the test system # Contact: ulf.glaeser@ni.com # Team: DAQ.SW.Ops@ni.com @@ -93,6 +93,7 @@ RDEPENDS:${PN} += "\ # Contact: Kevin Khai-Wern Lim RDEPENDS:${PN} += "\ memtester \ + ntfs-3g-ntfsprogs \ " # Required by aim-arinc-664 @@ -108,3 +109,13 @@ RDEPENDS:${PN} += "\ RDEPENDS:${PN} += "\ libglu \ " +# Required by PAtools Runtimesystem +# Team: Transportation BU - Modern Battery Lab +# Contact: Deborah Bryant +RDEPENDS:${PN} += "\ + libxslt \ + samba \ + ntp \ + ntp-tickadj \ + ntp-utils \ +" diff --git a/recipes-core/packagegroups/packagegroup-ni-ptest-smoke.bb b/recipes-core/packagegroups/packagegroup-ni-ptest-smoke.bb index b0222d41a..b4a328a8f 100644 --- a/recipes-core/packagegroups/packagegroup-ni-ptest-smoke.bb +++ b/recipes-core/packagegroups/packagegroup-ni-ptest-smoke.bb @@ -13,47 +13,48 @@ RDEPENDS:${PN} = "ptest-runner" # ptest packages RDEPENDS:${PN}:append = "\ - busybox-ptest \ - bzip2-ptest \ - coreutils-ptest \ - docker-functional-tests-ptest \ - e2fsprogs-ptest \ - elfutils-ptest \ - ethtool-ptest \ - flex-ptest \ - gettext-ptest \ - glibc-locale-tests-ptest \ - glibc-tests-ptest \ - kernel-tests-ptest \ - liberror-perl-ptest \ - libxml2-ptest \ - mdadm-ptest \ - nettle-ptest \ - ni-hw-scripts-ptest \ - ni-test-boot-time-ptest \ - opkg-ptest \ - pango-ptest \ - parted-ptest \ - perl-ptest \ - pstore-save-ptest \ - python3-appdirs-ptest \ - python3-atomicwrites-ptest \ - python3-bcrypt-ptest \ - python3-cryptography-ptest \ - python3-markupsafe-ptest \ - python3-more-itertools-ptest \ - python3-msgpack-ptest \ - python3-multidict-ptest \ - python3-pluggy-ptest \ - python3-pyasn1-ptest \ - python3-pyroute2-ptest \ - python3-pyserial-ptest \ - python3-pytz-ptest \ - python3-wcwidth-ptest \ - rt-tests-ptest \ - run-postinsts-ptest \ - sed-ptest \ - util-linux-ptest \ - xorg-fonts-100dpi-ptest \ - zeromq-ptest \ + busybox-ptest \ + bzip2-ptest \ + coreutils-ptest \ + docker-functional-tests-ptest \ + e2fsprogs-ptest \ + elfutils-ptest \ + ethtool-ptest \ + flex-ptest \ + gettext-ptest \ + glibc-locale-tests-ptest \ + glibc-tests-ptest \ + kernel-tests-ptest \ + liberror-perl-ptest \ + libxml2-ptest \ + mdadm-ptest \ + nettle-ptest \ + ni-hw-scripts-ptest \ + ni-test-boot-time-ptest \ + nilrt-snac-ptest \ + opkg-ptest \ + pango-ptest \ + parted-ptest \ + perl-ptest \ + pstore-save-ptest \ + python3-appdirs-ptest \ + python3-atomicwrites-ptest \ + python3-bcrypt-ptest \ + python3-cryptography-ptest \ + python3-markupsafe-ptest \ + python3-more-itertools-ptest \ + python3-msgpack-ptest \ + python3-multidict-ptest \ + python3-pluggy-ptest \ + python3-pyasn1-ptest \ + python3-pyroute2-ptest \ + python3-pyserial-ptest \ + python3-pytz-ptest \ + python3-wcwidth-ptest \ + rt-tests-ptest \ + run-postinsts-ptest \ + sed-ptest \ + util-linux-ptest \ + xorg-fonts-100dpi-ptest \ + zeromq-ptest \ " diff --git a/recipes-core/packagegroups/packagegroup-ni-restoremode.bb b/recipes-core/packagegroups/packagegroup-ni-restoremode.bb index 01c163da9..532723605 100644 --- a/recipes-core/packagegroups/packagegroup-ni-restoremode.bb +++ b/recipes-core/packagegroups/packagegroup-ni-restoremode.bb @@ -29,6 +29,7 @@ RDEPENDS:${PN} += "\ init-restore-mode \ kmod \ ni-smbios-helper \ + ni-systemreplication \ parted \ procps \ sed \ diff --git a/recipes-core/packagegroups/packagegroup-ni-runmode.bb b/recipes-core/packagegroups/packagegroup-ni-runmode.bb index 5c8a92fc8..a0fc86a24 100644 --- a/recipes-core/packagegroups/packagegroup-ni-runmode.bb +++ b/recipes-core/packagegroups/packagegroup-ni-runmode.bb @@ -23,6 +23,7 @@ RDEPENDS:${PN} = "\ librtpi \ linux-firmware-radeon \ lldpd \ + nftables \ ni-configpersistentlogs \ ni-locale-alias \ ni-modules-autoload \ @@ -67,7 +68,6 @@ RDEPENDS:${PN} += "\ python3-dateutil \ python3-dbus \ python3-difflib \ - python3-distutils \ python3-email \ python3-fcntl \ python3-html \ @@ -112,7 +112,6 @@ RDEPENDS:${PN} += "\ python3-setuptools \ python3-shell \ python3-six \ - python3-smtpd \ python3-stringold \ python3-terminal \ python3-threading \ diff --git a/recipes-core/packagegroups/packagegroup-ni-skyline.bb b/recipes-core/packagegroups/packagegroup-ni-skyline.bb new file mode 100644 index 000000000..eaf2f280f --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-ni-skyline.bb @@ -0,0 +1,37 @@ +# (C) Copyright 2024, +# National Instruments Corporation. +# All rights reserved. + +SUMMARY = "Open Source package dependencies for the NI Skyline software stack." +LICENSE = "MIT" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit packagegroup + +RDEPENDS:${PN} = "\ + salt-common \ + salt-minion \ +" + +# Miscellaneous python deps for closed-source Skyline components +RDEPENDS:${PN}:append = "\ + python3-aiodns \ + python3-aiohttp \ + python3-avahi \ + python3-configparser \ + python3-difflib \ + python3-misc \ + python3-mmap \ + python3-multiprocessing \ + python3-pika \ + python3-profile \ + python3-psutil \ + python3-pyiface \ + python3-pyinotify \ + python3-pyroute2 \ + python3-resource \ + python3-terminal \ + python3-unixadmin \ + python3-xmlrpc \ +" diff --git a/recipes-core/packagegroups/packagegroup-ni-snac.bb b/recipes-core/packagegroups/packagegroup-ni-snac.bb new file mode 100644 index 000000000..0e7b9e784 --- /dev/null +++ b/recipes-core/packagegroups/packagegroup-ni-snac.bb @@ -0,0 +1,15 @@ +SUMMARY = "Open source package dependencies for the NILRT SNAC configuration." +LICENSE = "MIT" + + +inherit packagegroup + + +RDEPENDS:${PN} = "\ + cryptsetup \ + firewalld \ + libpwquality \ + nilrt-snac \ + ntp \ + tmux \ +" diff --git a/recipes-core/util-linux/util-linux/0001-skip-btrfs-tests-if-kernel-support-for-btrfs-is-miss.patch b/recipes-core/util-linux/util-linux/0001-skip-btrfs-tests-if-kernel-support-for-btrfs-is-miss.patch deleted file mode 100644 index 0ab4eb870..000000000 --- a/recipes-core/util-linux/util-linux/0001-skip-btrfs-tests-if-kernel-support-for-btrfs-is-miss.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 8780cf56f80853910d1bba89ac551ecba62bf059 Mon Sep 17 00:00:00 2001 -From: Anatoly Pugachev -Date: Wed, 9 Nov 2022 12:00:12 +0300 -Subject: [PATCH] skip btrfs tests if kernel support for btrfs is missing - -Upstream-Status: Backport [https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/?id=8b9f571d252f921dab6cfd871bd0be20c58162a2] - -Signed-off-by: Chaitanya Vadrevu ---- - tests/ts/mount/fstab-btrfs | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/tests/ts/mount/fstab-btrfs b/tests/ts/mount/fstab-btrfs -index 0003b5d65..4d45d4dd5 100755 ---- a/tests/ts/mount/fstab-btrfs -+++ b/tests/ts/mount/fstab-btrfs -@@ -51,6 +51,8 @@ DEVICE=$TS_LODEV - [ -d "$TS_MOUNTPOINT_BIND" ] || mkdir -p "$TS_MOUNTPOINT_BIND" - mkfs.btrfs -d single -m single $DEVICE &> /dev/null || ts_die "Cannot make btrfs on $DEVICE" - -+btrfs device ready $DEVICE 2>/dev/null || ts_skip "btrfs kernel support is missing" -+ - $TS_CMD_MOUNT -o loop "$DEVICE" "$TS_MOUNTPOINT_CREATE" - pushd . >/dev/null - cd "$TS_MOUNTPOINT_CREATE" diff --git a/recipes-core/util-linux/util-linux_2.%.bbappend b/recipes-core/util-linux/util-linux_2.%.bbappend index e8a02934f..8ccd09889 100644 --- a/recipes-core/util-linux/util-linux_2.%.bbappend +++ b/recipes-core/util-linux/util-linux_2.%.bbappend @@ -1,7 +1,5 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" -SRC_URI += "file://0001-skip-btrfs-tests-if-kernel-support-for-btrfs-is-miss.patch" - DEPENDS:append:class-target = " shadow-native pseudo-native busybox" RDEPENDS:${PN}-hwclock:append = " niacctbase busybox-hwclock" diff --git a/recipes-core/uutils-coreutils/uutils-coreutils_%.bbappend b/recipes-core/uutils-coreutils/uutils-coreutils_%.bbappend new file mode 100644 index 000000000..13cf1fa1e --- /dev/null +++ b/recipes-core/uutils-coreutils/uutils-coreutils_%.bbappend @@ -0,0 +1 @@ +PACKAGECONFIG:remove = "selinux" diff --git a/recipes-devtools/opkg-utils/opkg-utils/0001-Revert-opkg-feed-Fix-adding-feeds-with-same-name-as-.patch b/recipes-devtools/opkg-utils/opkg-utils/0001-Revert-opkg-feed-Fix-adding-feeds-with-same-name-as-.patch new file mode 100644 index 000000000..9155b60e7 --- /dev/null +++ b/recipes-devtools/opkg-utils/opkg-utils/0001-Revert-opkg-feed-Fix-adding-feeds-with-same-name-as-.patch @@ -0,0 +1,34 @@ +From c93b3c56725efc80b51d628fe3446eeeac970227 Mon Sep 17 00:00:00 2001 +From: Alex Stewart +Date: Mon, 8 Apr 2024 16:16:08 -0400 +Subject: [PATCH] Revert "opkg-feed: Fix adding feeds with same name as + architecture" + +The new regexes added by the target commit invalidate the regex group +indexes used to extract the feed source information. As a result, +`opkg-feed list` operations fail to find feeds, in all cases. + +Revert this change until a fix can be developed. + +This reverts commit 67994e62dc598282830385da75ba9b1abbbda941. + +Signed-off-by: Alex Stewart + +Upstream-Status: Inappropriate [upstream ticket] +--- + opkg-feed | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/opkg-feed b/opkg-feed +index 36d4463..25ef879 100755 +--- a/opkg-feed ++++ b/opkg-feed +@@ -171,7 +171,7 @@ createFeedLineRegex() + # 1 = full source type with any quotes + # 2 = source type without quotes if quoted + # 3 = source type if unquoted +- sourceTypePattern='("([^"](src|dist)(/gz)?)"|(src|dist)(/gz)?)\s+'; ++ sourceTypePattern='("([^"]*)"|(\S+))\s+'; + + # Feed name capture groups (4, 5, 6) + # 4 = full feed name with any quotes diff --git a/recipes-devtools/opkg-utils/opkg-utils_%.bbappend b/recipes-devtools/opkg-utils/opkg-utils_%.bbappend new file mode 100644 index 000000000..356b7d3e8 --- /dev/null +++ b/recipes-devtools/opkg-utils/opkg-utils_%.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI += "file://0001-Revert-opkg-feed-Fix-adding-feeds-with-same-name-as-.patch" + diff --git a/recipes-devtools/python/python3-backports-ssl-match-hostname_3.7.0.1.bb b/recipes-devtools/python/python3-backports-ssl-match-hostname_3.7.0.1.bb new file mode 100644 index 000000000..4efc82a9f --- /dev/null +++ b/recipes-devtools/python/python3-backports-ssl-match-hostname_3.7.0.1.bb @@ -0,0 +1,23 @@ +SUMMARY = "The ssl.match_hostname() function from Python 3.5" +DESCRIPTION = "\ +The Secure Sockets layer is only actually secure if you check the hostname in \ +the certificate returned by the server to which you are connecting, and verify \ +that it matches to hostname that you are trying to reach. But the matching \ +logic, defined in RFC2818, can be a bit tricky to implement on your own. So \ +the ssl package in the Standard Library of Python 3.2 and greater now includes \ +a match_hostname() function for performing this check instead of requiring \ +every application to implement the check separately. This backport brings \ +match_hostname() to users of earlier versions of Python" +AUTHOR = "Toshio Kuratomi " +HOMEPAGE = "https://pypi.org/project/backports.ssl_match_hostname/" +LICENSE = "Python-2.0" +LIC_FILES_CHKSUM = "file://PKG-INFO;md5=b2adbe8bfdeb625c9a01afd9aaa66619" + +SRC_URI[md5sum] = "32d2f593af01a046bec3d2f5181a420a" +SRC_URI[sha256sum] = "bb82e60f9fbf4c080eabd957c39f0641f0fc247d9a16e31e26d594d8f42b9fd2" + +PYPI_PACKAGE = "backports.ssl_match_hostname" + +inherit pypi setuptools3 + +RDEPENDS:${PN} += "${PYTHON_PN}-pkgutil" diff --git a/recipes-devtools/python/python3-schema_0.7.5.bb b/recipes-devtools/python/python3-schema_0.7.5.bb new file mode 100644 index 000000000..79cdc1677 --- /dev/null +++ b/recipes-devtools/python/python3-schema_0.7.5.bb @@ -0,0 +1,17 @@ +SUMMARY = "Schema validation just got Pythonic" +DESCRIPTION = "\ +schema is a library for validating Python data structures, such as those \ +obtained from config-files, forms, external services or command-line parsing, \ +converted from JSON/YAML (or something else) to Python data-types.\ +" +HOMEPAGE = "https://github.com/keleshev/schema" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE-MIT;md5=09b77fb74986791a3d4a0e746a37d88f" + + +SRC_URI[sha256sum] = "f06717112c61895cabc4707752b88716e8420a8819d71404501e114f91043197" + + +inherit pypi setuptools3 + +BBCLASSEXTEND = "native nativesdk" diff --git a/recipes-devtools/utf8cpp/utf8cpp_4.0.5.bb b/recipes-devtools/utf8cpp/utf8cpp_4.0.5.bb new file mode 100644 index 000000000..2784532ad --- /dev/null +++ b/recipes-devtools/utf8cpp/utf8cpp_4.0.5.bb @@ -0,0 +1,40 @@ +SUMMARY = "UTF-8 with C++ in a Portable Way" +DESCRIPTION = "\ +C++ developers still miss an easy and portable way of handling Unicode encoded \ +strings. The original C++ standard (known as C++98 or C++03) is Unicode \ +agnostic. Some progress has been made in the later editions of the standard, \ +but it is still hard to work with Unicode using only the standard facilities.\ +\ +I came up with a small, C++98 compatible generic library in order to \ +handle UTF-8 encoded strings. For anybody used to work with STL algorithms and \ +iterators, it should be easy and natural to use. The code is freely available \ +for any purpose - check out the license. The library has been used a lot since \ +the first release in 2006 both in commercial and open-source projects and \ +proved to be stable and useful." +HOMEPAGE = "https://github.com/nemtrif/utfcpp" +SECTION = "libs" +LICENSE = "BSL-1.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=e4224ccaecb14d942c71d31bef20d78c" + +DEPENDS = "" + +SRC_URI = "\ + git://github.com/nemtrif/utfcpp;branch=master;protocol=https \ +" +SRCREV = "6be08bbea14ffa0a5c594257fb6285a054395cd7" + +S = "${WORKDIR}/git" + + +inherit cmake + + +# For a library, the header files should be in the base package. The cmake +# configs should be in -dev. +FILES:${PN}:append = " ${includedir}" +FILES:${PN}-dev:remove = "${includedir}" +FILES:${PN}-dev:append = " ${datadir}/${BPN}/cmake" + +RDEPENDS:${PN}-dev:append = "${PN}" + +BBCLASSEXTEND = "native" diff --git a/recipes-devtools/valgrind/files/0001-Implement-ficom-instruction-for-amd64.patch b/recipes-devtools/valgrind/files/0001-Implement-ficom-instruction-for-amd64.patch index 76e85601e..b0aad7cc0 100644 --- a/recipes-devtools/valgrind/files/0001-Implement-ficom-instruction-for-amd64.patch +++ b/recipes-devtools/valgrind/files/0001-Implement-ficom-instruction-for-amd64.patch @@ -6,6 +6,8 @@ Subject: [PATCH 1/2] Implement ficom instruction for amd64 This should fix #103594 for amd64 previous commit was for x86 only. +Upstream-Status: Inappropriate [NI specific] + Signed-off-by: Bill Pittman --- VEX/priv/guest_amd64_toIR.c | 79 ++++++++++++++++++++++++++++++++++++++++++++- diff --git a/recipes-devtools/valgrind/files/0002-Patch-for-FBLD-FBSTP-FTST.patch b/recipes-devtools/valgrind/files/0002-Patch-for-FBLD-FBSTP-FTST.patch index 7b58a4b6b..c6b444357 100644 --- a/recipes-devtools/valgrind/files/0002-Patch-for-FBLD-FBSTP-FTST.patch +++ b/recipes-devtools/valgrind/files/0002-Patch-for-FBLD-FBSTP-FTST.patch @@ -6,6 +6,8 @@ Subject: [PATCH 2/2] Patch for FBLD/FBSTP/FTST Pulled from a third party patch set that was not upstreamed. +Upstream-Status: Denied + Signed-off-by: Bill Pittman --- VEX/priv/guest_amd64_defs.h | 3 ++ diff --git a/recipes-extended/libpwquality/files/pwquality.conf b/recipes-extended/libpwquality/files/pwquality.conf new file mode 100644 index 000000000..9a652d5cd --- /dev/null +++ b/recipes-extended/libpwquality/files/pwquality.conf @@ -0,0 +1,78 @@ +# Configuration for systemwide password quality limits +# +# Number of characters in the new password that must not be present in the +# old password. +difok = 8 +# +# Minimum acceptable size for the new password (plus one if +# credits are not disabled which is the default). (See pam_cracklib manual.) +# Cannot be set to lower value than 6. +minlen = 15 +# +# The maximum credit for having digits in the new password. If less than 0 +# it is the minimum number of digits in the new password. +dcredit = -1 +# +# The maximum credit for having uppercase characters in the new password. +# If less than 0 it is the minimum number of uppercase characters in the new +# password. +ucredit = -1 +# +# The maximum credit for having lowercase characters in the new password. +# If less than 0 it is the minimum number of lowercase characters in the new +# password. +lcredit = -1 +# +# The maximum credit for having other characters in the new password. +# If less than 0 it is the minimum number of other characters in the new +# password. +ocredit = -1 +# +# The minimum number of required classes of characters for the new +# password (digits, uppercase, lowercase, others). +minclass = 4 +# +# The maximum number of allowed consecutive same characters in the new password. +# The check is disabled if the value is 0. +maxrepeat = 3 +# +# The maximum number of allowed consecutive characters of the same class in the +# new password. +# The check is disabled if the value is 0. +maxclassrepeat = 4 +# +# Whether to check for the words from the passwd entry GECOS string of the user. +# The check is enabled if the value is not 0. +# gecoscheck = 0 +# +# Whether to check for the words from the cracklib dictionary. +# The check is enabled if the value is not 0. +dictcheck = 1 +# +# Whether to check if it contains the user name in some form. +# The check is enabled if the value is not 0. +# usercheck = 1 +# +# Length of substrings from the username to check for in the password +# The check is enabled if the value is greater than 0 and usercheck is enabled. +# usersubstr = 0 +# +# Whether the check is enforced by the PAM module and possibly other +# applications. +# The new password is rejected if it fails the check and the value is not 0. +# enforcing = 1 +# +# Path to the cracklib dictionaries. Default is to use the cracklib default. +# dictpath = +# +# Prompt user at most N times before returning with error. The default is 1. +retry = 3 +# +# Enforces pwquality checks on the root user password. +# Enabled if the option is present. +# enforce_for_root +# +# Skip testing the password quality for users that are not present in the +# /etc/passwd file. +# Enabled if the option is present. +# local_users_only \ No newline at end of file diff --git a/recipes-extended/libpwquality/libpwquality_1.%.bbappend b/recipes-extended/libpwquality/libpwquality_1.%.bbappend new file mode 100644 index 000000000..c7ecb86c9 --- /dev/null +++ b/recipes-extended/libpwquality/libpwquality_1.%.bbappend @@ -0,0 +1,13 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI:append = "\ + file://pwquality.conf \ +" + +do_install:append() { + install -d ${D}${sysconfdir}/security + install -m 644 ${WORKDIR}/pwquality.conf ${D}${sysconfdir}/security/pwquality.conf +} + +FILES:${PN} += "${sysconfdir}/security/pwquality.conf" +CONFFILES:${PN} += "${sysconfdir}/security/pwquality.conf" diff --git a/recipes-extended/pam/libpam/security/faillock.conf b/recipes-extended/pam/libpam/security/faillock.conf new file mode 100644 index 000000000..abec69ac7 --- /dev/null +++ b/recipes-extended/pam/libpam/security/faillock.conf @@ -0,0 +1,62 @@ +# Configuration for locking the user after multiple failed +# authentication attempts. +# +# The directory where the user files with the failure records are kept. +# The default is /var/run/faillock. +# dir = /var/run/faillock +# +# Will log the user name into the system log if the user is not found. +# Enabled if option is present. +audit +# +# Don't print informative messages. +# Enabled if option is present. +silent +# +# Don't log informative messages via syslog. +# Enabled if option is present. +# no_log_info +# +# Only track failed user authentications attempts for local users +# in /etc/passwd and ignore centralized (AD, IdM, LDAP, etc.) users. +# The `faillock` command will also no longer track user failed +# authentication attempts. Enabling this option will prevent a +# double-lockout scenario where a user is locked out locally and +# in the centralized mechanism. +# Enabled if option is present. +# local_users_only +# +# Deny access if the number of consecutive authentication failures +# for this user during the recent interval exceeds n tries. +# The default is 3. +deny = 3 +# +# The length of the interval during which the consecutive +# authentication failures must happen for the user account +# lock out is n seconds. +# The default is 900 (15 minutes). +fail_interval = 900 +# +# The access will be re-enabled after n seconds after the lock out. +# The value 0 has the same meaning as value `never` - the access +# will not be re-enabled without resetting the faillock +# entries by the `faillock` command. +# The default is 600 (10 minutes). +unlock_time = 0 +# +# Root account can become locked as well as regular accounts. +# Enabled if option is present. +# even_deny_root +# +# This option implies the `even_deny_root` option. +# Allow access after n seconds to root account after the +# account is locked. In case the option is not specified +# the value is the same as of the `unlock_time` option. +# root_unlock_time = 900 +# +# If a group name is specified with this option, members +# of the group will be handled by this module the same as +# the root account (the options `even_deny_root>` and +# `root_unlock_time` will apply to them. +# By default, the option is not set. +# admin_group = diff --git a/recipes-extended/pam/libpam_1.%.bbappend b/recipes-extended/pam/libpam_1.%.bbappend index 9accc57ef..1a582a480 100644 --- a/recipes-extended/pam/libpam_1.%.bbappend +++ b/recipes-extended/pam/libpam_1.%.bbappend @@ -1 +1,23 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" + +SRC_URI += "\ + file://security/faillock.conf \ +" + +do_install:append() { + install -m 644 ${WORKDIR}/security/faillock.conf ${D}${sysconfdir}/security/faillock.conf +} + +pkg_postinst:pam-plugin-faillock:append() { + # enable faillock + sed -E -i 's/^(.+)success=1(.+)$/auth requisite pam_faillock.so preauth\n\1success=2\2\nauth [default=die] pam_faillock.so authfail/' "${sysconfdir}/pam.d/common-auth" + echo "auth sufficient pam_faillock.so authsucc" >> "${sysconfdir}/pam.d/common-auth" +} + +pkg_prerm:pam-plugin-faillock:append() { + # disable faillock + sed -E -i '/pam_faillock.so/d' "${sysconfdir}/pam.d/common-auth" + sed -E -i 's/^(.+)success=2(.+)$/\1success=1\2/' "${sysconfdir}/pam.d/common-auth" +} + +RCONFLICTS:pam-plugin-faillock:append = " ni-auth" diff --git a/recipes-extended/procps/procps_3.%.bbappend b/recipes-extended/procps/procps_%.bbappend similarity index 100% rename from recipes-extended/procps/procps_3.%.bbappend rename to recipes-extended/procps/procps_%.bbappend diff --git a/recipes-extended/sudo/sudo_1.%.bbappend b/recipes-extended/sudo/sudo_1.%.bbappend new file mode 100644 index 000000000..a094dca7b --- /dev/null +++ b/recipes-extended/sudo/sudo_1.%.bbappend @@ -0,0 +1,3 @@ +do_install:append() { + sed -i 's/^# \(%sudo ALL=(ALL:ALL) ALL\)$/\1/' ${D}${sysconfdir}/sudoers +} diff --git a/recipes-extended/tmux/files/tmux.conf b/recipes-extended/tmux/files/tmux.conf new file mode 100644 index 000000000..76fa63182 --- /dev/null +++ b/recipes-extended/tmux/files/tmux.conf @@ -0,0 +1,3 @@ +set -g lock-command vlock +bind X lock-session +source-file -q /usr/share/tmux/conf.d/* diff --git a/recipes-extended/tmux/tmux_3.%.bbappend b/recipes-extended/tmux/tmux_3.%.bbappend new file mode 100644 index 000000000..bb808ea1a --- /dev/null +++ b/recipes-extended/tmux/tmux_3.%.bbappend @@ -0,0 +1,15 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +SRC_URI += "\ + file://tmux.conf \ +" + +do_install:append() { + install -d ${D}${sysconfdir} + install -m 644 ${WORKDIR}/tmux.conf ${D}${sysconfdir}/tmux.conf + install -d ${D}/usr/share/tmux/conf.d +} + +FILES:${PN} += "${sysconfdir}/tmux.conf" +CONFFILES:${PN} += "${sysconfdir}/tmux.conf" +RDEPENDS:${PN}:append = " vlock" diff --git a/recipes-graphics/xinput-calibrator/xinput-calibrator/add-xfce-settings-and-wrapper-to-desktop-file.patch b/recipes-graphics/xinput-calibrator/xinput-calibrator/add-xfce-settings-and-wrapper-to-desktop-file.patch index 414a07bd7..6d4370f37 100644 --- a/recipes-graphics/xinput-calibrator/xinput-calibrator/add-xfce-settings-and-wrapper-to-desktop-file.patch +++ b/recipes-graphics/xinput-calibrator/xinput-calibrator/add-xfce-settings-and-wrapper-to-desktop-file.patch @@ -2,16 +2,18 @@ commit 11fa3ee8b684fa41cfc50d36ed598a16faa15943 Author: Alex Stewart Date: Wed Feb 15 14:07:55 2017 -0600 - add xfce-settings and wrapper to .desktop file - - XFCE-Settings categories are necessary for the "calibrate touchscreen" entry to - appear in XFCE's settings dialog. They are necessary here for NI's Linux RT gui. - - The Exec line is changed to point to the wrapper script NI uses. This has to be - done in a patch because it needs to be applied before xinput-calibrator - installs the .desktop file to disk. +add xfce-settings and wrapper to .desktop file + +XFCE-Settings categories are necessary for the "calibrate touchscreen" entry to +appear in XFCE's settings dialog. They are necessary here for NI's Linux RT gui. + +The Exec line is changed to point to the wrapper script NI uses. This has to be +done in a patch because it needs to be applied before xinput-calibrator +installs the .desktop file to disk. + +Upstream-Status: Inappropriate [NI specific] - Signed-off-by: Alex Stewart +Signed-off-by: Alex Stewart diff --git a/scripts/xinput_calibrator.desktop b/scripts/xinput_calibrator.desktop index d888899..17d2cd4 100644 diff --git a/recipes-kernel/kernel-tests/files/build-containers b/recipes-kernel/kernel-tests/files/build-containers new file mode 100644 index 000000000..88c7285a7 --- /dev/null +++ b/recipes-kernel/kernel-tests/files/build-containers @@ -0,0 +1,23 @@ +#!/bin/bash + +if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then + echo "Building cyclictest-container..." + DOCKER_BUILDKIT=1 \ + docker build -t cyclictest-container --network=host ./cyclictest-container + if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then + echo "Failed to build cyclictest-container" + exit 77 + fi +fi + +if [ "$(docker images -q parallel-container:latest)" = "" ]; then + echo "Building parallel-container..." + DOCKER_BUILDKIT=1 \ + docker build -t parallel-container --network=host ./parallel-container + if [ "$(docker images -q parallel-container:latest)" = "" ]; then + echo "Failed to build parallel-container" + exit 77 + fi +fi + +exit 0 diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/common.cfg b/recipes-kernel/kernel-tests/files/common.cfg similarity index 63% rename from recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/common.cfg rename to recipes-kernel/kernel-tests/files/common.cfg index 70136bf76..0fae9bb06 100644 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/common.cfg +++ b/recipes-kernel/kernel-tests/files/common.cfg @@ -1,9 +1,12 @@ # Common configuration for all kernel performance tests TEST_DURATION=8h +TEST_DIR="$(dirname "$(readlink -f "$0")")" +TEST_NAME=$(basename "$(dirname "$TEST_DIR")") + # Maximum expected latency in useconds. # The test will fail if cyclictest latency goes beyond this value. MAX_LATENCY=300 # Location for benchmark logs and test results -LOG_DIR="/var/local/ptest-results/kernel-containerized-performance-tests" +LOG_DIR="/var/local/ptest-results/$TEST_NAME" diff --git a/recipes-kernel/kernel-tests/files/cyclictest-container/Dockerfile b/recipes-kernel/kernel-tests/files/cyclictest-container/Dockerfile new file mode 100644 index 000000000..6d67f8fcd --- /dev/null +++ b/recipes-kernel/kernel-tests/files/cyclictest-container/Dockerfile @@ -0,0 +1,10 @@ +FROM ubuntu:latest + +# Install rt-tests, sudo, etc +RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y \ + rt-tests \ + python3 \ + python3-pip \ + dmidecode \ + grub-common \ + python3-influxdb diff --git a/recipes-kernel/kernel-tests/files/fio-load b/recipes-kernel/kernel-tests/files/fio-load new file mode 100644 index 000000000..f84e34555 --- /dev/null +++ b/recipes-kernel/kernel-tests/files/fio-load @@ -0,0 +1,19 @@ +#!/bin/bash +source "$(dirname "$0")"/common.cfg + +case "$1" in + start) + mkdir -p /var/cache/fio + fio fio.cfg --ioengine="sync" --runtime="$TEST_DURATION" --ramp_time=1m --output="$LOG_DIR/fio-sync-`date +'%Y_%m_%d-%H_%M_%S'`.log" > /dev/null & + ;; + stop) + killall -INT fio > /dev/null 2>&1 + rm -rf /var/cache/fio + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/recipes-kernel/kernel-tests/kernel-performance-tests-files/fio.cfg b/recipes-kernel/kernel-tests/files/fio.cfg similarity index 80% rename from recipes-kernel/kernel-tests/kernel-performance-tests-files/fio.cfg rename to recipes-kernel/kernel-tests/files/fio.cfg index 78ff99b68..beffbe542 100644 --- a/recipes-kernel/kernel-tests/kernel-performance-tests-files/fio.cfg +++ b/recipes-kernel/kernel-tests/files/fio.cfg @@ -7,6 +7,8 @@ openfiles=10 direct=0 verify=sha256 do_verify=1 +experimental_verify=1 +random_generator=lfsr time_based clocksource=clock_gettime bs=5k diff --git a/recipes-kernel/kernel-tests/files/hackbench-load b/recipes-kernel/kernel-tests/files/hackbench-load new file mode 100644 index 000000000..43b6df4f1 --- /dev/null +++ b/recipes-kernel/kernel-tests/files/hackbench-load @@ -0,0 +1,17 @@ +#!/bin/bash +source "$(dirname "$0")"/common.cfg + +case "$1" in + start) + hackbench -l 36000000 -g 10 2>/dev/null >"$LOG_DIR/hackbench-`date +'%Y_%m_%d-%H_%M_%S'`.log" & + ;; + stop) + killall -INT hackbench > /dev/null 2>&1 + ;; + *) + echo "Usage: $0 {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/recipes-kernel/kernel-tests/files/iperf-load b/recipes-kernel/kernel-tests/files/iperf-load new file mode 100644 index 000000000..edcf44f50 --- /dev/null +++ b/recipes-kernel/kernel-tests/files/iperf-load @@ -0,0 +1,40 @@ +#!/bin/bash +source "$(dirname "$0")"/common.cfg +source /home/admin/.iperf.info + +case "$1" in + check) + if [ -z "$IPERF_SERVER" ]; then + echo "Warning: iperf server not configured; skipping iperf based network load test." + echo "Create/edit /home/admin/.iperf.info file with IPERF_SERVER= and IPERF_PORT= to configure a server to connect to for this test." + echo "SKIP: test_kernel_cyclictest_iperf" + exit 77 + fi + if [ ! -z "$IPERF_PORT" ]; then + iperf3 -c "$IPERF_SERVER" -p "$IPERF_PORT" -t 1 > /dev/null 2>&1 + else + iperf3 -c "$IPERF_SERVER" -t 1 > /dev/null 2>&1 + fi + if [ $? -ne 0 ]; then + echo "ERROR: iperf server not reachable; skipping iperf based network load test." + echo "SKIP: test_kernel_cyclictest_iperf" + exit 77 + fi + ;; + start) + if [ ! -z "$IPERF_PORT" ]; then + iperf3 -c "$IPERF_SERVER" -p "$IPERF_PORT" -t 36000 --logfile "$LOG_DIR/iperf-`date +'%Y_%m_%d-%H_%M_%S'`.log" & + else + iperf3 -c "$IPERF_SERVER" -t 36000 --logfile "$LOG_DIR/iperf-`date +'%Y_%m_%d-%H_%M_%S'`.log" & + fi + ;; + stop) + killall -INT iperf3 > /dev/null 2>&1 + ;; + *) + echo "Usage: $0 {check|start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/recipes-kernel/kernel-tests/files/parallel-container/Dockerfile b/recipes-kernel/kernel-tests/files/parallel-container/Dockerfile new file mode 100644 index 000000000..b2d2c9003 --- /dev/null +++ b/recipes-kernel/kernel-tests/files/parallel-container/Dockerfile @@ -0,0 +1,8 @@ +FROM ubuntu:latest + +# Install rt-tests, sudo, etc +RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y \ + rt-tests \ + fio \ + iperf3 \ + psmisc diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/run-cyclictest b/recipes-kernel/kernel-tests/files/run-cyclictest similarity index 95% rename from recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/run-cyclictest rename to recipes-kernel/kernel-tests/files/run-cyclictest index 4d11def15..46c8fcef9 100644 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/run-cyclictest +++ b/recipes-kernel/kernel-tests/files/run-cyclictest @@ -1,5 +1,5 @@ #!/bin/bash -source ./common.cfg +source "$(dirname "$0")"/common.cfg function add_system_info() { @@ -81,3 +81,8 @@ function run_cyclictest() } mkdir -p "$LOG_DIR" + +if [ "$#" -ge 1 ]; then + run_cyclictest "${@:1}" + exit $CYCLICTEST_RESULT +fi diff --git a/recipes-kernel/kernel-tests/files/run-docker-cyclictest b/recipes-kernel/kernel-tests/files/run-docker-cyclictest new file mode 100644 index 000000000..afa796e09 --- /dev/null +++ b/recipes-kernel/kernel-tests/files/run-docker-cyclictest @@ -0,0 +1,37 @@ +#!/bin/bash +source "$(dirname "$0")"/common.cfg + +case "$#" in + 1) + docker run --privileged --network=host \ + -v ${LOG_DIR}:${LOG_DIR} \ + -v ${TEST_DIR}:${TEST_DIR} \ + -v /home/admin:/home/admin \ + -v /usr/share/fw_printenv:/usr/share/fw_printenv \ + -v /sbin/fw_printenv:/sbin/fw_printenv \ + -v /usr/share/nisysinfo:/usr/share/nisysinfo \ + -v /dev:/dev \ + -w ${TEST_DIR} \ + -t cyclictest-container \ + "${TEST_DIR}/run-cyclictest" "$1" + CYCLICTEST_RESULT=$? + ;; + 2) + docker run --privileged --network=host \ + --cpuset-cpus "$2" \ + -v ${LOG_DIR}:${LOG_DIR} \ + -v ${TEST_DIR}:${TEST_DIR} \ + -v /home/admin:/home/admin \ + -v /usr/share/fw_printenv:/usr/share/fw_printenv \ + -v /sbin/fw_printenv:/sbin/fw_printenv \ + -v /usr/share/nisysinfo:/usr/share/nisysinfo \ + -v /dev:/dev \ + -w ${TEST_DIR} \ + -t cyclictest-container \ + "${TEST_DIR}/run-cyclictest" "$1" + ;; + *) + echo echo "Usage: $0 {test_name} [{cpu}]" + exit 1 + ;; +esac diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/upload_cyclictest_results.py b/recipes-kernel/kernel-tests/files/upload_cyclictest_results.py similarity index 100% rename from recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/upload_cyclictest_results.py rename to recipes-kernel/kernel-tests/files/upload_cyclictest_results.py diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/cyclictest-container/Dockerfile b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/cyclictest-container/Dockerfile deleted file mode 100644 index 1c087e913..000000000 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/cyclictest-container/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM ubuntu:latest - -# Install rt-tests, sudo, etc -RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y \ - rt-tests \ - python3 \ - python3-pip \ - dmidecode \ - grub-common - -# Need to send to InfluxDB -RUN pip install influxdb - -# Script to call "run_cyclictest" from outside Docker container -ADD --chmod=0775 call_run_ct.sh ./call_run_ct.sh - diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/cyclictest-container/call_run_ct.sh b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/cyclictest-container/call_run_ct.sh deleted file mode 100755 index 7e2f3c223..000000000 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/cyclictest-container/call_run_ct.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -cd /ptests -source ./run-cyclictest -TEST_LOG=${LOG_DIR}/run_cyclictest-`date +'%Y_%m_%d-%H_%M_%S'`-${1}.log -run_cyclictest "${1}" > ${TEST_LOG} 2>&1 -echo "${CYCLICTEST_RESULT}" - diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/fio.cfg b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/fio.cfg deleted file mode 100644 index 78ff99b68..000000000 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/fio.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[global] -directory=/var/cache/fio -numjobs=1 -size=100M -nrfiles=20 -openfiles=10 -direct=0 -verify=sha256 -do_verify=1 -time_based -clocksource=clock_gettime -bs=5k - -[random_rw] -rw=randrw diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/parallel-container/Dockerfile b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/parallel-container/Dockerfile deleted file mode 100644 index 51a0e87bf..000000000 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/parallel-container/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM ubuntu:latest - -# Install rt-tests, sudo, etc -RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y \ - rt-tests \ - fio \ - iperf3 \ - psmisc - -# Scripts to start loads from outside container -ADD --chmod=0775 run_hackbench.sh ./run_hackbench.sh -ADD --chmod=0775 run_fio.sh ./run_fio.sh -ADD --chmod=0775 run_iperf.sh ./run_iperf.sh - diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/parallel-container/run_fio.sh b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/parallel-container/run_fio.sh deleted file mode 100644 index 0f3396d1a..000000000 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/parallel-container/run_fio.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -cd /ptests -source run-cyclictest -mkdir -p /var/cache/fio -fio fio.cfg --ioengine="sync" --runtime="${TEST_DURATION}" --ramp_time=1m \ - --output="${LOG_DIR}/fio-sync-`date +'%Y_%m_%d-%H_%M_%S'`.log" \ - > /dev/null - diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/parallel-container/run_hackbench.sh b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/parallel-container/run_hackbench.sh deleted file mode 100644 index c52cf307c..000000000 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/parallel-container/run_hackbench.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -cd /ptests -source run-cyclictest -hackbench -l 36000000 -g 10 \ - 2>/dev/null > "${LOG_DIR}/hackbench-`date +'%Y_%m_%d-%H_%M_%S\'`.log" - diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/parallel-container/run_iperf.sh b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/parallel-container/run_iperf.sh deleted file mode 100644 index 413c91b63..000000000 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/parallel-container/run_iperf.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -cd /ptests -source run-cyclictest -source /home/admin/.iperf.info -if [ ! -z "${IPERF_PORT}" ]; then - iperf3 -c "${IPERF_SERVER}" -p "${IPERF_PORT}" -t 36000 \ - --logfile "${LOG_DIR}/iperf-`date +'%Y_%m_%d-%H_%M_%S'`.log" -else - iperf3 -c "${IPERF_SERVER}" -t 36000 \ - --logfile "${LOG_DIR}/iperf-`date +'%Y_%m_%d-%H_%M_%S'`.log" -fi - diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/run-ptest b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/run-ptest index 46c4c8eb8..eb813f20a 100644 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/run-ptest +++ b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/run-ptest @@ -1,9 +1,10 @@ #!/bin/bash +./build-containers || exit $? + ./test_kernel_cyclictest_idle_containerized.sh ./test_kernel_cyclictest_hackbench_containerized.sh ./test_kernel_cyclictest_fio_containerized.sh ./test_kernel_cyclictest_iperf_containerized.sh exit 0 - diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_fio_containerized.sh b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_fio_containerized.sh index 1e01d1888..8216f2656 100644 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_fio_containerized.sh +++ b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_fio_containerized.sh @@ -1,45 +1,19 @@ #!/bin/bash - -PTEST_LOCATION=/usr/lib/kernel-containerized-performance-tests/ptest - -# Build the two containers -if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then - echo "Building cyclictest-container..." - DOCKER_BUILDKIT=1 \ - docker build -t cyclictest-container --network=host ${PTEST_LOCATION}/cyclictest-container - if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then - echo "Failed to build cyclictest-container" - exit 77 - fi -fi -if [ "$(docker images -q parallel-container:latest)" = "" ]; then - echo "Building parallel-container..." - DOCKER_BUILDKIT=1 \ - docker build -t parallel-container --network=host ${PTEST_LOCATION}/parallel-container - if [ "$(docker images -q parallel-container:latest)" = "" ]; then - echo "Failed to build parallel-container" - exit 77 - fi -fi +source "$(dirname "$0")"/common.cfg # Start background disk I/O load -echo "Starting fio load..." -LOAD_CONT=$(docker run -d --privileged -v ${PTEST_LOCATION}:/ptests -t parallel-container \ - bash run_fio.sh) +LOAD_CONT=$(docker run -d --privileged --network=host \ + -v ${LOG_DIR}:${LOG_DIR} \ + -v ${TEST_DIR}:${TEST_DIR} \ + -v /home/admin:/home/admin \ + -t parallel-container) +docker exec -d $LOAD_CONT "$TEST_DIR/fio-load" "start" # Run cyclictest -echo "Running cyclictest in docker container..." -RESULT=$(docker run --privileged --network=host \ - -v ${LOG_DIR}:${LOG_DIR} -v ${PTEST_LOCATION}:/ptests -v /home/admin:/home/admin \ - -v /usr/share/fw_printenv:/usr/share/fw_printenv -v /sbin/fw_printenv:/sbin/fw_printenv \ - -v /usr/share/nisysinfo:/usr/share/nisysinfo -v /dev:/dev \ - -t cyclictest-container \ - bash call_run_ct.sh "fio_containerized" \ - | tr -d '\r' | tr -d '\n') +"$TEST_DIR/run-docker-cyclictest" "fio_containerized" # Clean up the background container -docker exec ${LOAD_CONT} bash -c "killall -INT fio > /dev/null 2>&1" - -echo "Test Result: ${RESULT}" -exit ${RESULT} +docker exec $LOAD_CONT "$TEST_DIR/fio-load" "stop" +docker stop $LOAD_CONT +exit $CYCLICTEST_RESULT diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_hackbench_containerized.sh b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_hackbench_containerized.sh index b1aaa06d6..0386feab5 100644 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_hackbench_containerized.sh +++ b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_hackbench_containerized.sh @@ -1,46 +1,38 @@ #!/bin/bash +source "$(dirname "$0")"/common.cfg -PTEST_LOCATION=/usr/lib/kernel-containerized-performance-tests/ptest - -# Build the two containers -if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then - echo "Building cyclictest-container..." - DOCKER_BUILDKIT=1 \ - docker build -t cyclictest-container --network=host ${PTEST_LOCATION}/cyclictest-container - if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then - echo "Failed to build cyclictest-container" - exit 77 - fi -fi -if [ "$(docker images -q parallel-container:latest)" = "" ]; then - echo "Building parallel-container..." - DOCKER_BUILDKIT=1 \ - docker build -t parallel-container --network=host ${PTEST_LOCATION}/parallel-container - if [ "$(docker images -q parallel-container:latest)" = "" ]; then - echo "Failed to build parallel-container" - exit 77 - fi +CPUS=`nproc --all` +if [ $CPUS -lt 2 ]; then + echo "ERROR: the containerized hackbench test requires a system with at least 2 CPUs" + echo "SKIP: test_kernel_hackbench_containerized" + exit 77 fi # Start background scheduler load -echo "Starting hackbench load..." -LOAD_CONT=$(docker run -d --privileged -v ${PTEST_LOCATION}:/ptests -t parallel-container \ - bash run_hackbench.sh) - -# Run cyclictest -echo "Running cyclictest in docker container..." -RESULT=$(docker run --privileged --network=host \ - -v ${LOG_DIR}:${LOG_DIR} -v ${PTEST_LOCATION}:/ptests -v /home/admin:/home/admin \ - -v /usr/share/fw_printenv:/usr/share/fw_printenv -v /sbin/fw_printenv:/sbin/fw_printenv \ - -v /usr/share/nisysinfo:/usr/share/nisysinfo -v /dev:/dev \ - -t cyclictest-container \ - bash call_run_ct.sh "hackbench_containerized" \ - | tr -d '\r' | tr -d '\n') +LOAD_CONT=$(docker run -d --privileged --network=host \ + -v ${LOG_DIR}:${LOG_DIR} \ + -v ${TEST_DIR}:${TEST_DIR} \ + -v /home/admin:/home/admin \ + -t parallel-container) +docker exec -d $LOAD_CONT "$TEST_DIR/hackbench-load" "start" -# Clean up the background container -docker exec ${LOAD_CONT} \ - bash -c "killall -INT hackbench > /dev/null 2>&1" +# Run cyclictest containers on the last 2 CPUs on the system + +"$TEST_DIR/run-docker-cyclictest" "hackbench_containerized_container_1" $((CPUS - 1)) & +PID1=$! + +"$TEST_DIR/run-docker-cyclictest" "hackbench_containerized_container_2" $((CPUS - 2)) +CYCLICTEST_RESULT_2=$? -echo "Test Result: ${RESULT}" -exit ${RESULT} +# Wait for first cyclictest to finish +wait $PID1 +CYCLICTEST_RESULT_1=$? + +# Aggregate results from both cyclictests +CYCLICTEST_RESULT=$(( $CYCLICTEST_RESULT_1 + $CYCLICTEST_RESULT_2 )) + +# Clean up the background container +docker exec $LOAD_CONT "$TEST_DIR/hackbench-load" "stop" +docker stop $LOAD_CONT +exit $CYCLICTEST_RESULT diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_idle_containerized.sh b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_idle_containerized.sh index 0c2a87352..7e4f26b3e 100644 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_idle_containerized.sh +++ b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_idle_containerized.sh @@ -1,29 +1,7 @@ #!/bin/bash - -PTEST_LOCATION=/usr/lib/kernel-containerized-performance-tests/ptest -LOG_DIR="/var/local/ptest-results/kernel-containerized-performance-tests" - -# Build the two containers -if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then - echo "Building cyclictest-container..." - DOCKER_BUILDKIT=1 \ - docker build -t cyclictest-container --network=host ${PTEST_LOCATION}/cyclictest-container - if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then - echo "Failed to build cyclictest-container" - exit 77 - fi -fi +source "$(dirname "$0")"/common.cfg # Run cyclictest -echo "Running cyclictest in docker container..." -RESULT=$(docker run --privileged --network=host \ - -v ${LOG_DIR}:${LOG_DIR} -v ${PTEST_LOCATION}:/ptests -v /home/admin:/home/admin \ - -v /usr/share/fw_printenv:/usr/share/fw_printenv -v /sbin/fw_printenv:/sbin/fw_printenv \ - -v /usr/share/nisysinfo:/usr/share/nisysinfo -v /dev:/dev \ - -t cyclictest-container \ - bash call_run_ct.sh "idle_containerized" \ - | tr -d '\r' | tr -d '\n') - -echo "Test result: ${RESULT}" -exit ${RESULT} +"$TEST_DIR/run-docker-cyclictest" "idle_containerized" +exit $CYCLICTEST_RESULT diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_iperf_containerized.sh b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_iperf_containerized.sh index 8b26264af..fdb5403c6 100644 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_iperf_containerized.sh +++ b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests-files/test_kernel_cyclictest_iperf_containerized.sh @@ -1,63 +1,20 @@ #!/bin/bash - -PTEST_LOCATION=/usr/lib/kernel-containerized-performance-tests/ptest - -source /home/admin/.iperf.info -if [ -z "$IPERF_SERVER" ]; then - echo "Warning: iperf server not configured; skipping iperf based network load test." - echo "Create/edit /home/admin/.iperf.info file with IPERF_SERVER= and IPERF_PORT= to configure a server to connect to for this test." - echo "SKIP: test_kernel_cyclictest_iperf_containerized" - exit 77 -fi -if [ ! -z "$IPERF_PORT" ]; then - iperf3 -c "$IPERF_SERVER" -p "$IPERF_PORT" -t 1 > /dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ERROR: iperf server not reachable; skipping iperf based network load test." - echo "SKIP: test_kernel_cyclictest_iperf_containerized" - exit 77 - fi -fi - -# Build the two containers -if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then - echo "Building cyclictest-container..." - DOCKER_BUILDKIT=1 \ - docker build -t cyclictest-container --network=host ${PTEST_LOCATION}/cyclictest-container - if [ "$(docker images -q cyclictest-container:latest)" = "" ]; then - echo "Failed to build cyclictest-container" - exit 77 - fi -fi -if [ "$(docker images -q parallel-container:latest)" = "" ]; then - echo "Building parallel-container..." - DOCKER_BUILDKIT=1 \ - docker build -t parallel-container --network=host ${PTEST_LOCATION}/parallel-container - if [ "$(docker images -q parallel-container:latest)" = "" ]; then - echo "Failed to build parallel-container" - exit 77 - fi -fi +source "$(dirname "$0")"/common.cfg # Start background network load -echo "Starting iperf load..." -LOAD_CONT=$(docker run -d --privileged \ - -v ${PTEST_LOCATION}:/ptests -v /home/admin:/home/admin --network=host \ - -t parallel-container bash run_iperf.sh) +LOAD_CONT=$(docker run -d --privileged --network=host \ + -v ${LOG_DIR}:${LOG_DIR} \ + -v ${TEST_DIR}:${TEST_DIR} \ + -v /home/admin:/home/admin \ + -t parallel-container) +docker exec $LOAD_CONT "$TEST_DIR/iperf-load" "check" || exit $? +docker exec -d $LOAD_CONT "$TEST_DIR/iperf-load" "start" # Run cyclictest -echo "Running cyclictest in docker container..." -RESULT=$(docker run --privileged --network=host \ - -v ${LOG_DIR}:${LOG_DIR} -v ${PTEST_LOCATION}:/ptests -v /home/admin:/home/admin \ - -v /usr/share/fw_printenv:/usr/share/fw_printenv -v /sbin/fw_printenv:/sbin/fw_printenv \ - -v /usr/share/nisysinfo:/usr/share/nisysinfo -v /dev:/dev \ - -t cyclictest-container \ - bash call_run_ct.sh "iperf_containerized" \ - | tr -d '\r' | tr -d '\n') +"$TEST_DIR/run-docker-cyclictest" "iperf_containerized" # Clean up the background container -docker exec ${LOAD_CONT} \ - bash -c "killall -INT iperf3 > /dev/null 2>&1" - -echo "Test result: ${RESULT}" -exit ${RESULT} +docker exec $LOAD_CONT "$TEST_DIR/iperf-load" "stop" +docker stop $LOAD_CONT +exit $CYCLICTEST_RESULT diff --git a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests.bb b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests.bb index 58828e18f..6dd29bcb2 100644 --- a/recipes-kernel/kernel-tests/kernel-containerized-performance-tests.bb +++ b/recipes-kernel/kernel-tests/kernel-containerized-performance-tests.bb @@ -11,56 +11,52 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-files:" S = "${WORKDIR}" DEPENDS = "virtual/kernel" -RDEPENDS:${PN}-ptest += "bash rt-tests fio iperf3 python3 python3-pip docker-ce" +RDEPENDS:${PN}-ptest += "bash python3 docker" RDEPENDS:${PN}-ptest:append:x64 = " fw-printenv" RDEPENDS:${PN}-ptest:append:armv7a = " u-boot-fw-utils" ALLOW_EMPTY:${PN} = "1" SRC_URI += "\ + file://build-containers \ file://run-ptest \ file://run-cyclictest \ + file://run-docker-cyclictest \ file://upload_cyclictest_results.py \ file://common.cfg \ file://fio.cfg \ + file://fio-load \ + file://hackbench-load \ + file://iperf-load \ file://test_kernel_cyclictest_idle_containerized.sh \ file://test_kernel_cyclictest_hackbench_containerized.sh \ file://test_kernel_cyclictest_fio_containerized.sh \ file://test_kernel_cyclictest_iperf_containerized.sh \ file://cyclictest-container/Dockerfile \ - file://cyclictest-container/call_run_ct.sh \ file://parallel-container/Dockerfile \ - file://parallel-container/run_hackbench.sh \ - file://parallel-container/run_fio.sh \ - file://parallel-container/run_iperf.sh \ " do_install_ptest:append() { + install -m 0755 ${S}/build-containers ${D}${PTEST_PATH} install -m 0755 ${S}/run-ptest ${D}${PTEST_PATH} install -m 0755 ${S}/run-cyclictest ${D}${PTEST_PATH} + install -m 0755 ${S}/run-docker-cyclictest ${D}${PTEST_PATH} install -m 0755 ${S}/upload_cyclictest_results.py ${D}${PTEST_PATH} install -m 0644 ${S}/common.cfg ${D}${PTEST_PATH} install -m 0644 ${S}/fio.cfg ${D}${PTEST_PATH} + install -m 0755 ${S}/fio-load ${D}${PTEST_PATH} + install -m 0755 ${S}/hackbench-load ${D}${PTEST_PATH} + install -m 0755 ${S}/iperf-load ${D}${PTEST_PATH} install -m 0755 ${S}/test_kernel_cyclictest_idle_containerized.sh ${D}${PTEST_PATH} install -m 0755 ${S}/test_kernel_cyclictest_hackbench_containerized.sh ${D}${PTEST_PATH} install -m 0755 ${S}/test_kernel_cyclictest_fio_containerized.sh ${D}${PTEST_PATH} install -m 0755 ${S}/test_kernel_cyclictest_iperf_containerized.sh ${D}${PTEST_PATH} + mkdir -p ${D}${PTEST_PATH}/cyclictest-container - install -m 0755 ${S}/cyclictest-container/Dockerfile ${D}${PTEST_PATH}/cyclictest-container - install -m 0755 ${S}/cyclictest-container/call_run_ct.sh \ - ${D}${PTEST_PATH}/cyclictest-container/call_run_ct.sh - mkdir -p ${D}${PTEST_PATH}/parallel-container - install -m 0755 ${S}/parallel-container/Dockerfile ${D}${PTEST_PATH}/parallel-container - install -m 0755 ${S}/parallel-container/run_hackbench.sh \ - ${D}${PTEST_PATH}/parallel-container/run_hackbench.sh - install -m 0755 ${S}/parallel-container/run_fio.sh \ - ${D}${PTEST_PATH}/parallel-container/run_fio.sh - install -m 0755 ${S}/parallel-container/run_iperf.sh \ - ${D}${PTEST_PATH}/parallel-container/run_iperf.sh -} + install -m 0644 ${S}/cyclictest-container/Dockerfile ${D}${PTEST_PATH}/cyclictest-container -pkg_postinst_ontarget:${PN}-ptest:append() { - python3 -m pip install influxdb + mkdir -p ${D}${PTEST_PATH}/parallel-container + install -m 0644 ${S}/parallel-container/Dockerfile ${D}${PTEST_PATH}/parallel-container } PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/recipes-kernel/kernel-tests/kernel-performance-tests-files/common.cfg b/recipes-kernel/kernel-tests/kernel-performance-tests-files/common.cfg deleted file mode 100644 index 324119a36..000000000 --- a/recipes-kernel/kernel-tests/kernel-performance-tests-files/common.cfg +++ /dev/null @@ -1,9 +0,0 @@ -# Common configuration for all kernel performance tests -TEST_DURATION=8h - -# Maximum expected latency in useconds. -# The test will fail if cyclictest latency goes beyond this value. -MAX_LATENCY=300 - -# Location for benchmark logs and test results -LOG_DIR="/var/local/ptest-results/kernel-performance-tests" diff --git a/recipes-kernel/kernel-tests/kernel-performance-tests-files/run-container-load b/recipes-kernel/kernel-tests/kernel-performance-tests-files/run-container-load new file mode 100644 index 000000000..8904ee498 --- /dev/null +++ b/recipes-kernel/kernel-tests/kernel-performance-tests-files/run-container-load @@ -0,0 +1,14 @@ +#!/bin/bash + +function setup_container_load() +{ + docker pull hello-world +} + +function start_container_load() +{ + while true; do + docker run hello-world > /dev/null + docker container prune -f > /dev/null + done +} diff --git a/recipes-kernel/kernel-tests/kernel-performance-tests-files/run-cyclictest b/recipes-kernel/kernel-tests/kernel-performance-tests-files/run-cyclictest deleted file mode 100644 index 4d11def15..000000000 --- a/recipes-kernel/kernel-tests/kernel-performance-tests-files/run-cyclictest +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -source ./common.cfg - -function add_system_info() -{ - { - DESC=$(fw_printenv DeviceDesc) - DEVICE=${DESC#*=} - echo "# Device: $DEVICE" - - echo -n "# Kernel: " - uname -a - - echo -n "# Kernel parameters: " - cat /proc/cmdline - - # save info on the current security mitigations - echo "# Security vulnerabilities settings: " - if [ -d "/sys/devices/system/cpu/vulnerabilities" ]; then - for f in /sys/devices/system/cpu/vulnerabilities/*; do - VULN=$(basename "$f") - if [ -f "$f" ]; then - echo -n -e "# $VULN:\t" - cat "$f" - fi - done - else - echo "# vulnerability information not published" - fi - - # save info on the current C state settings - echo "# C-states settings: " - for CPU in /sys/devices/system/cpu/cpu[0-9]; do - NCPU=$(basename "$CPU") - echo "# [$NCPU]" - for CSTATE in $CPU/cpuidle/state[0-9]; do - NSTATE=$(basename "$CSTATE") - if [ -f "$CSTATE/name" ] && [ -f "$CSTATE/disable" ]; then - NAME=$(cat "$CSTATE/name" 2>/dev/null) - STATUS=$(cat "$CSTATE/disable" 2>/dev/null) - - echo -n "# $NSTATE: $NAME: " - if [ "$STATUS" = "0" ]; then - echo "enabled" - else - echo "disabled" - fi - else - echo "# information not available" - fi - done - done - } >> "$1" -} - -function run_cyclictest() -{ - LOG="$LOG_DIR/cyclictest-$1-`date +'%Y_%m_%d-%H_%M_%S'`.log" - INFLUXDB_INFO="/home/admin/.influxdb.info" - cyclictest --smp --priority=98 --mlockall --interval=997 --quiet --duration="$TEST_DURATION" --histofall=1000 --histfile="$LOG" > /dev/null - add_system_info "$LOG" - if [[ -f "$INFLUXDB_INFO" ]]; then - source "$INFLUXDB_INFO" - python3 upload_cyclictest_results.py "-i $LOG" "-s $INFLUXDB_SERVER" "-p $INFLUXDB_PORT" - else - echo "INFO: No InfluxDB Connection Info. Results will not be published." - fi - - LATENCY=$(grep -sw "# Max Latencies:" "$LOG" | awk '{max=$4; for(i=4; i<=NF; i++) if ($i>max) max=$i; gsub("^0*", "", max); print max}') - if [ "$LATENCY" -le "$MAX_LATENCY" ]; then - echo "cyclictest with $1 load latency: $LATENCY (usec) is less than max latency: $MAX_LATENCY (usec)" - echo "histogram log file: $LOG" - echo "PASS: test_kernel_cyclictest_$1" - CYCLICTEST_RESULT=0 - else - echo "cyclictest with $1 load latency: $LATENCY (usec) is above the expected max latency: $MAX_LATENCY (usec)" - echo "histogram log file: $LOG" - echo "FAIL: test_kernel_cyclictest_$1" - CYCLICTEST_RESULT=1 - fi -} - -mkdir -p "$LOG_DIR" diff --git a/recipes-kernel/kernel-tests/kernel-performance-tests-files/run-ptest b/recipes-kernel/kernel-tests/kernel-performance-tests-files/run-ptest index 0b17a3bdb..4ee102807 100644 --- a/recipes-kernel/kernel-tests/kernel-performance-tests-files/run-ptest +++ b/recipes-kernel/kernel-tests/kernel-performance-tests-files/run-ptest @@ -4,4 +4,5 @@ ./test_kernel_cyclictest_hackbench.sh ./test_kernel_cyclictest_fio.sh ./test_kernel_cyclictest_iperf.sh +./test_kernel_cyclictest_container_load.sh exit 0 diff --git a/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_container_load.sh b/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_container_load.sh new file mode 100644 index 000000000..9b2883104 --- /dev/null +++ b/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_container_load.sh @@ -0,0 +1,15 @@ +#!/bin/bash +source ./run-cyclictest +source ./run-container-load + +# start background container load +setup_container_load +start_container_load & + +# measure the system latency under container load +run_cyclictest "container" + +# clean-up +kill $(jobs -p) 2>/dev/null + +exit $CYCLICTEST_RESULT diff --git a/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_fio.sh b/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_fio.sh index d80cca94f..438a3924b 100644 --- a/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_fio.sh +++ b/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_fio.sh @@ -2,14 +2,12 @@ source ./run-cyclictest # start background disk I/O load -mkdir -p /var/cache/fio -fio fio.cfg --ioengine="sync" --runtime="$TEST_DURATION" --ramp_time=1m --output="$LOG_DIR/fio-sync-`date +'%Y_%m_%d-%H_%M_%S'`.log" > /dev/null & +./fio-load start # measure the system latency under disk load run_cyclictest "fio" # clean-up -killall -INT fio > /dev/null 2>&1 -rm -rf /var/cache/fio +./fio-load stop exit $CYCLICTEST_RESULT diff --git a/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_hackbench.sh b/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_hackbench.sh index 856334643..19668a725 100644 --- a/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_hackbench.sh +++ b/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_hackbench.sh @@ -2,12 +2,12 @@ source ./run-cyclictest # start background scheduler load -hackbench -l 36000000 -g 10 2>/dev/null >"$LOG_DIR/hackbench-`date +'%Y_%m_%d-%H_%M_%S'`.log" & +./hackbench-load start # measure the system latency under scheduler load run_cyclictest "hackbench" # clean-up -killall -INT hackbench > /dev/null 2>&1 +./hackbench-load stop exit $CYCLICTEST_RESULT diff --git a/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_iperf.sh b/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_iperf.sh index 75c313e86..fee98420e 100644 --- a/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_iperf.sh +++ b/recipes-kernel/kernel-tests/kernel-performance-tests-files/test_kernel_cyclictest_iperf.sh @@ -1,31 +1,12 @@ #!/bin/bash source ./run-cyclictest -# start background network load -source /home/admin/.iperf.info -if [ -z "$IPERF_SERVER" ]; then - echo "Warning: iperf server not configured; skipping iperf based network load test." - echo "Create/edit /home/admin/.iperf.info file with IPERF_SERVER= and IPERF_PORT= to configure a server to connect to for this test." - echo "SKIP: test_kernel_cyclictest_iperf" - exit 77 -fi - -if [ ! -z "$IPERF_PORT" ]; then - iperf3 -c "$IPERF_SERVER" -p "$IPERF_PORT" -t 1 > /dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "ERROR: iperf server not reachable; skipping iperf based network load test." - echo "SKIP: test_kernel_cyclictest_iperf" - exit 77 - fi - iperf3 -c "$IPERF_SERVER" -p "$IPERF_PORT" -t 36000 --logfile "$LOG_DIR/iperf-`date +'%Y_%m_%d-%H_%M_%S'`.log" & -else - iperf3 -c "$IPERF_SERVER" -t 36000 --logfile "$LOG_DIR/iperf-`date +'%Y_%m_%d-%H_%M_%S'`.log" & -fi +./iperf-load check || exit $? +./iperf-load start # measure the system latency under network load run_cyclictest "iperf" -# clean-up -killall -INT iperf3 > /dev/null 2>&1 +./iperf-load stop exit $CYCLICTEST_RESULT diff --git a/recipes-kernel/kernel-tests/kernel-performance-tests-files/upload_cyclictest_results.py b/recipes-kernel/kernel-tests/kernel-performance-tests-files/upload_cyclictest_results.py deleted file mode 100755 index f46d83563..000000000 --- a/recipes-kernel/kernel-tests/kernel-performance-tests-files/upload_cyclictest_results.py +++ /dev/null @@ -1,217 +0,0 @@ -#!/usr/bin/env python3 -"""Script for uploading a cyclictest log to influxdb""" - -import argparse -import logging -import mmap -import re -import subprocess -import sys -from pathlib import Path -from datetime import datetime -from influxdb import InfluxDBClient, exceptions -import requests.exceptions - - -def get_current_kernel_version(): - """Get the kernel version currently running on the system""" - try: - process = subprocess.run(['uname', '-r'], - check=True, - stdout=subprocess.PIPE) - kver_full = process.stdout.strip().decode("utf-8") - rgx = re.search(r'([0-9]+\.[0-9]+)\.([0-9]+)', kver_full) - kver = rgx.group(1) - except (FileNotFoundError, AttributeError): - logging.warning("failed to read the current kernel version") - raise - - return kver, kver_full - - -def get_kernel_version(path): - """Get the kernel version used in cyclictest test - - Read 'major.minor' and 'major.minor.patch-rt' kernel version strings from - cyclictest log if found or current running system otherwise. - - """ - try: - with open(path, 'rb', 0) as file, \ - mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as mfile: - kernel = re.search(br'# Kernel: Linux ([^ ]+) ([0-9]+)\.([0-9]+)\.' - br'([0-9]+-rc[0-9]+-rt[0-9]+|[0-9]+-rt[0-9]+)', - mfile) - # ignore build machine name, i.e. group(1) - major = kernel.group(2).decode() - minor = kernel.group(3).decode() - patch = kernel.group(4).decode() - version = major + '.' + minor - full_version = version + '.' + patch - except (ValueError, AttributeError): - logging.warning('kernel version information missing from \'%s\' ' - 'retriving from current system.', path) - version, full_version = get_current_kernel_version() - return version, full_version - - -def get_current_device(): - """Get the device description for the current system (e.g. cRIO-90xx)""" - try: - process = subprocess.run(['fw_printenv', 'DeviceDesc'], - check=True, - stdout=subprocess.PIPE) - dev_str = process.stdout.strip().decode("utf-8") - dev = dev_str.split('=')[-1] - except FileNotFoundError: - logging.warning("failed to read the current device type") - raise - - return dev - - -def get_device(path): - """Get the device name used in cyclictest test - - Read the device name stored in the cyclictest log file or if not available - retrieve the current device name. - - """ - try: - with open(path, 'rb', 0) as file, \ - mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as mfile: - rgx = re.search(br'# Device: ([a-zA-z]+-[0-9]+)', mfile) - device = rgx.group(1).decode() - except (ValueError, AttributeError): - logging.warning('device information missing from \'%s\' ' - 'retriving from current system.', path) - device = get_current_device() - return device - - -def get_test_params(path): - """Get the test name and datetime - - Extract the test name and date/time from cyclictest log name. - - """ - try: - rgx = re.search(r'[^_]*cyclictest-([^-]+)-([^-]+)-([^\.]+).log', - path.name) - test = rgx.group(1) - date = rgx.group(2).replace('_', '-') - time = rgx.group(3).replace('_', ':') - date_time = datetime.fromisoformat(date + ' ' + time) - except AttributeError: - logging.warning('failed to parse test parameters ' - '(i.e. test name, date, time)') - raise - - return test, date_time - - -def get_test_results(path): - """Extract min, avg, max latency from cyclictest log""" - try: - with open(path, 'rb', 0) as file, \ - mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as mfile: - rgx = re.search(br'# Max Latencies: ([^\n]+)', mfile) - max_list = list(map(int, rgx.group(1).decode().split())) - max_latency = max_list[-1] - - rgx = re.search(br'# Min Latencies: ([^\n]+)', mfile) - min_list = list(map(int, rgx.group(1).decode().split())) - min_latency = min(min_list) - - rgx = re.search(br'# Avg Latencies: ([^\n]+)', mfile) - avg_list = list(map(int, rgx.group(1).decode().split())) - avg_latency = sum(avg_list) / len(avg_list) - except (ValueError, AttributeError): - logging.warning("failed to parse test results") - raise - - return min_latency, avg_latency, max_latency - -def get_distro_info(): - """Extract distro version and codename from os-release and return them as a tuple - - Returns 'unknown' for either in case of file read exception or missing fields. - - """ - os_release_stmts = [] - try: - with open('/etc/os-release') as os_release_file: - os_release_stmts = os_release_file.readlines() - except: - return ('unknown', 'unknown') - pairs = dict(map(lambda e: e.split('='), os_release_stmts)) - version = pairs.get('VERSION_ID', 'unknown').strip() - name = pairs.get('DISTRO_CODENAME', 'unknown').strip()[1:-1] - return (version, name) - -def read_data(path): - """Read test data and metadata from a cyclictest log file""" - version, full_version = get_kernel_version(path) - controller = get_device(path) - test, time = get_test_params(path) - min_latency, avg_latency, max_latency = get_test_results(path) - distro_version, distro_name = get_distro_info() - - data = { - "measurement": "latency", - "tags": { - "controller": controller, - "test": test, - "kernel_version": version, - "kernel_full_version": full_version, - "distro_version": distro_version, - "distro_name": distro_name - }, - "fields": { - "min_latency": float(min_latency), - "avg_latency": float(avg_latency), - "max_latency": float(max_latency), - }, - "time": time - } - return data - - -def upload_results(data, server, server_port): - """Upload results to influxdb instance""" - try: - influxdb = InfluxDBClient(host=server, port=server_port) - influxdb.switch_database("rtos_kernel_performance") - if not influxdb.write_points(data): - logging.warning("failed to write data points to influxdb") - influxdb.close() - except (exceptions.InfluxDBClientError, - requests.exceptions.ConnectionError) as err: - logging.warning('influxdb error: %s', err) - - -parser = argparse.ArgumentParser( - description="Parse and upload cyclictest results.") -parser.add_argument("-i", "--input", required=True, - help="cyclictest log input file") -parser.add_argument("-s", "--server", required=True, - help="influxdb server") -parser.add_argument("-p", "--port", type=int, default=8086, - help="influxdb server port") -args = parser.parse_args() - -log_file = Path(args.input.strip()) -if not log_file.is_file(): - logging.error('input file %s does not exist!', log_file) - sys.exit(1) - -try: - result = read_data(log_file) -except (FileNotFoundError, AttributeError, ValueError): - logging.error('skipping malformed or incomplete test results at: %s', - log_file) - sys.exit(1) - -results = [] -results.append(result) -upload_results(results, args.server.strip(), args.port) diff --git a/recipes-kernel/kernel-tests/kernel-performance-tests.bb b/recipes-kernel/kernel-tests/kernel-performance-tests.bb index 5c5858249..9bc2dd998 100644 --- a/recipes-kernel/kernel-tests/kernel-performance-tests.bb +++ b/recipes-kernel/kernel-tests/kernel-performance-tests.bb @@ -11,7 +11,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-files:" S = "${WORKDIR}" DEPENDS = "virtual/kernel" -RDEPENDS:${PN}-ptest += "bash rt-tests fio iperf3 python3 python3-pip" +RDEPENDS:${PN}-ptest += "bash rt-tests fio iperf3 python3 python3-pip docker" RDEPENDS:${PN}-ptest:append:x64 = " fw-printenv" RDEPENDS:${PN}-ptest:append:armv7a = " u-boot-fw-utils" @@ -23,10 +23,15 @@ SRC_URI += "\ file://upload_cyclictest_results.py \ file://common.cfg \ file://fio.cfg \ + file://fio-load \ + file://hackbench-load \ + file://iperf-load \ file://test_kernel_cyclictest_idle.sh \ file://test_kernel_cyclictest_hackbench.sh \ file://test_kernel_cyclictest_fio.sh \ file://test_kernel_cyclictest_iperf.sh \ + file://run-container-load \ + file://test_kernel_cyclictest_container_load.sh \ " do_install_ptest:append() { @@ -35,10 +40,15 @@ do_install_ptest:append() { install -m 0755 ${S}/upload_cyclictest_results.py ${D}${PTEST_PATH} install -m 0644 ${S}/common.cfg ${D}${PTEST_PATH} install -m 0644 ${S}/fio.cfg ${D}${PTEST_PATH} + install -m 0755 ${S}/fio-load ${D}${PTEST_PATH} + install -m 0755 ${S}/hackbench-load ${D}${PTEST_PATH} + install -m 0755 ${S}/iperf-load ${D}${PTEST_PATH} install -m 0755 ${S}/test_kernel_cyclictest_idle.sh ${D}${PTEST_PATH} install -m 0755 ${S}/test_kernel_cyclictest_hackbench.sh ${D}${PTEST_PATH} install -m 0755 ${S}/test_kernel_cyclictest_fio.sh ${D}${PTEST_PATH} install -m 0755 ${S}/test_kernel_cyclictest_iperf.sh ${D}${PTEST_PATH} + install -m 0755 ${S}/run-container-load ${D}${PTEST_PATH} + install -m 0755 ${S}/test_kernel_cyclictest_container_load.sh ${D}${PTEST_PATH} } pkg_postinst_ontarget:${PN}-ptest:append() { diff --git a/recipes-kernel/kernel-tests/kernel-test-nohz-files/PXIe-8880.conf b/recipes-kernel/kernel-tests/kernel-test-nohz-files/PXIe-8880.conf index 5d026e0fe..5c533e6ac 100644 --- a/recipes-kernel/kernel-tests/kernel-test-nohz-files/PXIe-8880.conf +++ b/recipes-kernel/kernel-tests/kernel-test-nohz-files/PXIe-8880.conf @@ -1,3 +1,3 @@ -MAX_LATENCY=6000 +MAX_LATENCY=8000 P3NINES=250 P4NINES=3000 diff --git a/recipes-kernel/kernel-tests/kernel-test-nohz-files/PXIe-8881.conf b/recipes-kernel/kernel-tests/kernel-test-nohz-files/PXIe-8881.conf index 666dda5d7..145ad3e26 100644 --- a/recipes-kernel/kernel-tests/kernel-test-nohz-files/PXIe-8881.conf +++ b/recipes-kernel/kernel-tests/kernel-test-nohz-files/PXIe-8881.conf @@ -1,3 +1,3 @@ -MAX_LATENCY=22000 +MAX_LATENCY=27000 P3NINES=300 -P4NINES=10000 +P4NINES=16000 diff --git a/recipes-kernel/kernel-tests/kernel-test-nohz-files/nohz_test.c b/recipes-kernel/kernel-tests/kernel-test-nohz-files/nohz_test.c index 61b18269e..c89c4b259 100644 --- a/recipes-kernel/kernel-tests/kernel-test-nohz-files/nohz_test.c +++ b/recipes-kernel/kernel-tests/kernel-test-nohz-files/nohz_test.c @@ -20,7 +20,7 @@ #include #include -#define TEST_PRIO 98 +#define TEST_PRIO 1 #define NSEC_PER_USEC 1000ULL #define NSEC_PER_SEC 1000000000ULL @@ -420,7 +420,7 @@ static void validate_results(struct histogram_data *h) p_99_999 = get_percentile(99.999, h); p_99_9999 = get_percentile(99.9999, h); - if (h->max > max_latency) + if (h->max >= max_latency) error_exit("Maximum latency exceeded", stats_summary, h->cnt, h->max, p_99_999, p_99_9999); if (p_99_999 > percentile_99_999) error_exit("99.999%% threshold exceeded", stats_summary, h->cnt, h->max, p_99_999, p_99_9999); diff --git a/recipes-kernel/kernel-tests/kernel-test-nohz.bb b/recipes-kernel/kernel-tests/kernel-test-nohz.bb index 350ffc5ee..b592c6345 100644 --- a/recipes-kernel/kernel-tests/kernel-test-nohz.bb +++ b/recipes-kernel/kernel-tests/kernel-test-nohz.bb @@ -40,7 +40,7 @@ pkg_postinst_ontarget:${PN}-ptest:append() { ISOLATED_CPU=$((CPUS - 1)) if [ $ISOLATED_CPU -gt 0 ]; then - echo 'set otherbootargs="${otherbootargs} isolcpus=nohz,domain,managed_irq,'$ISOLATED_CPU' nohz_full='$ISOLATED_CPU' mitigations=off intel_pstate=disable intel_idle.max_cstate=0 processor.max_cstate=0 nosoftlockup mce=ignore_ce audit=0 tsc=nowatchdog"' > /boot/runmode/no-hz-full-params.cfg + echo 'set otherbootargs="${otherbootargs} isolcpus=nohz,domain,managed_irq,'$ISOLATED_CPU' nohz_full='$ISOLATED_CPU' mitigations=off intel_pstate=disable intel_idle.max_cstate=0 processor.max_cstate=0 nosoftlockup mce=ignore_ce audit=0 tsc=reliable"' > /boot/runmode/no-hz-full-params.cfg grep -qsxF 'source /runmode/no-hz-full-params.cfg' /boot/runmode/bootimage.cfg || echo 'source /runmode/no-hz-full-params.cfg' >> /boot/runmode/bootimage.cfg else echo "[kernel-test-nohz:error] This test requires a system with 2 or more CPUs" diff --git a/recipes-kernel/kernel-tests/kernel-tests-files/kernel_dmesg_diff.py b/recipes-kernel/kernel-tests/kernel-tests-files/kernel_dmesg_diff.py index b48a0ae5d..c9ce412a5 100644 --- a/recipes-kernel/kernel-tests/kernel-tests-files/kernel_dmesg_diff.py +++ b/recipes-kernel/kernel-tests/kernel-tests-files/kernel_dmesg_diff.py @@ -61,13 +61,32 @@ def __init__(self, versionString): self.prerelease = version.group('prerelease') self.build_metadata = version.group('buildmetadata') +RELEASE_KERNEL_RC_VALUE = 999 + +def get_short_kernel_version(version_dict): + if version_dict['rc'] == RELEASE_KERNEL_RC_VALUE: + return "{}.{}.{}-rt{}".format(version_dict['major'], version_dict['minor'], version_dict['patch'], version_dict['rt_patch']) + else: + return "{}.{}.{}-rc{}-rt{}".format(version_dict['major'], version_dict['minor'], version_dict['patch'], version_dict['rc'], version_dict['rt_patch']) + class KernelVersion(SemanticVersion): - def __init__(self): - version =run_cmd(['uname', '-r']) + def __init__(self, versionString=None): + if versionString == None: + version = run_cmd(['uname', '-r']) + else: + version = versionString SemanticVersion.__init__(self, version) - self.type = 'next' if self.build_metadata else 'current' - prerelease_version = int(re.search(r'0|[1-9]\d*', self.prerelease).group()) - self.version_dict = { 'major': self.major, 'minor': self.minor, "patch": self.patch, 'prerelease': prerelease_version } + self.type = 'next' if 'next' in self.prerelease else 'current' + re_match = re.search(r'rc(0|[1-9]\d*)', self.prerelease) + if re_match: + self.rc = int(re_match.group(1)) + else: + # If no rcX value is present in the prerelease field of the kernel version string, then this should be a released kernel. + # Use 999 as the rc value in this case, as this value should be larger than any actual rcX value. This means that sorting + # by this field will correctly order a release version of a specific M.m.p version as higher than any actual rc version of M.m.p. + self.rc = RELEASE_KERNEL_RC_VALUE + self.rt_patch = int(re.search(r'rt(0|[1-9]\d*)', self.prerelease).group(1)) + self.version_dict = { 'major': self.major, 'minor': self.minor, 'patch': self.patch, 'rc': self.rc, 'rt_patch': self.rt_patch } class OsVersion: def __init__(self): @@ -83,14 +102,12 @@ def get_dmesg_log(): dmesg_log = run_cmd(['dmesg']) return dmesg_log -def upload_log(db, dmesg_log, logger): +def upload_log(db, dmesg_log, kernel_version, os_version, device_desc, logger): data = {} - kernel_version = KernelVersion() - os_version = OsVersion() data['kernel_version_full'] = kernel_version.full data['kernel_version'] = kernel_version.version_dict data['kernel_type'] = kernel_version.type - data['device_desc'] = get_device_desc() + data['device_desc'] = device_desc data['architecture'] = get_architecture() data['os_version'] = os_version.full data['os_version_major_minor'] = os_version.major_minor @@ -108,50 +125,66 @@ def upload_log(db, dmesg_log, logger): def strip_headers(dmesg_log): return ''.join(line + '\n' for line in dmesg_log.splitlines() if not line.startswith('#')) -def get_old_dmesg_log(db, logger): +def get_dmesg_record_by_date(db, date, logger): + query = {} + query['date'] = date + count = db.count_documents(query) + if count == 1: + results = db.find(query).limit(1) + result = next(results) + logger.log('INFO: Found dmesg record with date: {} with kernel version: {} and OS version: {}'.format(date, result['kernel_version_full'], result['os_version'])) + return result + elif count > 1: + logger.log('INFO: Found multiple dmesg records with the same date: {}'.format(date)) + return False + else: + logger.log('INFO: Could not find dmesg record with date: {}'.format(date)) + return False + +def get_previous_dmesg_record(db, kernel_version, os_version_major_minor, device_desc, logger): query = {} - kernel_version = KernelVersion() - os_version = OsVersion() query['kernel_version'] = { '$lt': kernel_version.version_dict } - query['device_desc'] = get_device_desc() - query['kernel_version.major'] = kernel_version.major - query['kernel_version.minor'] = kernel_version.minor - query['os_version_major_minor'] = os_version.major_minor + query['device_desc'] = device_desc + kernel_version_short = get_short_kernel_version(kernel_version.version_dict) if db.count_documents(query): - results = db.find(query).sort('date', pymongo.DESCENDING).limit(1) - else: - # If there are no results, there may not be a run from the current os version. - # Remove that requirement. - del query['os_version_major_minor'] - logger.log('INFO: No prior logs from this OS Version found. Using previous version.') - + # The goal of this test is to automate the identification of any dmesg differences due to a kernel upgrade, so they can be reviewed by a developer. + # Reviewing those differences is easier when the differences are small. This tends to be true when we diff between closer kernel versions. + # Therefore, this logic prefers the highest kernel version less than the kernel version under test, above all other factors. I'll refer to this as the DESIRED version. + # Some dmesg differences are due to a change in the OS rather than the kernel. We would like to reduce these differences, but not at the cost of increasing the differences between kernel versions. + # Therefore, if a record exists that matches against the DESIRED kernel version and a matching OS major.minor version, then we choose the most recently dated record that matches both. + # If no such record exists, then we simply choose the most recently dated record that matches against only the DESIRED kernel version. + results = db.find(query).sort('kernel_version', pymongo.DESCENDING).limit(1) + result = next(results) + previous_kernel_version = result['kernel_version'] + previous_kernel_version_short = get_short_kernel_version(previous_kernel_version) + query['kernel_version'] = { '$eq': previous_kernel_version } + logger.log('INFO: Most recent previous kernel version in database is {}.'.format(previous_kernel_version_short)) + + # If a record exists that also matches the OS major.minor version, then give preference to that in order to minimize differences due to non-kernel OS changes. Use the most recently dated matching record. + query['os_version_major_minor'] = os_version_major_minor if db.count_documents(query): results = db.find(query).sort('date', pymongo.DESCENDING).limit(1) else: - # If there still aren't any results matching the kernel major minor version, broaden the - # search but limit it to same kernel type - del query['kernel_version.major'] - del query['kernel_version.minor'] - query['kernel_type'] = kernel_version.type - - if db.count_documents(query): - results = db.find(query).sort('date', pymongo.DESCENDING).limit(1) - else: - # Keep this log in first line to help streak indexer group results. Diff hash will be populated at end. - logger.first_log('INFO: dmesg_diff: {} against , diff hash '.format(kernel_version.full)) - - logger.log('INFO: No suitable previous dmesg log found') - return '' + # If no record exists that also matches the OS major.minor version, then drop that requirement. Use the most recently dated matching record. + del query['os_version_major_minor'] + logger.log('INFO: No database record found for {} kernel version with OS version {}. Allowing other OS versions.'.format(previous_kernel_version_short, os_version_major_minor)) + assert db.count_documents(query), "Could not find previously located log record in database." + results = db.find(query).sort('date', pymongo.DESCENDING).limit(1) + else: + # Keep this log in first line to help streak indexer group results. Diff hash will be populated at end. + logger.first_log('INFO: dmesg_diff: {} against , diff hash '.format(kernel_version_short)) + logger.log('INFO: No suitable previous log found. The following query was used:') + logger.log('INFO: {}'.format(query)) + return False result = next(results) # Keep this log in first line to help streak indexer group results. Diff hash will be populated at end. - logger.first_log('INFO: dmesg_diff: {} against older log of {}, diff hash '.format(kernel_version.full, result['kernel_version_full'])) + logger.first_log('INFO: dmesg_diff: {} against {}, diff '.format(kernel_version_short, previous_kernel_version_short)) - logger.log('INFO: Using previous dmesg log of "{}" kernel {} from {} with _id {}'.format(result['kernel_type'], result['kernel_version_full'], result['date'], result['_id'])) - dmesg_log = result['dmesg_log'] - return strip_headers(dmesg_log) + logger.log('INFO: Using previous dmesg log of "{}" kernel {} from OS version {} dated {} with _id {}'.format(result['kernel_type'], result['kernel_version_full'], result['os_version'], result['date'], result['_id'])) + return result def strip_timestamps(log): return re.sub(r'^\[.+?\] ', '', log, flags=re.MULTILINE) @@ -181,9 +214,10 @@ def strip_timestamps(log): [r'NODE_DATA\(0\) allocated \[mem .*\]', 'NODE_DATA(0) allocated [mem ]'], [r'ACPI: SSDT 0x.*', 'ACPI: SSDT 0x'], [r'tsc: Refined TSC clocksource calibration: \d+.\d+ MHz', 'tsc: Refined TSC clocksource calibration: MHz'], - [r'software IO TLB: mapped mem .*', 'software IO TLB: mapped mem'], + [r'software IO TLB: mapped .*', 'software IO TLB: mapped mem'], [r'eth\d:', 'ethX:'], - [r'renamed from eth\d', 'renamed from ethX'] + [r'renamed from eth\d', 'renamed from ethX'], + [r'mounted filesystem [0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}', 'mounted filesystem xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'] ] def strip_known_differences(log): @@ -198,7 +232,7 @@ def prepare_log_for_diff(log): log.sort() return log -def diff_logs(current_log, old_log, logger): +def diff_logs(current_log, old_log, suppress_diff_output, logger): current_log = prepare_log_for_diff(current_log) old_log = prepare_log_for_diff(old_log) diff = list(difflib.unified_diff(old_log, current_log, n=0)) @@ -207,8 +241,11 @@ def diff_logs(current_log, old_log, logger): logger.logs[0] += hashlib.md5(''.join(diff).encode('utf-8')).hexdigest() logger.log('INFO: Starting diff') - for line in diff: - logger.log(line) + if suppress_diff_output: + logger.log('') + else: + for line in diff: + logger.log(line) logger.log('INFO: End of diff') return False @@ -223,18 +260,39 @@ def parse_args(): parser.add_argument('--server', required=True, help='Mongo server hostname') parser.add_argument('--user', required=True, help='Mongo server username') parser.add_argument('--password', required=True, help='Mongo server password') - + parser.add_argument('--current_log_db_date', metavar="", + help='Use this flag to supply a date string that will be used to locate a dmesg log in the database. That log will be used as the current dmesg log. '\ + 'Should be of the format "2023-03-30 15:32:43.203476". Date strings for previous dmesg logs can be found in the output of previous runs of this '\ + 'test or can be extracted from the Mongo database using a viewer tool like Compass. This flag also skips the upload of the dmesg record to the '\ + 'database, so the --skip_upload flag is not needed. This flag is useful for debugging issues with this test.') + parser.add_argument('--skip_upload', help='Skip upload of dmesg record to database. Useful when debugging.', action="store_true") + parser.add_argument('--suppress_diff_output', help='Reduces test output noise by removing the dmesg log diff from the output. Useful when debugging.', action="store_true") return parser.parse_args() logger = Logger() args = parse_args() db = DB(args.server, args.user, args.password) -old_dmesg_log = get_old_dmesg_log(db, logger) -dmesg_log = get_dmesg_log() -upload_log(db, dmesg_log, logger) +if args.current_log_db_date: + current_dmesg_record = get_dmesg_record_by_date(db, args.current_log_db_date, logger) + assert current_dmesg_record, "Could not find matching current log record from database." + current_dmesg_log = strip_headers(current_dmesg_record['dmesg_log']) + + previous_dmesg_record = get_previous_dmesg_record(db, KernelVersion(current_dmesg_record['kernel_version_full']), current_dmesg_record['os_version_major_minor'], current_dmesg_record['device_desc'], logger) +else: + current_dmesg_log = get_dmesg_log() + + kernel_version = KernelVersion() + os_version = OsVersion() + device_desc = get_device_desc() + previous_dmesg_record = get_previous_dmesg_record(db, kernel_version, os_version.major_minor, device_desc, logger) + +previous_dmesg_log = strip_headers(previous_dmesg_record['dmesg_log']) if previous_dmesg_record else '' + +if not args.current_log_db_date and not args.skip_upload: + upload_log(db, current_dmesg_log, kernel_version, os_version, device_desc, logger) -result = diff_logs(dmesg_log, old_dmesg_log, logger) +result = diff_logs(current_dmesg_log, previous_dmesg_log, args.suppress_diff_output, logger) logger.report() diff --git a/recipes-kernel/linux/linux-nilrt-next_git.bb b/recipes-kernel/linux/linux-nilrt-next_git.bb index 4f8c18f97..41f773111 100644 --- a/recipes-kernel/linux/linux-nilrt-next_git.bb +++ b/recipes-kernel/linux/linux-nilrt-next_git.bb @@ -1,6 +1,6 @@ DESCRIPTION = "NILRT linux kernel next development build" NI_RELEASE_VERSION = "master" -LINUX_VERSION = "6.1" +LINUX_VERSION = "6.6" LINUX_KERNEL_TYPE = "next" require linux-nilrt-alternate.inc diff --git a/recipes-kernel/linux/nilrt-nohz/README.nohz b/recipes-kernel/linux/nilrt-nohz/README.nohz index ae18c3447..749ac7ee7 100644 --- a/recipes-kernel/linux/nilrt-nohz/README.nohz +++ b/recipes-kernel/linux/nilrt-nohz/README.nohz @@ -92,6 +92,20 @@ Application Design Considerations echo 0 > "/sys/kernel/debug/tracing/tracing_on" + * Significant delays and freezes have been observed using the NOHZ kernel on + some early versions of the cRIO-9030 (Intel Atom E3825). These delays and + freezes are present only on older revisions of that processor, and appear + to be caused by the processor attempting to enter a lower power cstate. To + see your processor revision, examine the cpuinfo ("cat /proc/cpuinfo"). If + your processor is an E3825 with "stepping : 3", you can work around this + issue issue by adding either "idle=poll" or "intel_idle.max_cstate=1" to + the kernel command line. For example: + + fw_setenv othbootargs idle=poll + + This kernel command-line option may also result in higher performance for + some applications regardless of the processor being used. + Additional considerations for C applications: diff --git a/recipes-ni/docker-functional-tests/docker-functional-tests.bb b/recipes-ni/docker-functional-tests/docker-functional-tests.bb index 05877ff40..f679673bf 100644 --- a/recipes-ni/docker-functional-tests/docker-functional-tests.bb +++ b/recipes-ni/docker-functional-tests/docker-functional-tests.bb @@ -31,5 +31,5 @@ do_install_ptest:append() { } PACKAGE_ARCH = "${MACHINE_ARCH}" -RDEPENDS:${PN}-ptest += "bash docker-ce" +RDEPENDS:${PN}-ptest += "bash docker" diff --git a/recipes-ni/fw-printenv/files/fw_printenv b/recipes-ni/fw-printenv/files/fw_printenv index 7d8e8c598..4b9edcdde 100755 --- a/recipes-ni/fw-printenv/files/fw_printenv +++ b/recipes-ni/fw-printenv/files/fw_printenv @@ -23,6 +23,9 @@ File syntax example: In this case, var1 will be deleted, var2 and other_value will be set with the values passed. The value can contain any number of spaces. + +Variables defined in multiple places will have the +following preference order: BIOS -> EFI -> GRUB EOF } @@ -30,32 +33,15 @@ EOF #they will write the value of the "$1" variable name show_variable_grub(){ - if [ $# -eq 0 ] ; then - #show all variables - grub-editenv list - if [ $? -ne 0 ]; then - return 1 - fi - return 0 - else - set -o pipefail - value=$(grub-editenv - list | grep -- "$1=" | while read -r line; do - key=$(echo "$line" | cut -d "=" -f 1) - #if the $1 matches exactly the key, extract the value - if [ "$key" = "$1" ] ; then - value_tmp=$(echo "$line" | cut -d "=" -f 2-) - echo "$value_tmp" - break - fi - done) - if [ $? -ne 0 ]; then - return 1 - fi - if [[ $value ]]; then - return 0 - fi + set -o pipefail + value=$(grub-editenv - list | sed -n -e "/^$1=/p" | sed -e "s/$1=//") + if [ $? -ne 0 ]; then return 1 fi + if [[ $value ]]; then + return 0 + fi + return 1 } readonly_grub_variable() @@ -82,17 +68,7 @@ if [[ "$DISTRIB_ID" == "nilrt-nxg" ]] ; then fi show_variable_smbios(){ - # We show all variables when no args passed - if [ $# -eq 0 ]; then - if is_ni_bios || is_ni_device; then - for var in ${!smbios_funcs[@]}; do - echo ${var}=`${smbios_funcs[${var}]}` - done - fi - # else, return nothing and exit successfully - return 0 - fi - # Otherwise, return the value that was requested only on NI targets + # Return the value that was requested only on NI targets if is_ni_bios || is_ni_device; then if [ "${smbios_funcs[$1]}" ]; then value=`${smbios_funcs[$1]}` @@ -107,20 +83,7 @@ declare -A efi_funcs=( ["IsNILinuxRTBoot"]=get_set_nilrt_boot) show_variable_efi(){ - # We show all variables when no args passed - if [ $# -eq 0 ]; then - for var in ${!efi_funcs[@]}; do - local key=${var} - local val=`${efi_funcs[${var}]}` - - if [ -n "$val" ]; then - echo $key=$val - fi - done - # else, return nothing and exit successfully - return 0 - fi - # Otherwise, return the value that was requested only on NI targets + # Return the value that was requested only on NI targets if [ "${efi_funcs[$1]}" ]; then ${efi_funcs[$1]} >/dev/null return $? @@ -128,23 +91,36 @@ show_variable_efi(){ return 1 } +show_all_variables(){ + # Show all variables by compiling list of all available variables and + # printing individually (ensures that the same priority order is + # enforced as a single variable print case) + all_variables=$(grub-editenv - list | awk -F= '{print $1}') + # Add a newline since one is missing from the above command + all_variables+=$'\n' + for var in ${!smbios_funcs[@]}; do all_variables+=$var; all_variables+=$'\n'; done + for var in ${!efi_funcs[@]}; do all_variables+=$var; all_variables+=$'\n'; done + all_variables=$(echo $all_variables | tr " " "\n" | sort -u) + for var in $all_variables; do + var_name=$var + show_variable_smbios $var || show_variable_efi $var || show_variable_grub $var + if [ -n "$value" ]; then + echo $var_name=$value + fi + done +} + #wraps together smbios, efi and grub variable query show_variable(){ - if [ $# -eq 0 ]; then - #show all variables - show_variable_smbios && show_variable_efi && show_variable_grub - return $? + value="" + #check for single variable + if show_variable_smbios $1 || show_variable_efi $1 || show_variable_grub $1; then + (( n_opt )) || printf '%s=' "$var_name" + printf '%s\n' "$value" + return 0 else - value="" - #check for single variable - if show_variable_smbios $1 || show_variable_efi $1 || show_variable_grub $1; then - (( n_opt )) || printf '%s=' "$var_name" - printf '%s\n' "$value" - return 0 - else - echo "## Error: \"$var_name\" not defined " >&2 - exit 1 - fi + echo "## Error: \"$var_name\" not defined " >&2 + exit 1 fi } @@ -277,7 +253,7 @@ parse_opt $@ if (( ! is_setenv )) ; then if [ $# -eq 0 ] ; then # if no arguments, list the variables - show_variable || exit $? + show_all_variables || exit $? else #show all variables passed by name for var_name in $varnames diff --git a/recipes-ni/initscripts-nilrt/files/populateconfig b/recipes-ni/initscripts-nilrt/files/populateconfig index b11f481b2..a4c790c1e 100644 --- a/recipes-ni/initscripts-nilrt/files/populateconfig +++ b/recipes-ni/initscripts-nilrt/files/populateconfig @@ -54,7 +54,7 @@ then mkdir -p "/etc/natinst/share/certstore/server_certs" mkdir -p "/etc/natinst/share/certstore/temp" - if [ ! -x /var/local/natinst/certstore ]; then + if [ ! -x /var/local/natinst/certstore ] && [ -d /var/local/natinst ]; then ln -sf -T /etc/natinst/share/certstore /var/local/natinst/certstore fi diff --git a/recipes-ni/ni-base-system-image-tests/files/fs_permissions_diff.py b/recipes-ni/ni-base-system-image-tests/files/fs_permissions_diff.py index 9b04424e2..705783656 100644 --- a/recipes-ni/ni-base-system-image-tests/files/fs_permissions_diff.py +++ b/recipes-ni/ni-base-system-image-tests/files/fs_permissions_diff.py @@ -9,6 +9,7 @@ import subprocess import sys import fs_permissions_shared +import re class DB: mongo_db_name = 'rtos' @@ -32,13 +33,19 @@ def count_documents(self, query): return self.fs_permissions_collection.count_documents(query) class OsVersion: - def __init__(self): - with open('/etc/os-release', 'rb') as file, mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as mfile: - build_id = re.search(br'BUILD_ID=\"((\d+\.\d+).*)\"', mfile) - self.full = build_id.group(1).decode() - self.major_minor = build_id.group(2).decode() - codename = re.search(br'VERSION_CODENAME=\"(.*)\"', mfile) - self.codename = codename.group(1).decode() + def __init__(self, os_version_full=None, os_version_codename=None): + if os_version_full is not None: + self.full = os_version_full + major_minor_version = re.match(r'(\d+.\d+).*', self.full) + self.major_minor = major_minor_version.group(1) + self.codename = os_version_codename + else: + with open('/etc/os-release', 'rb') as file, mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as mfile: + build_id = re.search(br'BUILD_ID=\"((\d+\.\d+).*)\"', mfile) + self.full = build_id.group(1).decode() + self.major_minor = build_id.group(2).decode() + codename = re.search(br'VERSION_CODENAME=\"(.*)\"', mfile) + self.codename = codename.group(1).decode() decomposed_version = re.match(r'(\d+).(\d+).(\d+)([dabf])(\d+)', self.full) self.major = int(decomposed_version.group(1)) @@ -73,11 +80,10 @@ def get_fs_manifest(): return '\n'.join(sorted(fs_manifest.splitlines())) def log_version_info(logger, label, codename, full_version, date, db_id): - logger.log(f'INFO: {label} = {codename} {full_version} from {date} with _id {db_id}') + logger.log(f'INFO: {label: <7} = {codename} {full_version: <14} from {date} with _id {db_id}') -def upload_manifest(db, fs_manifest, logger): +def upload_manifest(db, fs_manifest, os_version, logger): data = {} - os_version = OsVersion() data['os_version_codename'] = os_version.codename data['os_version_full'] = os_version.full data['os_version'] = os_version.version_dict @@ -90,20 +96,31 @@ def upload_manifest(db, fs_manifest, logger): data['fs_permissions'] = header + fs_manifest record = db.insert(data) - - log_version_info( - logger, - 'current', - data['os_version_codename'], - data['os_version_full'], - data['date'], - record.inserted_id - ) + return data['date'], record.inserted_id def strip_headers(fs_manifest): return ''.join(line + '\n' for line in fs_manifest.splitlines() if not line.startswith('#')) -def get_old_fs_manifests(db, logger): +def get_previous_fs_manifest_as_current(db, previous_date, logger): + query = {} + query['date'] = previous_date + count = db.count_documents(query) + logger.log('!!!!! OVERRIDING CURRENT MANIFEST !!!!!'.format(count)) + if count == 1: + results = db.find(query).limit(1) + result = next(results) + logger.log(f'INFO: Found manifest with the specified date: {previous_date}') + return strip_headers(result['fs_permissions']), result['os_version_full'], result['os_version_codename'], result['date'], result['_id'] + elif count > 1: + logger.log(f'INFO: Found multiple manifests with the specified date ({previous_date})') + logger.report() + exit(1) + else: + logger.log(f'INFO: Could not find manifest with the specified date ({previous_date})') + logger.report() + exit(1) + +def get_old_fs_manifests(db, logger, os_version, basis_override): def run_query(label, query): nonlocal db nonlocal logger @@ -115,14 +132,15 @@ def run_query(label, query): else: # If there are no results, there must not be a run from the current os codename. # Remove that requirement. - del query['os_version_codename'] - logger.log('INFO: No prior fs permissions from this OS codename found. Relaxing that constraint.') + if 'os_version_codename' in query: + del query['os_version_codename'] + logger.log('INFO: No prior manifest from this OS codename found. Relaxing that constraint.') if db.count_documents(query): results = db.find(query).sort(sort_order).limit(1) else: - logger.log('INFO: No suitable previous fs permissions found') - return '', '' + logger.log('INFO: No suitable previous manifest found') + return '', '', '' result = next(results) @@ -135,11 +153,9 @@ def run_query(label, query): result['_id'] ) - return strip_headers(result['fs_permissions']), result['os_version_full'] - - os_version = OsVersion() + return strip_headers(result['fs_permissions']), result['os_version_full'], result['date'] - query_build = lambda build: { + query_version_build = lambda build: { 'os_version_codename': os_version.codename, 'os_version': { '$lt': { @@ -151,22 +167,62 @@ def run_query(label, query): } } - # The "basis" manifest is from the latest version with a lesser MAJOR.MINOR.PATCH - basis_manifest, basis_version = run_query('basis', query_build(0)) - # The "recent" manifest is from the latest version, likely the last run with the same MAJOR.MINOR.PATCH - recent_manifest, recent_version = run_query('recent', query_build(os_version.build)) + query_date_build = lambda date: { + 'date': date + } + + if basis_override is not None: + logger.log(f'INFO: Basis manifest was specified to have date: {basis_override}') + basis_manifest, basis_version_full, basis_date = run_query('basis', query_date_build(basis_override)) + else: + # If not specified, the "basis" manifest is the most recent version with a lesser MAJOR.MINOR.PATCH than the current manifest. + # In general, it should be the last final build of the previous MAJOR.MINOR.PATCH version. + basis_manifest, basis_version_full, basis_date = run_query('basis', query_version_build(0)) + + # If the current version and basis version are the same (most likely scenario is if basis version is pinned to the most recent build available), + # then just set recent to the same version as well. The normal mechanism of querying for the most recent MAJOR.MINOR.PATCH.BUILD less than the + # current version is going to result in a recent version that is *older* than the basis version, which doesn't make any sense. + if os_version.full == basis_version_full: + recent_manifest, recent_version_full, unused = run_query('recent', query_date_build(basis_date)) + else: + # The "recent" manifest is the most recent version less than the current manifest. + # In general, it will be the previous build with the same MAJOR.MINOR.PATCH. Or if current is the first build of a new MAJOR.MINOR.PATCH, + # then it will be the same as the basis version. + recent_manifest, recent_version_full, unused = run_query('recent', query_version_build(os_version.build)) # Keep this log in first line to help streak indexer group results. Overall hash will be populated at end. - logger.prefix_log(f'INFO: fs_permissions_diff: current against {basis_version} ') + logger.prefix_log(f'INFO: fs_permissions_diff: current against {basis_version_full} ') # Keep this log in second line to avoid using it for grouping, but keep it for tracking. # Individual hashes to be populated at end. - logger.prefix_log(f'INFO: and {recent_version} ') + logger.prefix_log(f'INFO: Manifest hashes: ') return basis_manifest, recent_manifest +def strip_versions_from_path(path): + # Strip all things that look like version numbers to simplify the diff + # + # The below order matters, since the last sub will prevent previous ones from working correctly + + # Strip all versions for salt (2 forms of this) + stripped_path = re.sub(r"salt-\d+\.\d+_\d+_g[0-9a-f]+", "salt-SALTVERSION", path) + stripped_path = re.sub(r"salt-\d+\.\d+\+\d+\.g[0-9a-f]+", "salt-SALTVERSION", stripped_path) + # Strip everything that looks like an RT kernel version (so module and kernel version changes are ignored) + stripped_path = re.sub(r"\d+\.\d+\.\d+-rt\d+", "VERSION.VERSION.VERSION-rtVERSION", stripped_path) + # Strip everything that looks like 1.2.3 + stripped_path = re.sub(r"\d+\.\d+\.\d+", "VERSION.VERSION.VERSION", stripped_path) + # Strip everything that looks like 1.2 + stripped_path = re.sub(r"\d+\.\d+", "VERSION.VERSION", stripped_path) + + return stripped_path + def prepare_manifest_for_diff(manifest): reader = csv.DictReader(manifest.splitlines(), fieldnames=fs_manifest_columns, delimiter='\t') - return {row['path']: row for row in reader} + result = {} + for row in reader: + stripped_path = strip_versions_from_path(row['path']) + del row['path'] + result[stripped_path] = row + return result class IntermediateDiff: def __init__(self, old, mid, new): @@ -213,10 +269,11 @@ def differences(self): difference['path'] = path yield difference +def hash_and_prep(manifest): + manifest = prepare_manifest_for_diff(manifest) + return hashlib.md5(str(manifest).encode('utf-8')).hexdigest(), manifest def diff_manifests(current_manifest, basis_manifest, recent_manifest, logger): - hash_and_prep = lambda manifest: (hashlib.md5(manifest.encode('utf-8')).hexdigest(), - prepare_manifest_for_diff(manifest)) current_hash, current_manifest = hash_and_prep(current_manifest) basis_hash, basis_manifest = hash_and_prep(basis_manifest) recent_hash, recent_manifest = hash_and_prep(recent_manifest) @@ -226,7 +283,7 @@ def diff_manifests(current_manifest, basis_manifest, recent_manifest, logger): # Add hash to first line of log to allow review queue to distinguish runs, logger.prefix_logs[0] += overall_hash # and add each hash on second line for tracking - logger.prefix_logs[1] += f'(basis={basis_hash}, recent={recent_hash}, current={current_hash})' + logger.prefix_logs[1] += f'basis={basis_hash}, recent={recent_hash}, current={current_hash}' diff = IntermediateDiff(basis_manifest, recent_manifest, current_manifest) @@ -314,11 +371,26 @@ def diff_manifests(current_manifest, basis_manifest, recent_manifest, logger): return not any_differences +def prepare_system_for_manifest(): + # logrotate may not have run yet, so run it now to generate + # the logrotate.status + subprocess.run(["/usr/sbin/logrotate", "/etc/logrotate.conf"]) + def parse_args(): parser = argparse.ArgumentParser(description='diff fs permissions with previous') parser.add_argument('--server', required=True, help='Mongo server hostname') parser.add_argument('--user', required=True, help='Mongo server username') parser.add_argument('--password', required=True, help='Mongo server password') + parser.add_argument('--current_manifest_db_date', metavar="", + help='Use this flag to supply a date string that will be used to locate a filesystem manifest in the database. That manifest will be used as the current filesystem manifest. '\ + 'Should be of the format "2023-03-30 15:32:43.203476". Date strings for previous filesystem manifest can be found in the output of previous runs of this '\ + 'test or can be extracted from the Mongo database using a viewer tool like Compass. This flag also skips the upload of the filesystem manifest record to the '\ + 'database, so the --skip_upload flag is not needed. This flag is useful for debugging issues with this test.') + parser.add_argument('--basis_manifest_db_date', metavar="", + help='Use this flag to supply a date string that will be used to locate a filesystem manifest in the database. That manifest will be used as the basis filesystem manifest. '\ + 'Should be of the format "2023-03-30 15:32:43.203476". Date strings for previous filesystem manifest can be found in the output of previous runs of this '\ + 'test or can be extracted from the Mongo database using a viewer tool like Compass. This flag is useful for resetting the comparison baseline for the test.') + parser.add_argument('--skip_upload', help='Skip upload of fs manifest record to database. Useful when debugging.', action="store_true") return parser.parse_args() @@ -326,10 +398,23 @@ def main(): logger = fs_permissions_shared.Logger() args = parse_args() db = DB(args.server, args.user, args.password) - basis_fs_manifest, recent_fs_manifest = get_old_fs_manifests(db, logger) - fs_manifest = get_fs_manifest() - upload_manifest(db, fs_manifest, logger) + if args.current_manifest_db_date: + fs_manifest, os_version_full, os_version_codename, db_date, db_id = get_previous_fs_manifest_as_current(db, args.current_manifest_db_date, logger) + os_version = OsVersion(os_version_full, os_version_codename) + else: + prepare_system_for_manifest() + fs_manifest = get_fs_manifest() + os_version = OsVersion() + db_date = "" + db_id = "" + + basis_fs_manifest, recent_fs_manifest = get_old_fs_manifests(db, logger, os_version, args.basis_manifest_db_date) + + if not args.current_manifest_db_date and not args.skip_upload: + db_date, db_id = upload_manifest(db, fs_manifest, os_version, logger) + + log_version_info(logger, 'current', os_version.codename, os_version.full, db_date, db_id) result = diff_manifests(fs_manifest, basis_fs_manifest, recent_fs_manifest, logger) diff --git a/recipes-ni/ni-base-system-image-tests/files/test_fs_permissions_diff.sh b/recipes-ni/ni-base-system-image-tests/files/test_fs_permissions_diff.sh index 8de821b96..c565dd62d 100755 --- a/recipes-ni/ni-base-system-image-tests/files/test_fs_permissions_diff.sh +++ b/recipes-ni/ni-base-system-image-tests/files/test_fs_permissions_diff.sh @@ -5,7 +5,11 @@ source $(dirname "$0")/ptest-format.sh ptest_change_test $(basename "$0" ".sh") "" "Diff filesystem permissions with previous" source /home/admin/.mongodb.creds -python3 fs_permissions_diff.py --server $MONGO_SERVER --user $MONGO_USER --password $MONGO_PASSWORD +if [ -e /home/admin/.test.fs_permissions_diff.args ]; then + source /home/admin/.test.fs_permissions_diff.args +fi + +python3 fs_permissions_diff.py --server $MONGO_SERVER --user $MONGO_USER --password $MONGO_PASSWORD "${FS_PERMISSIONS_DIFF_TEST_EXTRA_ARGS[@]}" if [ $? -eq 0 ]; then ptest_pass diff --git a/recipes-ni/ni-grpc-device/files/0001-CMakeLists-Make-grpc-device-buildable-on-NILRT-11-10.patch b/recipes-ni/ni-grpc-device/files/0001-CMakeLists-Make-grpc-device-buildable-on-NILRT-11-10.patch new file mode 100644 index 000000000..f5552c422 --- /dev/null +++ b/recipes-ni/ni-grpc-device/files/0001-CMakeLists-Make-grpc-device-buildable-on-NILRT-11-10.patch @@ -0,0 +1,448 @@ +From b64a69d7b4a6d8335013fb7bea16b83a8f167c7e Mon Sep 17 00:00:00 2001 +From: Rajendra Desai <111044286+rajendra-desai-ni@users.noreply.github.com> +Date: Wed, 11 Sep 2024 21:07:38 +0530 +Subject: [PATCH] CMakeLists: Make grpc-device buildable on NILRT 11 (#1082) + +* CMakeLists: Make grpc-device buildable on NILRT 11 + +NILRT 11 will ship with grpc >1.60 and protobuf >v25.2. +grpc-device doesn't compile with these toolchain versions, +throwing errors about undefined symbols. Downgrading grpc +back to 1.51 (with python3-grpcio and protobuf recipes) +successfully works around these issues. But for security and +general currency reasons, we cannot afford to ship NILRT 11 +with these downgrades. +Current CMakeLists.txt is limited to some of the bitbake +functionalities which makes it difficult to build with new changes. + +Changes in this commit will make sure NILRT 11 compiles grpc-device +with the latest/upgraded grpc version without affecting the existing +build process. + +Changes: +1. refactor toolchain link logic + - Deprecate the CMAKE_CROSSCOMPILING variable, in favor of + USE_SUBMODULE_LIBS cmake option. Refactor the linking logic to + be a consolidation of all the linking actions from across the + file, and to better support builds in generic linux environments. +2. fixup utf8cpp library link + - The utf8cpp cmake library namespace is incorrectly identified + as 'utf8cpp', instead of the proper 'utf8cpp:utf8cpp'. As a + result, cmake does not link the utf8.h header and compilation + fails. +3. parameterize python3 venv + - Create a USE_PYTHON_VIRTUALENV cmake option. When asserted, it + will add the bespoke venv to the toolchain. Otherwise, the + cmake config will use the system python environment. +4. link the device server to grpc_gpr + - ni_grpc_device_server target depends on symbols from grpc + gpr.so, namely gpr_log. Add grpc_gpr to link libraries for + ni_grpc_device_server. +5. add abseil_sync dep to server target + - ni_grpc_device_server uses symbology from libabsl_synchronization + library. Add a library dependency to reflect that relationship. +6. add utf8cpp dep to IntegrationTestsRunner + - The IntegrationTestsRunner depends on utf8.h header indirectly, + via its access to the device server source. +7. fill out target lib deps + - Shove ni_grpc_device_server library dependencies into a variable, + so that it can be easily passed along to the test targets. +8. suppress protobuf installation in SM + - Set protobuf_INSTALL=OFF, which suppresses the protobuf + installation codepaths - that we don't want to use anyway and + which cause the failure. +9. add necessary gRPC dep to ni_grpc_device_server + - ni_grpc_device_server must be linked against libgrpc, as well as + the grpccpp libs. +10.fixup venv codegen deps + - Give the codegen targets a dependency on the python virtualenv + via the all_codegen_dependencies variable. + +Signed-off-by: Rajendra Desai + +* Updated variable name of NILRT_LEGACY_TOOLCHAIN in build artifacts and fixed a small typo + +Signed-off-by: Rajendra Desai + +* build_nilrt.yml: Fixed a typo + +* Enforce consistent runtime library settings in case of MSVC + +Signed-off-by: Rajendra Desai + +* Update linker condition + +* Add a condition to check for POLICY CMP0091 (enabling the use of +MSVC_RUNTIME_LIBRARY property) which is supported on cmake version +>3.15 in case of MSVC compiler + +Signed-off-by: Rajendra Desai + +* CMakeLists: Code cleanup + +* CMakeLists: use static runtime library + +* CMakeLists: change gtest_force_shared_crt to default + +* CMakeLists: add compile options if MSVC + +* Workaround: Do a clean build + +* Revert "CMakeLists: add compile options if MSVC" + +This reverts commit 2ea12e9fbde1c969c8a57eddc375346a7f6900b5. + +* Revert "CMakeLists: change gtest_force_shared_crt to default" + +This reverts commit 36890c9fff9f6ccdc1ee322a100a07770c4ef1d9. + +* Revert "CMakeLists: use static runtime library" + +This reverts commit 26a3c63d05e64b326c18cbe778f0d14e886433ab. + +* Workaround to fix Linker issues + +* Remove duplicate line + +* build_cmake.yml: Added a comment + +* build_cmake.yml: Move comment to avoid syntax error + +--------- +[rajendra: Discarded upstream changes in .github/workflows/build_cmake.yml] +[rajendra: Discarded upstream changes in .github/workflows/build_nilrt.yml] + +Upstream-Status: Backport [https://github.com/ni/grpc-device/commit/0d1658ea666d25a8577f348d78645b591eb45cd8] + +Signed-off-by: Rajendra Desai +--- + CMakeLists.txt | 188 ++++++++++++++++++++++++--------------- + cmake/nilrt-x86_64.cmake | 1 - + 2 files changed, 115 insertions(+), 74 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b0384680..3980bffb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,62 +5,100 @@ project(ni_grpc_device_server + VERSION 2.6.0) + + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +-include(CreateVirtualEnvironment) ++ + + # Workaround for: https://bugs.chromium.org/p/boringssl/issues/detail?id=423 + if (CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64") + set(CMAKE_SYSTEM_PROCESSOR "amd64") + endif() + ++# Enforce consistent runtime library settings in case of MSVC ++if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") ++ if (POLICY CMP0091) ++ cmake_policy(SET CMP0091 NEW) ++ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") ++ message("Setting policy CMP0091 and runtime library") ++ else() ++ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD") ++ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd") ++ message("Using dynamic runtime library") ++ endif() ++endif() ++ ++#--- ++# Configuration options ++#--- ++option(USE_NILRT_LEGACY_TOOLCHAIN "Enable to use tools and libraries from a NILRT compile toolchain." OFF) ++option(USE_PYTHON_VIRTUALENV "Enable to use the automatically-generated python venv, local to this project source." ON) ++option(USE_SUBMODULE_LIBS "Enable to link against the submodule libraries, rather than their native-OS equivalents." ON) ++ + #---------------------------------------------------------------------- +-# Use the grpc targets directly from this build, only when not cross-compiling. ++# Setup build dependencies, according to the toolchain options. + #---------------------------------------------------------------------- +-if(CMAKE_CROSSCOMPILING) ++ ++if(USE_SUBMODULE_LIBS) ++ # The archetypical WIN32 build case ++ # protobuf_INSTALL must be turned OFF whenever building it as a cmake subdir. ++ set(protobuf_INSTALL OFF) ++ ++ add_subdirectory(third_party/grpc ${CMAKE_CURRENT_BINARY_DIR}/grpc) ++ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) ++ add_subdirectory(third_party/gtest ${CMAKE_CURRENT_BINARY_DIR}/gtest EXCLUDE_FROM_ALL) ++ add_subdirectory(third_party/json ${CMAKE_CURRENT_BINARY_DIR}/json) ++ add_subdirectory(third_party/utfcpp ${CMAKE_CURRENT_BINARY_DIR}/utfcpp) ++ ++ set(_PROTOBUF_PROTOC $) ++ set(_REFLECTION grpc++_reflection) ++ set(_GRPC grpc) ++ set(_GRPC_CPP_PLUGIN_EXECUTABLE $) ++ set(_GRPC_GRPCPP grpc++) ++ set(_PROTOBUF_LIBPROTOBUF libprotobuf) ++ set(_UTF8CPP utf8cpp) ++else() + find_program(_PROTOBUF_PROTOC protoc) + find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) ++ find_library(_GRPC_GPR gpr) ++ find_library(_ABSEIL_SYNC absl_synchronization REQUIRED) + +- if(NOT _GRPC_DEVICE_NILRT_LEGACY_TOOLCHAIN) +- find_package(gRPC REQUIRED) +- find_library(_REFLECTION grpc++_reflection) +- find_library(_GRPC_GRPCPP grpc++) +- find_library(_PROTOBUF_LIBPROTOBUF protobuf) +- else() ++ if(USE_NILRT_LEGACY_TOOLCHAIN) ++ # The archetypical NILRT SDK toolchain build case + add_subdirectory(third_party/grpc ${CMAKE_CURRENT_BINARY_DIR}/grpc EXCLUDE_FROM_ALL) + set(_REFLECTION grpc++_reflection) + set(_GRPC_GRPCPP grpc++) + set(_PROTOBUF_LIBPROTOBUF libprotobuf) +- endif() ++ else() ++ # The archetypical linux build case (including OpenEmbedded) ++ find_library(_GRPC_GRPCPP grpc++) ++ find_library(_PROTOBUF_LIBPROTOBUF protobuf) ++ find_library(_REFLECTION grpc++_reflection) + +-else() +- add_subdirectory(third_party/grpc ${CMAKE_CURRENT_BINARY_DIR}/grpc EXCLUDE_FROM_ALL) +- set(_PROTOBUF_PROTOC $) +- set(_REFLECTION grpc++_reflection) +- set(_GRPC_CPP_PLUGIN_EXECUTABLE $) +- set(_GRPC_GRPCPP grpc++) +- set(_PROTOBUF_LIBPROTOBUF libprotobuf) +-endif() ++ find_package(gRPC REQUIRED) ++ find_package(GTest REQUIRED) ++ find_package(nlohmann_json REQUIRED) ++ find_package(utf8cpp REQUIRED) + +-#---------------------------------------------------------------------- +-CreateVirtualEnvironment(virtual_environment +- REQUIREMENTS_TXT +- ${CMAKE_SOURCE_DIR}/python_build_requirements.txt +- ENV_NAME +- venv +- OUT_PYTHON_EXE +- PYTHON_EXE +-) ++ set(_GRPC gRPC::grpc) ++ set(_UTF8CPP utf8cpp::utf8cpp) ++ endif() ++endif() + +-#---------------------------------------------------------------------- +-# Use the utfcpp targets directly from this build, only when not cross-compiling. +-#---------------------------------------------------------------------- +-if(CMAKE_CROSSCOMPILING AND NOT _GRPC_DEVICE_NILRT_LEGACY_TOOLCHAIN) +- find_package(utf8cpp REQUIRED) ++# Python3 Virtual Environment ++if(USE_PYTHON_VIRTUALENV) ++ include(CreateVirtualEnvironment) ++ CreateVirtualEnvironment(virtual_environment ++ REQUIREMENTS_TXT ++ ${CMAKE_SOURCE_DIR}/python_build_requirements.txt ++ ENV_NAME ++ venv ++ OUT_PYTHON_EXE ++ PYTHON_EXE ++ ) + else() +- add_subdirectory(third_party/utfcpp ${CMAKE_CURRENT_BINARY_DIR}/utfcpp EXCLUDE_FROM_ALL) ++ find_package(Python3 REQUIRED) ++ set(PYTHON_EXE ${Python3_EXECUTABLE}) + endif() +-include_directories( +- "./third_party/utfcpp/source" +-) ++ ++enable_testing() + + #---------------------------------------------------------------------- + # Use C++17 (needed for shared_mutex support on Linux) +@@ -141,6 +179,10 @@ endif() + + set(all_codegen_dependencies "") + ++if(USE_PYTHON_VIRTUALENV) ++ list(APPEND all_codegen_dependencies virtual_environment) ++endif() ++ + foreach(api ${nidrivers}) + set(codegen_dependencies + "${metadata_dir}/${api}/attributes.py" +@@ -191,7 +233,10 @@ foreach(api ${nidrivers}) + ${nidriver_client_srcs} + "${service_output_dir}/${api}/${api}_client.cpp") + endif() +- set(proto_dependencies ${codegen_dependencies} ${codegen_scripts} virtual_environment) ++ set(proto_dependencies ${codegen_dependencies} ${codegen_scripts}) ++ if (USE_PYTHON_VIRTUALENV) ++ list(APPEND proto_dependencies virtual_environment) ++ endif() + add_custom_command(OUTPUT ${output_files} + ${gen_command} + COMMENT "Generating proto file and service for ${api}" +@@ -211,7 +256,6 @@ add_custom_command( + DEPENDS + ${all_codegen_dependencies} + ${codegen_scripts} +- virtual_environment + ) + + set(nidriver_service_srcs +@@ -240,6 +284,9 @@ function(GenerateGrpcSources) + cmake_parse_arguments(GENERATE_ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(output_files "${GENERATE_ARGS_OUTPUT}") + set(proto_file "${GENERATE_ARGS_PROTO}") ++ if(USE_SUBMODULE_LIBS) ++ set(protobuf_includes_arg -I ${CMAKE_SOURCE_DIR}/third_party/grpc/third_party/protobuf/src/) ++ endif() + get_filename_component(proto_path "${proto_file}" PATH) + # Asssumption: all outputs are in the same directory: use the zero-th. + list(GET output_files 0 proto_srcs) +@@ -250,7 +297,7 @@ function(GenerateGrpcSources) + ARGS --grpc_out "${proto_out_path}" + --cpp_out "${proto_out_path}" + -I "${proto_path}" +- -I ${CMAKE_SOURCE_DIR}/third_party/grpc/third_party/protobuf/src/ ++ ${protobuf_includes_arg} + -I ${CMAKE_SOURCE_DIR}/imports/protobuf + --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}" + "${proto_file}" +@@ -472,14 +519,21 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows) + PRIVATE "source/server/windows/console_ctrl_handler.cpp") + endif() + ++set(server_lib_deps ++ ${_ABSEIL_SYNC} ++ ${_GRPC_GPR} ++ ${_GRPC_GRPCPP} ++ ${_GRPC} ++ ${_PROTOBUF_LIBPROTOBUF} ++ ${_REFLECTION} ++ ${_UTF8CPP} ++ ${CMAKE_DL_LIBS} ++ nlohmann_json::nlohmann_json ++) ++ + target_link_libraries(ni_grpc_device_server +- ${_REFLECTION} +- ${_GRPC_GRPCPP} +- ${_PROTOBUF_LIBPROTOBUF} +- ${CMAKE_DL_LIBS} +- nlohmann_json::nlohmann_json +- utf8cpp +- ) ++ ${server_lib_deps} ++) + + set_target_properties(ni_grpc_device_server PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE) + +@@ -500,20 +554,6 @@ add_custom_command( + COMMAND ${PYTHON_EXE} ${codegen_dir}/generate_server_capabilities.py ${metadata_dir}/ + -o $/) + +- +-#---------------------------------------------------------------------- +-# Add JSON parser and configure google tests +-#---------------------------------------------------------------------- +-if(CMAKE_CROSSCOMPILING AND NOT _GRPC_DEVICE_NILRT_LEGACY_TOOLCHAIN) +- find_package(nlohmann_json REQUIRED) +- find_package(GTest REQUIRED) +-else() +- add_subdirectory(third_party/json ${CMAKE_CURRENT_BINARY_DIR}/json EXCLUDE_FROM_ALL) +- enable_testing() +- set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +- add_subdirectory(third_party/gtest ${CMAKE_CURRENT_BINARY_DIR}/gtest EXCLUDE_FROM_ALL) +-endif() +- + # Link test executable against gtest + add_executable(IntegrationTestsRunner + "imports/include/nierr_Status.cpp" +@@ -568,12 +608,12 @@ add_executable(IntegrationTestsRunner + find_package(Threads REQUIRED) + + target_link_libraries(IntegrationTestsRunner +- gtest ++ ${server_lib_deps} + gmock +- ${_GRPC_GRPCPP} +- ${CMAKE_DL_LIBS} ++ grpc ++ gtest + Threads::Threads +- nlohmann_json::nlohmann_json) ++) + + # Ignore the use of deprecated functions in test code + target_compile_definitions(IntegrationTestsRunner +@@ -673,12 +713,13 @@ target_include_directories(UnitTestsRunner + PRIVATE "source/server") + + target_link_libraries(UnitTestsRunner +- gtest +- gmock +- ${_GRPC_GRPCPP} + ${CMAKE_DL_LIBS} ++ ${server_lib_deps} ++ gmock ++ grpc ++ gtest + Threads::Threads +- nlohmann_json::nlohmann_json) ++) + + #---------------------------------------------------------------------- + # Copy test asset certificates to binary output certs sub-directory +@@ -695,8 +736,10 @@ foreach(api ${nidrivers_to_build}) + "${service_output_dir}/${api}/${api}_compilation_test.cpp") + endforeach() + add_library(CompilationTests STATIC ${compilation_test_sources}) ++ + target_link_libraries(CompilationTests + ${_GRPC_GRPCPP} ++ ${_UTF8CPP} + ) + add_custom_target(generated_nidriver_service_library_hdrs DEPENDS ${nidriver_service_library_hdrs}) + add_dependencies(CompilationTests generated_nidriver_service_library_hdrs) +@@ -802,11 +845,10 @@ endif() + add_executable(SystemTestsRunner ${system_test_runner_sources}) + + target_link_libraries(SystemTestsRunner +- gtest +- gmock +- ${_GRPC_GRPCPP} + ${CMAKE_DL_LIBS} +- nlohmann_json::nlohmann_json ++ ${server_lib_deps} ++ gmock ++ gtest + ) + + # Ignore the use of deprecated functions in test code +@@ -819,7 +861,7 @@ add_custom_command( + ${CMAKE_SOURCE_DIR}/source/tests/assets/data/ + $/) + +-if(_GRPC_DEVICE_NILRT_LEGACY_TOOLCHAIN) ++if(USE_NILRT_LEGACY_TOOLCHAIN) + target_link_libraries(SystemTestsRunner stdc++fs) + target_compile_definitions(SystemTestsRunner PRIVATE FS_EXPERIMENTAL) + endif() +diff --git a/cmake/nilrt-x86_64.cmake b/cmake/nilrt-x86_64.cmake +index c007f696..7f00969f 100644 +--- a/cmake/nilrt-x86_64.cmake ++++ b/cmake/nilrt-x86_64.cmake +@@ -3,7 +3,6 @@ + #---------------------------------------------------------------------- + set(CMAKE_SYSTEM_NAME Linux) + set(CMAKE_SYSTEM_PROCESSOR x86_64) +-set(_GRPC_DEVICE_NILRT_LEGACY_TOOLCHAIN TRUE) + + #---------------------------------------------------------------------- + # Path variables for toolchains +-- +2.34.1 + diff --git a/recipes-ni/ni-grpc-device/files/0001-CMakeLists.txt-remove-local-protobuf-includes.patch b/recipes-ni/ni-grpc-device/files/0001-CMakeLists.txt-remove-local-protobuf-includes.patch deleted file mode 100644 index 7bad34451..000000000 --- a/recipes-ni/ni-grpc-device/files/0001-CMakeLists.txt-remove-local-protobuf-includes.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 5beb04fda1a29cd1c82a3177564415845bf40ba5 Mon Sep 17 00:00:00 2001 -From: Alex Stewart -Date: Mon, 10 May 2021 23:09:38 +0000 -Subject: [PATCH] CMakeLists.txt: remove local protobuf includes - -When building grpc from within OE, protobuf is supplied by the native -sysroot. Do not add an includes path to the un-checked-out submodule. - -Signed-off-by: Alex Stewart - -Upstream-Status: Inappropriate [Would break non-cross-compile builds] - ---- - CMakeLists.txt | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 656909d..4be9fd3 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -141,7 +141,6 @@ function(GenerateGrpcSources proto_file proto_path proto_srcs proto_hdrs grpc_sr - ARGS --grpc_out "${proto_out_path}" - --cpp_out "${proto_out_path}" - -I "${proto_path}" -- -I ${CMAKE_SOURCE_DIR}/third_party/grpc/third_party/protobuf/src/ - -I ${CMAKE_SOURCE_DIR}/source/protobuf - --plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}" - "${proto_file}" diff --git a/recipes-ni/ni-grpc-device/files/0001-semaphore.h-fix-undefined-condition_variable-type.patch b/recipes-ni/ni-grpc-device/files/0001-semaphore.h-fix-undefined-condition_variable-type.patch deleted file mode 100644 index f96cdfd21..000000000 --- a/recipes-ni/ni-grpc-device/files/0001-semaphore.h-fix-undefined-condition_variable-type.patch +++ /dev/null @@ -1,34 +0,0 @@ -From d636ef8cfefdaa564e1363373adc77d80529e0c3 Mon Sep 17 00:00:00 2001 -From: Alex Stewart -Date: Sat, 5 Nov 2022 16:56:59 -0500 -Subject: [PATCH] semaphore.h: fix undefined condition_variable type - -Building the grpc server component on Debian 11 and NILRT 10 throws an -error in semaphore.h about `std::condition_variable` being undefined. -g++ recommends explicitly adding the `condition_variable` header. - -Add the header. - -Signed-off-by: Alex Stewart - -Upstream-Status: Submitted [https://github.com/ni/grpc-device/pull/786] - ---- - source/server/semaphore.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/source/server/semaphore.h b/source/server/semaphore.h -index bd25461..ac8411f 100644 ---- a/source/server/semaphore.h -+++ b/source/server/semaphore.h -@@ -2,6 +2,7 @@ - #define NIDEVICE_GRPC_SEMAPHORE_H - - #include -+#include - - namespace nidevice_grpc { - --- -2.38.1 - diff --git a/recipes-ni/ni-grpc-device/files/0002-CMakeLists-use-find_package-for-gtest-dep.patch b/recipes-ni/ni-grpc-device/files/0002-CMakeLists-use-find_package-for-gtest-dep.patch deleted file mode 100644 index 9643d023d..000000000 --- a/recipes-ni/ni-grpc-device/files/0002-CMakeLists-use-find_package-for-gtest-dep.patch +++ /dev/null @@ -1,35 +0,0 @@ -From ac8145c7646b2783db4625069ddeb67083656a17 Mon Sep 17 00:00:00 2001 -From: Alex Stewart -Date: Fri, 15 Apr 2022 15:41:23 -0500 -Subject: [PATCH] CMakeLists: use find_package for gtest dep - -Within the context of an OpenEmbedded build, `find_library(gtest...` -fails to detect googletest in the recipe-sysroot-native, blocking -configuration. - -Switch the find_ operation to `find_package()`, which functions -properly. - -Signed-off-by: Alex Stewart - -Upstream-Status: Pending [https://github.com/ni/grpc-device/pull/660] ---- - CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 573b7e94d8bb69de203907cb8eee60de11ebbd32..406590b4dedb9cb9e12efc1bf0c74840719c4cf3 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -227,7 +227,7 @@ add_custom_command( - #---------------------------------------------------------------------- - if(CMAKE_CROSSCOMPILING AND NOT _GRPC_DEVICE_NILRT_LEGACY_TOOLCHAIN) - find_package(nlohmann_json REQUIRED) -- find_library(gtest REQUIRED) -+ find_package(GTest REQUIRED) - else() - add_subdirectory(third_party/json ${CMAKE_CURRENT_BINARY_DIR}/json EXCLUDE_FROM_ALL) - enable_testing() --- -2.35.1 - diff --git a/recipes-ni/ni-grpc-device/ni-grpc-device_git.bb b/recipes-ni/ni-grpc-device/ni-grpc-device_git.bb index 60446d2ca..cf91e39cc 100644 --- a/recipes-ni/ni-grpc-device/ni-grpc-device_git.bb +++ b/recipes-ni/ni-grpc-device/ni-grpc-device_git.bb @@ -4,92 +4,112 @@ HOMEPAGE = "https://github.com/ni/grpc-device" SECTION = "base" LICENSE = "MIT & Apache-2.0" LIC_FILES_CHKSUM = "\ - file://LICENSE;md5=08ed4de411f83eee0363c9d12e31e92d \ - file://ThirdPartyNotices.txt;md5=6def9ca42f278e76d89243699fae2b67 \ + file://LICENSE;md5=f7f2c0314387ea903bd40965abfad353 \ + file://ThirdPartyNotices.txt;md5=57283cec49f9773bb10bac48da2e56df \ " DEPENDS += "\ - grpc-native \ googletest-native \ + grpc \ + grpc-native \ nlohmann-json-native \ + protobuf \ protobuf-native \ python3-grpcio-tools-native \ python3-mako-native \ python3-native \ + python3-schema-native \ + utf8cpp-native \ " -PV = "1.1.0" +PV = "2.6.0" SRC_URI = "\ git://github.com/ni/grpc-device.git;name=grpc-device;branch=main;protocol=https \ - file://0001-CMakeLists.txt-remove-local-protobuf-includes.patch \ - file://0001-semaphore.h-fix-undefined-condition_variable-type.patch \ - file://0002-CMakeLists-use-find_package-for-gtest-dep.patch \ file://ptest \ + file://0001-CMakeLists-Make-grpc-device-buildable-on-NILRT-11-10.patch \ " -SRCREV_grpc-device = "15508bba63a6c289a32445ffb7f8986c99a2f286" + +SRCREV_grpc-device = "609fdf8c7ec99597373cf35f2b9608422b1955c9" SRCREV_FORMAT = "grpc-device" S = "${WORKDIR}/git" - inherit cmake python3native -EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=Release" +EXTRA_OECMAKE += "-DCMAKE_CROSSCOMPILING=True -DCMAKE_BUILD_TYPE=Release -DUSE_SUBMODULE_LIBS=OFF -DUSE_PYTHON_VIRTUALENV=OFF" OECMAKE_TARGET_COMPILE = "ni_grpc_device_server" OECMAKE_GENERATOR = "Unix Makefiles" -inherit ptest - -BUILD_PTEST = "${B}/ptest" -RDEPENDS:${PN}-ptest += "\ - ${PN} \ - bash \ - python3-grpcio \ -" - -do_compile_ptest:append () { - install -d ${BUILD_PTEST} - python3 -m grpc_tools.protoc \ - -I${S}/source/protobuf \ - --python_out=${BUILD_PTEST} \ - --grpc_python_out=${BUILD_PTEST} \ - ${S}/source/protobuf/session.proto -} - -do_install_ptest:append () { - install -d ${D}${PTEST_PATH} - install -m 0755 ${WORKDIR}/ptest/run-ptest ${D}${PTEST_PATH}/ - - install -m 0644 ${S}/examples/session/enumerate-device.py ${D}${PTEST_PATH}/ - - # These files are generated by the do_compile_ptest task. - install -m 0644 ${BUILD_PTEST}/session_pb2_grpc.py ${D}${PTEST_PATH}/ - install -m 0644 ${BUILD_PTEST}/session_pb2.py ${D}${PTEST_PATH}/ -} - - +#inherit ptest +# +#BUILD_PTEST = "${B}/ptest" +#RDEPENDS:${PN}-ptest += "\ +# ${PN} \ +# bash \ +# python3-grpcio \ +#" +# +#do_compile_ptest:append () { +# install -d ${BUILD_PTEST} +# python3 -m grpc_tools.protoc \ +# -I${S}/source/protobuf \ +# --python_out=${BUILD_PTEST} \ +# --grpc_python_out=${BUILD_PTEST} \ +# ${S}/source/protobuf/session.proto +#} +# +#do_install_ptest:append () { +# install -d ${D}${PTEST_PATH} +# install -m 0755 ${WORKDIR}/ptest/run-ptest ${D}${PTEST_PATH}/ +# +# install -m 0644 ${S}/examples/session/enumerate-device.py ${D}${PTEST_PATH}/ +# +# # These files are generated by the do_compile_ptest task. +# install -m 0644 ${BUILD_PTEST}/session_pb2_grpc.py ${D}${PTEST_PATH}/ +# install -m 0644 ${BUILD_PTEST}/session_pb2.py ${D}${PTEST_PATH}/ +#} + + +serverdir = "${D}${libdir}/${BPN}" # grpc-device does not provide an 'install' target (yet); so overwrite the whole # of do_install, to keep cmake from building anything further. do_install () { - # install server binaries - install -d ${D}${bindir} - install --mode=0755 ${B}/ni_grpc_device_server ${D}${bindir} + # install server components + install -d ${serverdir} + install --mode=0755 ${B}/ni_grpc_device_server ${serverdir} + install --mode=0644 ${B}/server_config.json ${serverdir}/server_config.json.example + install --mode=0644 ${B}/server_capabilities.json ${serverdir} - # install default server_config + # package .proto files for use by developers install -d ${D}${datadir}/${BPN} - install --mode=0644 ${B}/server_config.json ${D}${datadir}/${BPN}/server_config.json.example + install --mode=0644 ${S}/generated/**/*.proto ${D}${datadir}/${BPN} + install --mode=0644 ${S}/imports/protobuf/*.proto ${D}${datadir}/${BPN} - # package .proto files for use by developers - install -d ${D}${includedir}/${BPN} - install --mode=0644 ${S}/generated/**/*.proto ${D}${includedir}/${BPN} - install --mode=0644 ${S}/source/protobuf/session.proto ${D}${includedir}/${BPN} + # install example files + install -d ${D}${datadir}/${BPN} + cp -r ${S}/examples ${D}${datadir}/${BPN} } +PACKAGE_BEFORE_PN = "${PN}-examples" + +# ${PN} RDEPENDS:${PN} += "\ grpc \ protobuf \ " + +# ${PN}-dev +FILES:${PN}-dev:append = "${datadir}/${BPN}/*.proto" +RDEPENDS:${PN}-dev:append = "\ + grpc-dev \ +" + +# ${PN}-examples +FILES:${PN}-examples = "${datadir}/${BPN}/examples" +RDEPENDS:${PN}-examples = "\ + python3 \ +" \ No newline at end of file diff --git a/recipes-ni/ni-hw-scripts/ni-hw-scripts-common.bb b/recipes-ni/ni-hw-scripts/ni-hw-scripts-common.bb index c86cb5f6c..a552ef1d8 100644 --- a/recipes-ni/ni-hw-scripts/ni-hw-scripts-common.bb +++ b/recipes-ni/ni-hw-scripts/ni-hw-scripts-common.bb @@ -16,6 +16,11 @@ SRC_URI += "\ S = "${WORKDIR}" +inherit allarch +PACKAGE_ARCH = "all" +PACKAGES:remove = "${PN}-staticdev ${PN}-dev ${PN}-dbg" + + do_install () { install -d ${D}${sysconfdir}/init.d/ @@ -46,9 +51,6 @@ pkg_postrm:${PN} () { } -PACKAGE_ARCH = "all" -PACKAGES:remove = "${PN}-staticdev ${PN}-dev ${PN}-dbg" - FILES:${PN} += "\ ${sysconfdir}/init.d/ni-rename-ifaces \ ${sysconfdir}/init.d/nisetserialnumber \ diff --git a/recipes-ni/ni-netcfgutil/ni-netcfgutil.bb b/recipes-ni/ni-netcfgutil/ni-netcfgutil.bb index a1dc6605e..2b482640a 100644 --- a/recipes-ni/ni-netcfgutil/ni-netcfgutil.bb +++ b/recipes-ni/ni-netcfgutil/ni-netcfgutil.bb @@ -40,4 +40,9 @@ FILES:${PN} += "\ /etc/natinst/networking/ninetcfgutil_platdep.sh \ " -RDEPENDS:${PN} += "bash" +RDEPENDS:${PN} += "\ + bash \ + initscripts \ + initscripts-nilrt \ + ni-utils \ +" diff --git a/recipes-ni/ni-rtfeatures/files/ni-rtfeatures.initd b/recipes-ni/ni-rtfeatures/files/ni-rtfeatures.initd index 3ea8f4d60..a35b22955 100755 --- a/recipes-ni/ni-rtfeatures/files/ni-rtfeatures.initd +++ b/recipes-ni/ni-rtfeatures/files/ni-rtfeatures.initd @@ -46,6 +46,9 @@ log_reset_source () { ironclad) log INFO "reset_source=${reason} # Ironclad watchdog timer expired" ;; + poweron) + log INFO "reset_source=${reason} # System powered-on; not reset." + ;; processor) log INFO "reset_source=${reason} # Reset from MAX or command line" ;; @@ -56,7 +59,7 @@ log_reset_source () { log INFO "reset_source=${reason} # RT watchdog timer expired" ;; *) - log ERROR "Unkown reset_source string: \"$reason\"" + log ERROR "Unknown reset_source string: \"$reason\"" ;; esac } diff --git a/recipes-ni/ni-rtfeatures/ni-rtfeatures.bb b/recipes-ni/ni-rtfeatures/ni-rtfeatures.bb index 1e674c12e..719132baa 100644 --- a/recipes-ni/ni-rtfeatures/ni-rtfeatures.bb +++ b/recipes-ni/ni-rtfeatures/ni-rtfeatures.bb @@ -8,7 +8,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda DEPENDS += "update-rc.d-native" -PV = "2.0" +PV = "2.1" SRC_URI += "\ @@ -20,6 +20,11 @@ SRC_URI += "\ S = "${WORKDIR}" +inherit allarch +PACKAGE_ARCH = "all" +PACKAGES:remove = "${PN}-staticdev ${PN}-dev ${PN}-dbg" + + do_install:append () { install -d ${D}${sysconfdir}/init.d/ install -m 0755 ${S}/handle_cpld_ip_reset.initd ${D}${sysconfdir}/init.d/handle_cpld_ip_reset @@ -50,9 +55,6 @@ pkg_postrm:${PN} () { } -PACKAGE_ARCH = "all" -PACKAGES:remove = "${PN}-staticdev ${PN}-dev ${PN}-dbg" - FILES:${PN} += "\ ${sysconfdir}/init.d/* \ ${sysconfdir}/udev \ diff --git a/recipes-ni/ni-smbios-helper/files/smbios_helper b/recipes-ni/ni-smbios-helper/files/smbios_helper index 7f75ef773..a1e3654a8 100644 --- a/recipes-ni/ni-smbios-helper/files/smbios_helper +++ b/recipes-ni/ni-smbios-helper/files/smbios_helper @@ -70,7 +70,7 @@ get_serial_number() local sn="`$DMIDECODE -t 1 | grep "Serial Number:"`" # Filter out invalid sn strings like "Not Applicable" and "Not Specified" - if echo "$sn" | egrep -q "Serial Number: Not "; then + if echo "$sn" | grep -Eq "Serial Number: Not "; then sn="" fi diff --git a/recipes-ni/ni-systemimage/files/nisystemimage b/recipes-ni/ni-systemimage/files/nisystemimage index bfc52a923..70acdcf7f 100644 --- a/recipes-ni/ni-systemimage/files/nisystemimage +++ b/recipes-ni/ni-systemimage/files/nisystemimage @@ -5,8 +5,6 @@ set -eEu -o pipefail shopt -s dotglob nullglob -. /etc/natinst/networking/functions.common - ## ## Globals ## @@ -51,22 +49,31 @@ BLACKLIST_LISTS=() BLACKLIST_PATHS=( # syslog-ng socket (sockets can't be tar'd) /var/syslog-ng.ctl + /var/volatile + # Systemlink Configuration Files + /etc/salt/minion_id + /etc/salt/pki +) + +BLACKLIST_PATHS_get_set=( # Safe mode /boot/.safe - # Grub variables - /boot/grub # Default bitfile /boot/.defbit # User bitfile /boot/user.bit* - /var/volatile # Restore-mode fail-safe files /.restore - # Systemlink Configuration Files - /etc/salt/minion_id - /etc/salt/pki ) +if [[ "${MODE}" == "get" || "${MODE}" == "set" ]]; then + BLACKLIST_PATHS+=(${BLACKLIST_PATHS_get_set[*]}) +fi + +# Passed as argument to pv. The default "-q" shows no progress. +# Set this to empty string to display progress. +DISPLAY_PROGRESS_ARG="-q" + # All excludes to pass to `tar`. Includes BLACKLIST_PATHS and contents of all # files in BLACKLIST_LISTS. The contents of EXCLUDES are paths relative to # /mnt/userfs; the contents of BLACKLIST_PATHS and the contents of the files in @@ -94,9 +101,16 @@ IMAGE_FILE_TEMP= ORIG_USERFS=/mnt/userfs ORIG_BOOTFS=/boot ORIG_CONFIGFS=/etc/natinst/share + +USERFS_LABEL=nirootfs +BOOTFS_LABEL=nibootfs +CONFIGFS_LABEL=niconfig +GRUBFS_LABEL=nigrub + WORKING_USERFS=/mnt/.userfs.tmp WORKING_BOOTFS=${WORKING_USERFS}${ORIG_BOOTFS} WORKING_CONFIGFS=${WORKING_USERFS}${ORIG_CONFIGFS} +WORKING_GRUBFS=${WORKING_USERFS}/${GRUBFS_LABEL} # tar xattr extract defaults to only extract user xattrs, not system xattrs. # Override this with --xattrs-include=*. @@ -135,9 +149,9 @@ print_help () { cat < [-hnv] [-b ] [-B ] [-f ] +$BASENAME get -x [-dhnv] [-b ] [-B ] [-f ] -$BASENAME set -x [-hnv] [-b ] [-B ] [-f ] +$BASENAME set -x [-dhnv] [-b ] [-B ] [-f ] -p reset|preserve|apply -s reset|preserve|apply EOF @@ -149,7 +163,7 @@ declare -Ar EXITCODES=( [FILE_NOT_FOUND]=11 [FS_PREP_FAILED]=12 [NETCFG_FAIL]=13 - [ILLTIMED]=14 + [ILLTIMED]=14 ) # $@: text @@ -198,6 +212,10 @@ is_set () { [[ "${MODE}" == "set" ]] } +is_setall () { + [[ "${MODE}" == "setall" ]] +} + # $1: mount point is_mounted () { if (( $VERBOSE >= 2 )); then @@ -236,6 +254,10 @@ in_safemode () { [[ -f /etc/natinst/safemode ]] } +in_restoremode () { + [[ -f /ni_provisioning ]] +} + ## ## Network configuration management ## @@ -351,7 +373,7 @@ image_get_tgz () { cd $WORKING_USERFS CMDLINE+=(*) - run_cmd "${CMDLINE[@]}" 1>&"$FD_IMAGE" + run_cmd "${CMDLINE[@]}" | pv $DISPLAY_PROGRESS_ARG 1>&"$FD_IMAGE" echo_verbose 2 "finished" } @@ -368,6 +390,15 @@ init_fs_get () { fi } +init_fs_getall () { + init_fs_get + + is_mounted $WORKING_GRUBFS && run_cmd_always umount -f $WORKING_GRUBFS || true + run_cmd_always mkdir -p $WORKING_GRUBFS + run_cmd_always mount -L $GRUBFS_LABEL $WORKING_GRUBFS -o ro \ + || die FS_PREP_FAILED "Couldn't mount $GRUBFS_LABEL to $WORKING_GRUBFS" +} + init_fd_get () { if [[ $IMAGE_FILE ]] ; then rm -f -- "$IMAGE_FILE" || die UNKNOWN "Couldn't clear '$IMAGE_FILE'" @@ -379,6 +410,10 @@ init_fd_get () { fi } +init_fd_getall () { + init_fd_get +} + image_get () { image_get_${IMAGE_TYPE} if [[ $IMAGE_FILE ]]; then @@ -387,6 +422,10 @@ image_get () { fi } +image_getall () { + image_get +} + ## ## Set Image ## @@ -516,7 +555,7 @@ image_set_tgz () { cd $WORKING_USERFS if [[ ! $NOEXEC ]]; then - "${CMDLINE[@]}" 0<&"$FD_IMAGE" + pv $DISPLAY_PROGRESS_ARG 0<&"$FD_IMAGE" | "${CMDLINE[@]}" else if (( $VERBOSE > 0 )); then echo_verbose 1 "skipping extraction; 'tar t' output:" @@ -537,6 +576,17 @@ image_set () { netcfg_reset } +image_setall () { + netcfg_pre_apply_reset + netcfg_pre_preserve + # TODO: Fix wipe_fs to work in restoremode + # wipe_fs + image_set_${IMAGE_TYPE} + netcfg_apply + netcfg_preserve + netcfg_reset +} + init_fd_set () { if [[ $IMAGE_FILE ]] ; then exec {FD_IMAGE}<"$IMAGE_FILE" \ @@ -546,6 +596,10 @@ init_fd_set () { fi } +init_fd_setall () { + init_fd_set +} + init_fs_set () { # working mountpts will inherit the ro-ness of the bound mountpoint, so # make sure everything is rw @@ -560,6 +614,15 @@ init_fs_set () { fi } +init_fs_setall () { + init_fs_set + + is_mounted $WORKING_GRUBFS && run_cmd_always umount -f $WORKING_GRUBFS || true + run_cmd_always mkdir -p $WORKING_GRUBFS + run_cmd_always mount -L $GRUBFS_LABEL $WORKING_GRUBFS -o rw \ + || die FS_PREP_FAILED "Couldn't mount $GRUBFS_LABEL to $WORKING_GRUBFS" +} + # Undocumented debugging mode: Print NUL-delimited list of files that would get # deleted on set image_wipelist () { @@ -582,9 +645,34 @@ init_fd () { init_fd_$MODE } +init_fs_restoremode () { + # If the util did not previously exit cleanly, it's possible that the + # working mount points didn't get unmounted. To avoid double-mounts, + # try to unmount them first + is_mounted $ORIG_BOOTFS && run_cmd_always umount -f $ORIG_BOOTFS || true + is_mounted $ORIG_CONFIGFS && run_cmd_always umount -f $ORIG_CONFIGFS || true + is_mounted $ORIG_USERFS && run_cmd_always umount -f $ORIG_USERFS || true + + run_cmd_always mkdir -p $ORIG_USERFS + run_cmd_always mount -L $USERFS_LABEL $ORIG_USERFS \ + || die FS_PREP_FAILED "Couldn't mount label $USERFS_LABEL to $ORIG_USERFS " + run_cmd_always mkdir -p $ORIG_BOOTFS + run_cmd_always mount -L $BOOTFS_LABEL $ORIG_BOOTFS \ + || die FS_PREP_FAILED "Couldn't mount label $BOOTFS_LABEL to $ORIG_BOOTFS " + run_cmd_always mkdir -p $ORIG_CONFIGFS + run_cmd_always mount -L $CONFIGFS_LABEL $ORIG_CONFIGFS \ + || die FS_PREP_FAILED "Couldn't mount label $CONFIGFS_LABEL to $ORIG_CONFIGFS" +} + init_fs () { + if in_restoremode; then + # Tools such as ninetcfg and nirtcfg expect same mountpoints as safemode and runmode. + # So mount userfs, bootfs, configfs at expected locations. + init_fs_restoremode + fi + # If the util did not previously exit cleanly, it's possible that the - # working mount points didn't get unmount them. To avoid double-mounts, + # working mount points didn't get unmounted. To avoid double-mounts, # try to unmount them first is_mounted $WORKING_BOOTFS && run_cmd_always umount -f $WORKING_BOOTFS || true is_mounted $WORKING_CONFIGFS && run_cmd_always umount -f $WORKING_CONFIGFS || true @@ -603,20 +691,34 @@ init_fs () { init_fs_$MODE } +cleanup_fs_restoremode () { + is_mounted $ORIG_BOOTFS && run_cmd_always umount -f $ORIG_BOOTFS || true + is_mounted $ORIG_CONFIGFS && run_cmd_always umount -f $ORIG_CONFIGFS || true + is_mounted $ORIG_USERFS && run_cmd_always umount -f $ORIG_USERFS || true +} + ## ## Cleanup ## cleanup_fs () { + if in_restoremode; then + cleanup_fs_restoremode + fi + cd $ORIG_PWD || true echo_verbose 1 "starting fs cleanup: PWD=$PWD" - # For set, mount -o mount,rw appears to have the indirect effect - # of forcing a sync - run_cmd_always mount -o remount,rw $ORIG_USERFS || true - run_cmd_always mount -o remount,rw $ORIG_BOOTFS || true + if ! in_restoremode; then + # For set, mount -o mount,rw appears to have the indirect effect + # of forcing a sync + run_cmd_always mount -o remount,rw $ORIG_USERFS || true + run_cmd_always mount -o remount,rw $ORIG_BOOTFS || true + fi is_mounted $WORKING_BOOTFS && run_cmd_always umount -f $WORKING_BOOTFS || true is_mounted $WORKING_CONFIGFS && run_cmd_always umount -f $WORKING_CONFIGFS || true + is_mounted $WORKING_GRUBFS && run_cmd_always umount -f $WORKING_GRUBFS || true + [[ -d $WORKING_GRUBFS ]] && run_cmd_always rmdir $WORKING_GRUBFS || true is_mounted $WORKING_USERFS && run_cmd_always umount -f $WORKING_USERFS || true [[ -d $WORKING_USERFS ]] && run_cmd_always rmdir $WORKING_USERFS || true [[ -f $IMAGE_FILE_TEMP ]] && run_cmd_always rm -f "$IMAGE_FILE_TEMP" || true @@ -657,10 +759,11 @@ dump_settings () { } parse_settings () { - while getopts :b:B:f:hnp:s:vx: opt ; do + while getopts :b:B:df:hnp:s:vx: opt ; do case $opt in b) BLACKLIST_LISTS+=("$OPTARG") ;; B) BLACKLIST_PATHS+=("$OPTARG") ;; + d) DISPLAY_PROGRESS_ARG="" ;; f) IMAGE_FILE="$OPTARG" ;; h) print_help; exit 0 ;; n) NOEXEC=1 ;; @@ -675,13 +778,13 @@ parse_settings () { check_settings () { case "$MODE" in - get|set|wipelist) ;; + get|set|wipelist|getall|setall) ;; "-h") print_help; exit 0 ;; "") die_with_help "Mode must be specified" ;; *) die_with_help "Unknown mode '$MODE'";; esac - if ! is_set; then + if ! is_set && ! is_setall; then if [[ $PRIMARY_SETTING || $SECONDARY_SETTING ]]; then die_with_help "-p, -s only allowed on nisystemimage set" fi @@ -706,7 +809,7 @@ check_settings () { esac - if ! is_set && [[ $IMAGE_FILE ]]; then + if ! is_set && ! is_setall && [[ $IMAGE_FILE ]]; then # Convert relative image path to absolute path [[ "$IMAGE_FILE" =~ ^/ ]] \ || IMAGE_FILE="$PWD/$IMAGE_FILE" @@ -757,7 +860,7 @@ check_settings () { # NOTE: "Set Image" under run mode is guaranteed to fail. "Get Image" is # merely unsupported and probably won't work. - if ! in_safemode; then ORIG_USERFS=/; fi + if ! in_safemode && ! in_restoremode ; then ORIG_USERFS=/; fi local -a escaped_excludes=() escaped_excludes+=("${BLACKLIST_PATHS[@]:+${BLACKLIST_PATHS[@]#/}}") @@ -786,9 +889,11 @@ trap 'handle_err ${BASH_SOURCE} ${LINENO} ${FUNCNAME:-unknown} $?' ERR [[ -f $SCRIPT_ROOTFS ]] && . "$SCRIPT_ROOTFS" [[ -f $SCRIPT_PRE ]] && . "$SCRIPT_PRE" -case "$(runlevel)" in -*\ 6|*\ 0) die ILLTIMED "Called during shutdown; aborting." ;; -esac +if ! in_restoremode; then + case "$(runlevel)" in + *\ 6|*\ 0) die ILLTIMED "Called during shutdown; aborting." ;; + esac +fi # Process settings run_hook hook_settings_pre diff --git a/recipes-ni/ni-systemimage/ni-systemimage.bb b/recipes-ni/ni-systemimage/ni-systemimage.bb index d4fa50bfa..9a8eaba90 100644 --- a/recipes-ni/ni-systemimage/ni-systemimage.bb +++ b/recipes-ni/ni-systemimage/ni-systemimage.bb @@ -30,7 +30,9 @@ FILES:${PN} += "\ RDEPENDS:${PN} += "\ bash \ findutils \ + gzip \ ni-netcfgutil \ - ni-utils \ niacctbase \ + pv \ + tar \ " diff --git a/recipes-ni/ni-systemreplication/files/nisystemreplication b/recipes-ni/ni-systemreplication/files/nisystemreplication new file mode 100644 index 000000000..fd9414c7b --- /dev/null +++ b/recipes-ni/ni-systemreplication/files/nisystemreplication @@ -0,0 +1,230 @@ +#!/bin/bash +set -e + +# MODE determines the operation to be performed +# get or set +declare -r MODE="${1:-}" + +NIRECOVERY_MOUNTPOINT=/mnt/NIRECOVERY + +# ---------------------- Get Image ---------------------- + +get_device_desc () { + local DeviceDesc=$(fw_printenv -n DeviceDesc 2>/dev/null) + if [ -z "$DeviceDesc" ]; then + DeviceDesc="UnknownDevice" + fi + + echo $DeviceDesc +} + +get_default_image_name () { + local DeviceDesc=$(get_device_desc) + local Date=$(date +%F-%H-%M-%S) + + echo $DeviceDesc-$Date +} + +get_image_name () { + local default_image_name=$(get_default_image_name) + read -e -p "Enter image name (no spaces, no special chars except '-'): " -i "$default_image_name" image_name + echo $image_name +} + +get_ext4_features () { + local bootfs_device=$(blkid -L nibootfs) + echo $(debugfs -R features $bootfs_device 2>/dev/null | awk -F: '{if ($1 == "Filesystem features") print $2}' | xargs | sed 's/ /,/g') +} + +ext4_has_unsupported_features () { + e2fsck -n LABEL=nibootfs 2>&1 | grep "unsupported feature" +} + +get_filesystem_attribute () { + local label=$1 + local column=$2 + + local tempdir=$(mktemp -d) + + if ! mount -L $label $tempdir &>/dev/null; then + echo "Error mounting $label partition" >&2 && return + fi + + available_space=$(df $tempdir | tail -1 | awk -v column="$column" '{print $column}') + umount $tempdir + rmdir $tempdir + echo $available_space +} + +get_used_filesystem_size () { + get_filesystem_attribute $1 3 +} + +get_available_filesystem_size () { + get_filesystem_attribute $1 4 +} + +get_estimated_image_size () { + nigrub_size=$(get_used_filesystem_size "nigrub") + nibootfs_size=$(get_used_filesystem_size "nibootfs") + niconfig_size=$(get_used_filesystem_size "niconfig") + nirootfs_size=$(get_used_filesystem_size "nirootfs") + + total_size=$(($nigrub_size + $nibootfs_size + $niconfig_size + $nirootfs_size)) + echo $total_size +} + +is_image_valid () { + local image_name=$1 + if [ -z "$image_name" ]; then + echo "No image name specified. Please specify an image name" && return 1 + fi + # If image already exists, confirm if it should be overwritten + if [ -f $NIRECOVERY_MOUNTPOINT/Images/$image_name/systemimage.conf ]; then + read -e -p "An image already exits with this name. Overwrite? (y/N): " -i "N" overwrite + [ $overwrite != "y" ] && return 1 + fi + return 0 +} + +image_get () { + if ! mount -o remount,rw,async $NIRECOVERY_MOUNTPOINT; then + die "Mount failure. No writable media labelled NIRECOVERY." + fi + + if ext4_has_unsupported_features; then + die "Unsupported filesystem features detected. Please use a newer version of recovery media." + fi + + local nirecovery_available_space=$(get_available_filesystem_size "NIRECOVERY") + local estimated_image_size=$(get_estimated_image_size) + + [ $estimated_image_size -eq "0" ] && die "Error estimating image size" + [ $nirecovery_available_space -lt $estimated_image_size ] && die "Image might not fit on media. Estimated image size: $estimated_image_size. Available space on media: $nirecovery_available_space" + + local image_name=$PROVISION_SYSTEMIMAGE_NAME + if [ -z $image_name ]; then + image_name=$(get_image_name) + # If no image name is provided, retry + while ! is_image_valid $image_name; do + image_name=$(get_image_name) + done + fi + + # Cleanup any existing image files with same name first + rm -rf $NIRECOVERY_MOUNTPOINT/Images/$image_name + mkdir -p $NIRECOVERY_MOUNTPOINT/Images/$image_name + echo "Getting system image $image_name. This may take a while" >&2 + local ext4_features=$(get_ext4_features) + # Split files at FAT32's max file size i.e., 2^32 - 1 + nisystemimage getall -d -x tgz | split --bytes=$((2**32 - 1)) -d -a4 - $NIRECOVERY_MOUNTPOINT/Images/$image_name/systemimage.tgz + + echo "DeviceDesc=$(get_device_desc)" > $NIRECOVERY_MOUNTPOINT/Images/$image_name/systemimage.conf + echo "Ext4Features=$ext4_features" >> $NIRECOVERY_MOUNTPOINT/Images/$image_name/systemimage.conf + + sync + mount -o remount,ro $NIRECOVERY_MOUNTPOINT + echo "Image $image_name saved." +} + +# ---------------------- Set Image ---------------------- + +# Presents a list of existing compatible images and let's user select one +select_image_from_list () { + [ ! -d $NIRECOVERY_MOUNTPOINT/Images ] && return + + images=() + + for image in $(ls $NIRECOVERY_MOUNTPOINT/Images); do + if [ ! -f $NIRECOVERY_MOUNTPOINT/Images/$image/systemimage.tgz0000 ] || [ ! -f $NIRECOVERY_MOUNTPOINT/Images/$image/systemimage.conf ]; then + echo "WARNING: Image \"$image\" is missing systemimage.tgz* or systemimage.conf" >&2 + continue + fi + + local ImageDeviceDesc=$(awk -F= '{if ($1 == "DeviceDesc") print $2}' $NIRECOVERY_MOUNTPOINT/Images/$image/systemimage.conf) + if [ "$(get_device_desc)" = "$ImageDeviceDesc" ]; then + images+=($image) + fi + done + + [ -z $images ] && return + local no_of_images=${#images[@]} + + echo "" >&2 + echo "Compatible system images found on media:" >&2 + + PS3="Select an image to use for provisioning: " + select opt in "${images[@]}"; do + case $opt in + *) + if [[ "$REPLY" =~ ^[0-9]+$ ]] && [ $REPLY -gt 0 ] && [ $REPLY -le $no_of_images ]; then + echo $opt + break + fi + ;; + esac + done +} + +image_set () { + if [[ $(type -t early_setup) != function ]]; then + # If we're here, the script was invoked manually i.e., not from init. + # So do the required setup. + source /ni_provisioning.common + early_setup + fi + + local image_name=$PROVISION_SYSTEMIMAGE_NAME + if [ -z $image_name ]; then + image_name=$(select_image_from_list) + [ -z "$image_name" ] && die "No compatible system images found on the media" + fi + + if [[ "$PROVISION_REPARTITION_TARGET" != "y" ]]; then + ask_for_continue "ReplicateImage" "PROVISION_REPARTITION_TARGET" "$image_name" + fi + + if [[ $PROVISION_REPARTITION_TARGET == "y" ]]; then + ext4_features=$(awk -F= '{if ($1 == "Ext4Features") print $2}' $NIRECOVERY_MOUNTPOINT/Images/$image_name/systemimage.conf) + # Start with "none" so that default features are not enabled if not listed in $ext4_features + MKFS_ARGS="${MKFS_ARGS} -O none,$ext4_features" + source /ni_provisioning.safemode.common + + check_all_used_binaries + + echo "Installing to: $TARGET_DISK." + echo 6 > /proc/sys/kernel/printk + + print_info "Disabling automount..." + disable_automount + print_done + + partitioning_disk + wait_for_partitions $TARGET_DISK + create_filesystems + + prune_efi_crash_vars + + echo "Applying system image $image_name. This may take a while" >&2 + cat $NIRECOVERY_MOUNTPOINT/Images/$image_name/systemimage.tgz* | nisystemimage setall -d -x tgz -p reset -s reset + + set_efiboot_entry + + mount_grub_partition + mount_bootfs_partition + fix_grubenv_after_usbreplication + + echo $LOG_LEVEL > /proc/sys/kernel/printk + sanity_check + + print_info "Re-enabling automount..." + enable_automount + print_done + fi + + trap - ERR + exec 1>&3 + exec 2>&4 +} + +image_${MODE} diff --git a/recipes-ni/ni-systemreplication/ni-systemreplication.bb b/recipes-ni/ni-systemreplication/ni-systemreplication.bb new file mode 100644 index 000000000..25e33fa94 --- /dev/null +++ b/recipes-ni/ni-systemreplication/ni-systemreplication.bb @@ -0,0 +1,25 @@ +SUMMARY = "A system replication utility for NI LinuxRT" +DESCRIPTION = "Installs the nisystemreplication utility" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" +SECTION = "base" + +SRC_URI = "\ + file://nisystemreplication \ +" + +S = "${WORKDIR}" + +do_install () { + install -d ${D}${base_sbindir} + install -m 0550 ${S}/nisystemreplication ${D}${base_sbindir} +} + + +FILES:${PN} += "\ + ${base_sbindir}/nisystemreplication \ +" +RDEPENDS:${PN} += "\ + bash \ + ni-systemimage \ +" diff --git a/recipes-ni/ni-utils/files/functions.common b/recipes-ni/ni-utils/files/functions.common index aa152cbc5..a127885b3 100644 --- a/recipes-ni/ni-utils/files/functions.common +++ b/recipes-ni/ni-utils/files/functions.common @@ -695,19 +695,6 @@ update_all_interface_info () { done } -update_driver_priorities () { - for d in /proc/irq/*; do - # Adjust wl12xx priority to something - # that allows reclamation of RCU objects - # through ksoftirqd under prolonged heavy - # wireless traffic conditions - if [ -d "$d"/wl12xx ]; then - echo 7 > "$d"/priority - break - fi - done -} - # Usage: enable_net_hotplug # Sets the flag so that enables hotplug.script to run enable_net_hotplug () { diff --git a/recipes-ni/nilrt-snac/files/run-ptest b/recipes-ni/nilrt-snac/files/run-ptest new file mode 100644 index 000000000..053978fee --- /dev/null +++ b/recipes-ni/nilrt-snac/files/run-ptest @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 + +import pytest + +pytest.main([ + "-v", + "/usr/lib/nilrt-snac/tests/integration", +]) diff --git a/recipes-ni/nilrt-snac/nilrt-snac_git.bb b/recipes-ni/nilrt-snac/nilrt-snac_git.bb new file mode 100644 index 000000000..9e559e798 --- /dev/null +++ b/recipes-ni/nilrt-snac/nilrt-snac_git.bb @@ -0,0 +1,46 @@ +SUMMARY = "NILRT SNAC Configuration Tool" +DESCRIPTION = "\ +A utility for admins to put a NILRT system into the SNAC configuration.\ +" +HOMEPAGE = "https://github.com/ni/nilrt-snac" +SECTION = "base" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=380df876633ca23587b9851600778cc0" + + +SRC_URI = "\ + git://github.com/ni/nilrt-snac;branch=master;protocol=https \ + file://run-ptest \ +" + +SRCREV = "${AUTOREV}" +PV = "0.1.1+git${SRCPV}" + +S = "${WORKDIR}/git" + + +inherit ptest + + +do_install() { + oe_runmake install \ + DESTDIR=${D} +} + +do_install_ptest() { + install -m 0755 ${WORKDIR}/run-ptest ${D}${PTEST_PATH} +} + + +RDEPENDS:${PN} = "\ + bash \ + opkg \ + python3-core \ +" + +FILES:${PN}-ptest += "${libdir}/${PN}/tests/integration" +RDEPENDS:${PN}-ptest += "\ + bash \ + python3-core \ + python3-pytest \ +" diff --git a/recipes-rt/rt-tests/files/kthread_test_priority.sh b/recipes-rt/rt-tests/files/kthread_test_priority.sh index 60f04477e..2f7850443 100755 --- a/recipes-rt/rt-tests/files/kthread_test_priority.sh +++ b/recipes-rt/rt-tests/files/kthread_test_priority.sh @@ -33,13 +33,28 @@ function check_prio_for_task() { fi } +# Check if there are any tasks running as SCHED_FIFO priority 1. On NILRT +# systems we expect this RT policy/priority level to be used only by the +# ksoftirqd/x tasks. +function check_tasks_fifo_1() { + ptest_pass + + fifo_1_tasks=$(ps -e -x -o policy,rtprio,comm | awk '$1 == "FF" && $2 == 1 && $3 !~ /^ksoftirqd\/[0-9]+/ {print $3}') + + if [ ! -z "$fifo_1_tasks" ]; then + echo "unexpected tasks found running at FIFO/1 priority:" + echo "$fifo_1_tasks" + ptest_fail + fi +} + ptest_change_subtest 1 kthreadd check_prio_for_task kthreadd FIFO 25 ptest_report rc_first=$ptest_rc ptest_change_subtest 2 ksoftirqd -check_prio_for_task ksoftirqd/0 FIFO 8 +check_prio_for_task ksoftirqd/0 FIFO 1 ptest_report ptest_change_subtest 3 irq @@ -50,4 +65,28 @@ ptest_change_subtest 4 irq_work check_prio_for_task irq_work/ FIFO 12 ptest_report +ptest_change_subtest 5 ktimers +check_prio_for_task ktimers/ FIFO 10 +ptest_report + +ptest_change_subtest 6 rcub +check_prio_for_task rcub/ FIFO 2 +ptest_report + +ptest_change_subtest 7 rcuc +check_prio_for_task rcuc/ FIFO 2 +ptest_report + +ptest_change_subtest 8 rcuog +check_prio_for_task rcuog/ FIFO 2 +ptest_report + +ptest_change_subtest 9 rcu_preempt +check_prio_for_task rcu_preempt FIFO 2 +ptest_report + +ptest_change_subtest 10 fifo_1 +check_tasks_fifo_1 +ptest_report + exit $rc_first diff --git a/recipes-rt/rtctl/files/rtgroups b/recipes-rt/rtctl/files/rtgroups index 87da030da..71bb7b8d2 100644 --- a/recipes-rt/rtctl/files/rtgroups +++ b/recipes-rt/rtctl/files/rtgroups @@ -41,5 +41,7 @@ kthreadd:f:25:*:\[kthreadd\]$ irqthread:f:15:*:\[irq\/.+\]$ irq_work:f:12:*:\[irq_work\/.+\]$ -ksoftirqd:f:8:*:\[ksoftirqd\/.+\]$ - +ktimers:f:10:*:\[ktimers\/.+\]$ +rcu:f:2:*:\[rcu(b|c|og)\/[0-9]+\]$ +rcu_preempt:f:2:\[rcu_preempt\]$ +ksoftirqd:f:1:*:\[ksoftirqd\/.+\]$ diff --git a/recipes-support/curl/curl/0001-Added-curl_easy_getinfo_va-API-function.patch b/recipes-support/curl/curl/0001-Added-curl_easy_getinfo_va-API-function.patch deleted file mode 100644 index 4d16290ff..000000000 --- a/recipes-support/curl/curl/0001-Added-curl_easy_getinfo_va-API-function.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonathan David -Date: Mon, 21 Jul 2014 15:02:35 -0500 -Subject: [PATCH] Added curl_easy_getinfo_va() API function - -Added API function with `va_list` variable argument parameter in -addition to cURL's function using `...`. - -Upstream-Status: Submitted [curl-library@cool.haxx.se] - -diff --git a/lib/easy.c b/lib/easy.c -index a69eb9e56..9a5f09fce 100644 ---- a/lib/easy.c -+++ b/lib/easy.c -@@ -745,18 +745,27 @@ void curl_easy_cleanup(struct Curl_easy *data) - * information from a performed transfer and similar. - */ - #undef curl_easy_getinfo --CURLcode curl_easy_getinfo(struct Curl_easy *data, CURLINFO info, ...) -+CURLcode curl_easy_getinfo_va(struct Curl_easy *data, CURLINFO info, va_list arg) - { -- va_list arg; - void *paramp; - CURLcode result; - -- va_start(arg, info); - paramp = va_arg(arg, void *); -- - result = Curl_getinfo(data, info, paramp); - -+ return result; -+} -+ -+#undef curl_easy_getinfo -+CURLcode curl_easy_getinfo(struct Curl_easy *data, CURLINFO info, ...) -+{ -+ CURLcode result; -+ va_list arg; -+ va_start(arg, info); -+ -+ result = curl_easy_getinfo_va(data, info, arg); - va_end(arg); -+ - return result; - } - --- -2.28.0 - diff --git a/recipes-support/curl/curl/0002-Added-curl_formadd_va-API-function.patch b/recipes-support/curl/curl/0002-Added-curl_formadd_va-API-function.patch deleted file mode 100644 index c339eae85..000000000 --- a/recipes-support/curl/curl/0002-Added-curl_formadd_va-API-function.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonathan David -Date: Tue, 15 Mar 2016 14:13:28 -0500 -Subject: [PATCH] Added curl_formadd_va() API function - -Added API function with `va_list` variable argument parameter in -addition to cURL's function using `...`. - -Upstream-Status: Submitted [curl-library@cool.haxx.se] - -diff --git a/lib/formdata.c b/lib/formdata.c -index 1cab2c5c2..1c85b2a1d 100644 ---- a/lib/formdata.c -+++ b/lib/formdata.c -@@ -690,6 +690,13 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, - * @unittest: 1308 - */ - -+CURLFORMcode curl_formadd_va(struct curl_httppost **httppost, -+ struct curl_httppost **last_post, -+ va_list arg) -+{ -+ return FormAdd(httppost, last_post, arg); -+} -+ - CURLFORMcode curl_formadd(struct curl_httppost **httppost, - struct curl_httppost **last_post, - ...) -@@ -697,7 +704,7 @@ CURLFORMcode curl_formadd(struct curl_httppost **httppost, - va_list arg; - CURLFORMcode result; - va_start(arg, last_post); -- result = FormAdd(httppost, last_post, arg); -+ result = curl_formadd_va(httppost, last_post, arg); - va_end(arg); - return result; - } --- -2.28.0 - diff --git a/recipes-support/curl/curl/0003-Added-curl_multi_setopt_va-API-function.patch b/recipes-support/curl/curl/0003-Added-curl_multi_setopt_va-API-function.patch deleted file mode 100644 index c73ec124a..000000000 --- a/recipes-support/curl/curl/0003-Added-curl_multi_setopt_va-API-function.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonathan David -Date: Mon, 21 Jul 2014 14:32:25 -0500 -Subject: [PATCH] Added curl_multi_setopt_va() API function - -Added API function with `va_list` variable argument parameter in -addition to cURL's function using `...`. - -Upstream-Status: Submitted [curl-library@cool.haxx.se] - -diff --git a/lib/multi.c b/lib/multi.c -index 3c7fb85ed..4cd825d6c 100644 ---- a/lib/multi.c -+++ b/lib/multi.c -@@ -2914,12 +2914,10 @@ static CURLMcode multi_socket(struct Curl_multi *multi, - return result; - } - --#undef curl_multi_setopt --CURLMcode curl_multi_setopt(struct Curl_multi *multi, -- CURLMoption option, ...) -+CURLMcode curl_multi_setopt_va(struct Curl_multi *multi, -+ CURLMoption option, va_list param) - { - CURLMcode res = CURLM_OK; -- va_list param; - - if(!GOOD_MULTI_HANDLE(multi)) - return CURLM_BAD_HANDLE; -@@ -2927,8 +2925,6 @@ CURLMcode curl_multi_setopt(struct Curl_multi *multi, - if(multi->in_callback) - return CURLM_RECURSIVE_API_CALL; - -- va_start(param, option); -- - switch(option) { - case CURLMOPT_SOCKETFUNCTION: - multi->socket_cb = va_arg(param, curl_socket_callback); -@@ -2983,7 +2979,21 @@ CURLMcode curl_multi_setopt(struct Curl_multi *multi, - res = CURLM_UNKNOWN_OPTION; - break; - } -+ -+ return res; -+} -+ -+#undef curl_multi_setopt -+CURLMcode curl_multi_setopt(struct Curl_multi *multi, -+ CURLMoption option, ...) -+{ -+ CURLMcode res; -+ va_list param; -+ va_start(param, option); -+ -+ res = curl_multi_setopt_va(multi, option, param); - va_end(param); -+ - return res; - } - --- -2.28.0 - diff --git a/recipes-support/curl/curl/0004-Added-curl_share_setopt_va-API-function.patch b/recipes-support/curl/curl/0004-Added-curl_share_setopt_va-API-function.patch deleted file mode 100644 index 7dfdc4194..000000000 --- a/recipes-support/curl/curl/0004-Added-curl_share_setopt_va-API-function.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonathan David -Date: Mon, 21 Jul 2014 14:25:07 -0500 -Subject: [PATCH] Added curl_share_setopt_va() API function - -Added API function with `va_list` variable argument parameter in -addition to cURL's function using `...`. - -Upstream-Status: Submitted [curl-library@cool.haxx.se] - -diff --git a/lib/share.c b/lib/share.c -index a2d896042..ab215daf9 100644 ---- a/lib/share.c -+++ b/lib/share.c -@@ -48,11 +48,9 @@ curl_share_init(void) - return share; - } - --#undef curl_share_setopt - CURLSHcode --curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...) -+curl_share_setopt_va(struct Curl_share *share, CURLSHoption option, va_list param) - { -- va_list param; - int type; - curl_lock_function lockfunc; - curl_unlock_function unlockfunc; -@@ -64,8 +62,6 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...) - using this share */ - return CURLSHE_IN_USE; - -- va_start(param, option); -- - switch(option) { - case CURLSHOPT_SHARE: - /* this is a type this share will share */ -@@ -176,6 +172,18 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...) - break; - } - -+ return res; -+} -+ -+#undef curl_share_setopt -+CURLSHcode -+curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...) -+{ -+ CURLSHcode res; -+ va_list param; -+ va_start(param, option); -+ -+ res = curl_share_setopt_va(share, option, param); - va_end(param); - - return res; --- -2.28.0 - diff --git a/recipes-support/curl/curl/0005-Add-nicurl-wrapper-functions.patch b/recipes-support/curl/curl/0005-Add-nicurl-wrapper-functions.patch deleted file mode 100644 index 305785c99..000000000 --- a/recipes-support/curl/curl/0005-Add-nicurl-wrapper-functions.patch +++ /dev/null @@ -1,126 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonathan David -Date: Tue, 15 Mar 2016 13:26:34 -0500 -Subject: [PATCH] Add nicurl wrapper functions - -Added the following API wrapper functions: -nicurl_easy_getinfo -nicurl_easy_setopt -nicurl_formadd -nicurl_multi_setopt -nicurl_share_setopt - -These functions are called by older NI components, and exist as -a means to keep previous code running. - -Upstream-Status: Inappropriate [NI specific changes] - -diff --git a/lib/easy.c b/lib/easy.c -index 9a5f09fce..1e2b0aaa4 100644 ---- a/lib/easy.c -+++ b/lib/easy.c -@@ -308,6 +308,16 @@ struct Curl_easy *curl_easy_init(void) - return data; - } - -+#ifdef ENABLE_NICURL_API -+CURL_EXTERN CURLcode nicurl_easy_setopt(CURL *curl, CURLoption tag, va_list arg) -+{ -+ CURLcode result; -+ result = Curl_vsetopt(curl, tag, arg); -+ va_end(arg); -+ return result; -+} -+#endif -+ - #ifdef CURLDEBUG - - struct socketmonitor { -@@ -769,6 +779,17 @@ CURLcode curl_easy_getinfo(struct Curl_easy *data, CURLINFO info, ...) - return result; - } - -+#ifdef ENABLE_NICURL_API -+CURL_EXTERN CURLcode nicurl_easy_getinfo(CURL *curl, CURLINFO info, va_list arg) -+{ -+/* Unlike other nicurl functions, this one did not previously call va_start() -+ * nor va_end(). Thus, it can behave as expected of variadic functions that -+ * are passed va_list. -+ */ -+ return curl_easy_getinfo_va(curl, info, arg); -+} -+#endif -+ - static CURLcode dupset(struct Curl_easy *dst, struct Curl_easy *src) - { - CURLcode result = CURLE_OK; -diff --git a/lib/formdata.c b/lib/formdata.c -index 1c85b2a1d..a5a560acf 100644 ---- a/lib/formdata.c -+++ b/lib/formdata.c -@@ -709,6 +709,18 @@ CURLFORMcode curl_formadd(struct curl_httppost **httppost, - return result; - } - -+#ifdef ENABLE_NICURL_API -+CURL_EXTERN CURLFORMcode nicurl_formadd(struct curl_httppost **httppost, -+ struct curl_httppost **last_post, -+ va_list arg) -+{ -+ CURLFORMcode result; -+ result = curl_formadd_va(httppost, last_post, arg); -+ va_end(arg); -+ return result; -+} -+#endif -+ - /* - * curl_formget() - * Serialize a curl_httppost struct. -diff --git a/lib/multi.c b/lib/multi.c -index 4cd825d6c..13c8c57ff 100644 ---- a/lib/multi.c -+++ b/lib/multi.c -@@ -2997,6 +2997,17 @@ CURLMcode curl_multi_setopt(struct Curl_multi *multi, - return res; - } - -+#ifdef ENABLE_NICURL_API -+CURL_EXTERN CURLMcode nicurl_multi_setopt(CURLM *multi_handle, -+ CURLMoption option, va_list param) -+{ -+ CURLMcode result; -+ result = curl_multi_setopt_va(multi_handle, option, param); -+ va_end(param); -+ return result; -+} -+#endif -+ - /* we define curl_multi_socket() in the public multi.h header */ - #undef curl_multi_socket - -diff --git a/lib/share.c b/lib/share.c -index ab215daf9..a57e78b7b 100644 ---- a/lib/share.c -+++ b/lib/share.c -@@ -189,6 +189,17 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...) - return res; - } - -+#ifdef ENABLE_NICURL_API -+CURLSHcode -+CURL_EXTERN nicurl_share_setopt(CURLSH *sh, CURLSHoption option, va_list param) -+{ -+ CURLSHcode result; -+ result = curl_share_setopt_va(sh, option, param); -+ va_end(param); -+ return result; -+} -+#endif -+ - CURLSHcode - curl_share_cleanup(struct Curl_share *share) - { --- -2.28.0 - diff --git a/recipes-support/curl/curl/0006-Add-global-init-mutex.patch b/recipes-support/curl/curl/0006-Add-global-init-mutex.patch deleted file mode 100644 index 10911b9ab..000000000 --- a/recipes-support/curl/curl/0006-Add-global-init-mutex.patch +++ /dev/null @@ -1,229 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Haris Okanovic -Date: Tue, 17 May 2016 12:57:33 -0500 -Subject: [PATCH] Add global init mutex - -Add global_mutex.cpp/h to allow for thread-safe (un)initialization -of libcurl. - -Upstream-Status: Inappropriate [NIBuild only] - -diff --git a/lib/global_mutex.cpp b/lib/global_mutex.cpp -new file mode 100644 -index 000000000..72f202eec ---- /dev/null -+++ b/lib/global_mutex.cpp -@@ -0,0 +1,186 @@ -+/* Implementation of curl_global_mutex_lock() and curl_global_mutex_unlock(). -+ * -+ * @note This C++ source file MUST NOT throw exceptions, use RTTI, or -+ * declare try/catch blocks, as doing so would result in unpredictable -+ * behavior in this C DLL since it doesn't link to libstdc++. -+ * Nothing in this file is even capable of throwing since every -+ * external function we call is a C API of the operating system. -+ * -+ * ToDo: Rewrite this in C instead of C++. -+ */ -+ -+#include -+#include -+#include "global_mutex.h" -+ -+#ifdef _WIN32 -+ #include -+#elif defined VXWORKS_PPC -+ #include -+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) || defined(linux) || defined(__linux__) || defined(__gnu_linux__) || defined(__linux) -+ #include -+#else -+ #error "Unsupported platform" -+#endif -+ -+namespace -+{ -+#if defined(linux) || defined(__linux__) || defined(__gnu_linux__) || defined(__linux) -+ static pthread_mutex_t mutex_ = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; -+#endif -+ -+#if defined(_WIN32) || defined(VXWORKS_PPC) || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -+ -+ static volatile bool g_cs_initialized = false; -+ -+ struct _CriticalSection -+ { -+#ifdef _WIN32 -+ CRITICAL_SECTION cs_; -+#elif defined VXWORKS_PPC -+ SEM_ID sem_; -+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -+ // ToDo: Switch Mac to PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP once -+ // toolchain supports it -+ pthread_mutex_t mutex_; -+#endif -+ -+ inline _CriticalSection() -+ { -+#ifdef _WIN32 -+ InitializeCriticalSection(&cs_); -+#elif defined VXWORKS_PPC -+ sem_ = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE); -+ if (sem_ == NULL) -+ { -+ perror("cURL fatal error: Error initializing mutex"); -+ exit(-1); -+ } -+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -+ /* PTHREAD_RECURSIVE_MUTEX_INITIALIZER not supported by xcode3.2-gcc4.2 -+ * create a mutex that can be locked recursively by the same thread */ -+ pthread_mutexattr_t attr; -+ if (pthread_mutexattr_init(&attr)) -+ { -+ perror("cURL fatal error: Error initializing mutex attribute"); -+ exit(-1); -+ } -+ if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)) -+ { -+ perror("cURL fatal error: Error setting mutex recursive attribute"); -+ exit(-1); -+ } -+ if (pthread_mutex_init(&mutex_, &attr)) -+ { -+ perror("cURL fatal error: Error initializing mutex"); -+ exit(-1); -+ } -+ if (pthread_mutexattr_destroy(&attr)) -+ { -+ perror("cURL fatal error: Error destroying mutex attribute"); -+ exit(-1); -+ } -+#endif -+ g_cs_initialized = true; -+ } -+ -+ -+ inline ~_CriticalSection() -+ { -+ g_cs_initialized = false; -+#ifdef _WIN32 -+ DeleteCriticalSection(&cs_); -+#elif defined VXWORKS_PPC -+ if (semDelete(sem_)) -+ { -+ perror("cURL fatal error: Error deleting mutex"); -+ exit(-1); -+ } -+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -+ if (pthread_mutex_destroy(&mutex_)) -+ { -+ perror("cURL fatal error: Error deleting mutex"); -+ exit(-1); -+ } -+#endif -+ } -+ -+ inline void lock() -+ { -+#ifdef _WIN32 -+ EnterCriticalSection(&cs_); -+#elif defined VXWORKS_PPC -+ if (semTake(sem_, WAIT_FOREVER)) -+ { -+ perror("cURL fatal error: Error locking mutex"); -+ exit(-1); -+ } -+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -+ if (pthread_mutex_lock(&mutex_)) -+ { -+ perror("cURL fatal error: Error locking mutex"); -+ exit(-1); -+ } -+#endif -+ } -+ -+ inline void unlock() -+ { -+#ifdef _WIN32 -+ LeaveCriticalSection(&cs_); -+#elif defined VXWORKS_PPC -+ if (semGive(sem_)) -+ { -+ perror("cURL fatal error: Error unlocking mutex"); -+ exit(-1); -+ } -+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -+ if (pthread_mutex_unlock(&mutex_)) -+ { -+ perror("cURL fatal error: Error unlocking mutex"); -+ exit(-1); -+ } -+#endif -+ } -+ }; -+ -+ static _CriticalSection g_cs; -+#endif -+} -+ -+extern "C" -+{ -+ void curl_global_mutex_lock() -+ { -+ // Do NOT add try/catch blocks here. See comments above for details. -+#if defined(_WIN32) || defined(VXWORKS_PPC) || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -+ if (g_cs_initialized) -+ { -+ g_cs.lock(); -+ } -+#elif defined(linux) || defined(__linux__) || defined(__gnu_linux__) || defined(__linux) -+ if (pthread_mutex_lock(&mutex_)) -+ { -+ perror("cURL fatal error: Error locking mutex"); -+ exit(-1); -+ } -+#endif -+ } -+ -+ void curl_global_mutex_unlock() -+ { -+ // Do NOT add try/catch blocks here. See comments above for details. -+#if defined(_WIN32) || defined(VXWORKS_PPC) || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -+ if (g_cs_initialized) -+ { -+ g_cs.unlock(); -+ } -+#elif defined(linux) || defined(__linux__) || defined(__gnu_linux__) || defined(__linux) -+ if (pthread_mutex_unlock(&mutex_)) -+ { -+ perror("cURL fatal error: Error unlocking mutex"); -+ exit(-1); -+ } -+#endif -+ } -+} -diff --git a/lib/global_mutex.h b/lib/global_mutex.h -new file mode 100644 -index 000000000..87aae31e5 ---- /dev/null -+++ b/lib/global_mutex.h -@@ -0,0 +1,18 @@ -+#ifndef HEADER_CURL_GLOBAL_MUTEX_H -+#define HEADER_CURL_GLOBAL_MUTEX_H -+ -+/* -+ * Implementation of curl_global_mutex_lock() and curl_global_mutex_unlock(). -+ */ -+ -+#ifdef __cplusplus -+extern "C" -+{ -+#endif -+ void curl_global_mutex_lock(); -+ void curl_global_mutex_unlock(); -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* HEADER_CURL_GLOBAL_MUTEX_H */ --- -2.28.0 - diff --git a/recipes-support/curl/curl/0007-Made-curl_global_init-thread-safe.patch b/recipes-support/curl/curl/0007-Made-curl_global_init-thread-safe.patch deleted file mode 100644 index 8fac6dc11..000000000 --- a/recipes-support/curl/curl/0007-Made-curl_global_init-thread-safe.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Ioan-Adrian Ratiu -Date: Wed, 16 Nov 2016 16:07:23 +0200 -Subject: [PATCH] Made curl_global_init() thread safe - -Originally done by J.David but I had to redo the commit because his patch -had a bad sha1 sum, probably because it was based on a non-public commit. - -Upstream-Status: Inappropriate [creates Linux dependency] - -Signed-off-by: Jonathan David -Signed-off-by: Ioan-Adrian Ratiu - -Updated for curl 7.72. - -Signed-off-by: Richard Tollerton - - -diff --git a/lib/easy.c b/lib/easy.c -index 1e2b0aaa4..8464ef347 100644 ---- a/lib/easy.c -+++ b/lib/easy.c -@@ -21,6 +21,7 @@ - ***************************************************************************/ - - #include "curl_setup.h" -+#include "global_mutex.h" - - /* - * See comment in curl_memory.h for the explanation of this sanity check. -@@ -140,8 +141,17 @@ curl_calloc_callback Curl_ccalloc; - */ - static CURLcode global_init(long flags, bool memoryfuncs) - { -+#ifdef CURL_THREAD_SAFE_INIT -+ curl_global_mutex_lock(); -+#endif -+ - if(initialized++) -+ { -+#ifdef CURL_THREAD_SAFE_INIT -+ curl_global_mutex_unlock(); -+#endif - return CURLE_OK; -+ } - - if(memoryfuncs) { - /* Setup the default memory functions here (again) */ -@@ -202,8 +212,14 @@ static CURLcode global_init(long flags, bool memoryfuncs) - -+#ifdef CURL_THREAD_SAFE_INIT -+ curl_global_mutex_unlock(); -+#endif - return CURLE_OK; - - fail: - initialized--; /* undo the increase */ -+#ifdef CURL_THREAD_SAFE_INIT -+ curl_global_mutex_unlock(); -+#endif - return CURLE_FAILED_INIT; - } - --- -2.28.0 - diff --git a/recipes-support/curl/curl/0008-Made-curl_global_cleanup-thread-safe.patch b/recipes-support/curl/curl/0008-Made-curl_global_cleanup-thread-safe.patch deleted file mode 100644 index 9403fc32f..000000000 --- a/recipes-support/curl/curl/0008-Made-curl_global_cleanup-thread-safe.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonathan David -Date: Mon, 21 Jul 2014 15:28:15 -0500 -Subject: [PATCH] Made curl_global_cleanup() thread safe - -Upstream-Status: Inappropriate [creates Linux dependency] - -diff --git a/lib/easy.c b/lib/easy.c -index 8464ef347..b6f4627b6 100644 ---- a/lib/easy.c -+++ b/lib/easy.c -@@ -268,11 +268,24 @@ CURLcode curl_global_init_mem(long flags, curl_malloc_callback m, - */ - void curl_global_cleanup(void) - { -+#ifdef CURL_THREAD_SAFE_INIT -+ curl_global_mutex_lock(); -+#endif - if(!initialized) -+ { -+#ifdef CURL_THREAD_SAFE_INIT -+ curl_global_mutex_unlock(); -+#endif - return; -+ } - - if(--initialized) -+ { -+#ifdef CURL_THREAD_SAFE_INIT -+ curl_global_mutex_unlock(); -+#endif - return; -+ } - - Curl_ssl_cleanup(); - Curl_resolver_global_cleanup(); -@@ -290,6 +303,9 @@ void curl_global_cleanup(void) - #endif - - init_flags = 0; -+#ifdef CURL_THREAD_SAFE_INIT -+ curl_global_mutex_unlock(); -+#endif - } - - /* --- -2.28.0 - diff --git a/recipes-support/curl/curl/0009-Made-curl_easy_init-thread-safe.patch b/recipes-support/curl/curl/0009-Made-curl_easy_init-thread-safe.patch deleted file mode 100644 index 22266b00e..000000000 --- a/recipes-support/curl/curl/0009-Made-curl_easy_init-thread-safe.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jonathan David -Date: Mon, 21 Jul 2014 15:30:46 -0500 -Subject: [PATCH] Made curl_easy_init() thread safe - -Upstream-Status: Inappropriate [creates Linux dependency] - -diff --git a/lib/easy.c b/lib/easy.c -index b6f4627b6..3b210f077 100644 ---- a/lib/easy.c -+++ b/lib/easy.c -@@ -318,14 +318,23 @@ struct Curl_easy *curl_easy_init(void) - struct Curl_easy *data; - - /* Make sure we inited the global SSL stuff */ -+#ifdef CURL_THREAD_SAFE_INIT -+ curl_global_mutex_lock(); -+#endif - if(!initialized) { - result = curl_global_init(CURL_GLOBAL_DEFAULT); - if(result) { - /* something in the global init failed, return nothing */ - DEBUGF(fprintf(stderr, "Error: curl_global_init failed\n")); -+#ifdef CURL_THREAD_SAFE_INIT -+ curl_global_mutex_unlock(); -+#endif - return NULL; - } - } -+#ifdef CURL_THREAD_SAFE_INIT -+ curl_global_mutex_unlock(); -+#endif - - /* We use curl_open() with undefined URL so far */ - result = Curl_open(&data); --- -2.28.0 - diff --git a/recipes-support/curl/curl_7.%.bbappend b/recipes-support/curl/curl_7.%.bbappend deleted file mode 100644 index 0e8fb2f18..000000000 --- a/recipes-support/curl/curl_7.%.bbappend +++ /dev/null @@ -1,15 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" - -SRC_URI += " \ - file://0001-Added-curl_easy_getinfo_va-API-function.patch \ - file://0002-Added-curl_formadd_va-API-function.patch \ - file://0003-Added-curl_multi_setopt_va-API-function.patch \ - file://0004-Added-curl_share_setopt_va-API-function.patch \ - file://0005-Add-nicurl-wrapper-functions.patch \ - file://0006-Add-global-init-mutex.patch \ - file://0007-Made-curl_global_init-thread-safe.patch \ - file://0008-Made-curl_global_cleanup-thread-safe.patch \ - file://0009-Made-curl_easy_init-thread-safe.patch \ -" - -SELECTED_OPTIMIZATION += "-Wno-deprecated-declarations" diff --git a/recipes-support/gnupg/gnupg_2.3.%.bbappend b/recipes-support/gnupg/gnupg_2.3.%.bbappend deleted file mode 100644 index 3ffb2c584..000000000 --- a/recipes-support/gnupg/gnupg_2.3.%.bbappend +++ /dev/null @@ -1,5 +0,0 @@ -# libksba has already been upgraded to version 1.6.3 in openembedded-core. -# However, this CVE is still getting flagged as other configurations call -# out gnupg 2.3.0 (inclusive) - 2.4.0 (exclusive). Upstream has already -# bumped gnupg in master so let's just ignore the CVE here. -CVE_CHECK_IGNORE:append = " CVE-2022-3515" diff --git a/recipes-support/onboard/files/onboard_hover_seg_fault.patch b/recipes-support/onboard/files/onboard_hover_seg_fault.patch new file mode 100644 index 000000000..7a59d251c --- /dev/null +++ b/recipes-support/onboard/files/onboard_hover_seg_fault.patch @@ -0,0 +1,37 @@ +--- a/Onboard/osk/osk_devices.c ++++ b/Onboard/osk/osk_devices.c +@@ -97,13 +97,15 @@ osk_device_event_dealloc (OskDeviceEvent + static OskDeviceEvent* + new_device_event (void) + { +- OskDeviceEvent *ev = PyObject_New(OskDeviceEvent, &osk_device_event_type); ++ OskDeviceEvent *ev; ++ PyGILState_STATE gstate = PyGILState_Ensure(); ++ ev = PyObject_New(OskDeviceEvent, &osk_device_event_type); + if (ev) + { + osk_device_event_type.tp_init((PyObject*) ev, NULL, NULL); +- return ev; + } +- return NULL; ++ PyGILState_Release(gstate); ++ return ev; + } + + static PyObject * +@@ -334,6 +336,7 @@ osk_devices_dealloc (OskDevices *dev) + static void + queue_event (OskDevices* dev, OskDeviceEvent* event, Bool discard_pending) + { ++ PyGILState_STATE state = PyGILState_Ensure (); + GQueue* queue = dev->event_queue; + if (queue) + { +@@ -364,6 +367,7 @@ queue_event (OskDevices* dev, OskDeviceE + Py_INCREF(event); + g_queue_push_head(queue, event); + } ++ PyGILState_Release (state); + } + + static gboolean idle_process_event_queue (OskDevices* dev) diff --git a/recipes-support/onboard/onboard_%.bbappend b/recipes-support/onboard/onboard_%.bbappend index 6c5344735..40b6dfc5a 100644 --- a/recipes-support/onboard/onboard_%.bbappend +++ b/recipes-support/onboard/onboard_%.bbappend @@ -1,14 +1,17 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:" +# file://0001-add-xfce-to-autostart-onlyshowin.patch SRC_URI += " \ file://0001-add-xfce-to-autostart-onlyshowin.patch \ + file://onboard_hover_seg_fault.patch \ file://01-gnome-accessibility \ file://NI.colors \ file://NI.theme \ file://onboard-defaults.conf \ " +CFLAGS += "-Werror=declaration-after-statement" do_install:append () { install -d ${D}${sysconfdir}/dconf/db/local.d diff --git a/recipes-support/salt/salt_3000.2.bb b/recipes-support/salt/salt_3000.2.bb index 72f781dd1..bd606b6ea 100644 --- a/recipes-support/salt/salt_3000.2.bb +++ b/recipes-support/salt/salt_3000.2.bb @@ -56,33 +56,6 @@ PACKAGES += "\ ${PN}-bash-completion \ " -RDEPENDS:${PN}-minion += "\ - python3-aiodns \ - python3-aiohttp \ - python3-avahi \ - python3-mmap \ - python3-pyinotify \ - python3-pyroute2 \ - python3-pika \ - python3-psutil \ -" - -# NI Skyline dependencies only; not needed for base salt. -RDEPENDS:${PN}-common += " \ - python3-configparser \ - python3-dateutil \ - python3-difflib \ - python3-distutils \ - python3-misc \ - python3-multiprocessing \ - python3-profile \ - python3-pyiface \ - python3-resource \ - python3-terminal \ - python3-unixadmin \ - python3-xmlrpc \ -" - INITSCRIPT_PARAMS:${PN}-minion = "defaults 93 7" do_install:append() { @@ -142,6 +115,8 @@ SUMMARY:${PN}-common = "shared libraries that salt requires for all packages" DESCRIPTION:${PN}-common ="${DESCRIPTION_COMMON} This particular package provides shared libraries that \ salt-master, salt-minion, and salt-syndic require to function." RDEPENDS:${PN}-common = "\ + python3-backports-ssl-match-hostname \ + python3-charset-normalizer \ python3-core \ python3-dateutil \ python3-fcntl \ @@ -207,7 +182,7 @@ FILES:${PN}-cloud = "${bindir}/${PN}-cloud ${sysconfdir}/${PN}/cloud.conf.d/ ${s SUMMARY:${PN}-tests = "salt stack test suite" DESCRIPTION:${PN}-tests ="${DESCRIPTION_COMMON} This particular package provides the salt unit test suite." -RDEPENDS:${PN}-tests = "${PN}-common python3-pytest-salt python3-pyzmq python3-six python3-tests python3-image bash" +RDEPENDS:${PN}-tests = "${PN}-common python3-pyzmq python3-six python3-tests python3-image bash" FILES:${PN}-tests = "${PYTHON_SITEPACKAGES_DIR}/salt-tests/tests/" RDEPENDS:${PN}-ptest += "salt-tests python3-distro python3-mock" diff --git a/recipes-support/syslog-ng/syslog-ng_3.%.bbappend b/recipes-support/syslog-ng/syslog-ng_4.%.bbappend similarity index 100% rename from recipes-support/syslog-ng/syslog-ng_3.%.bbappend rename to recipes-support/syslog-ng/syslog-ng_4.%.bbappend diff --git a/recipes-xfce/xserver-xfce-init/xserver-xfce-init.bb b/recipes-xfce/xserver-xfce-init/xserver-xfce-init.bb index f782d6573..5b7f02d24 100644 --- a/recipes-xfce/xserver-xfce-init/xserver-xfce-init.bb +++ b/recipes-xfce/xserver-xfce-init/xserver-xfce-init.bb @@ -2,7 +2,7 @@ SUMMARY = "NILRT XFCE Initialization." DESCRIPTION = "Used to initialize XFCE when the embedded UI is enabled." SECTION = "x11" LICENSE = "GPL-2.0-only" -LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" PV = "1.0" @@ -10,7 +10,6 @@ PV = "1.0" SRC_URI = " \ file://xserver-xfce \ - file://gplv2-license.patch \ file://xserver-xfce.service \ file://xserver-xfce.conf \ file://xserver-logrotate.conf \ diff --git a/recipes-xfce/xserver-xfce-init/xserver-xfce-init/gplv2-license.patch b/recipes-xfce/xserver-xfce-init/xserver-xfce-init/gplv2-license.patch deleted file mode 100644 index ec9325334..000000000 --- a/recipes-xfce/xserver-xfce-init/xserver-xfce-init/gplv2-license.patch +++ /dev/null @@ -1,353 +0,0 @@ -COPYING: add GPLv2 license file - -this is a local file recipe and the license file is missing.In order -to pass the license checksum checking, the license file is needed. So -this patch add the GPLv2 license file. - -Signed-off-by: Yu Ke - -diff --git a/COPYING b/COPYING -new file mode 100644 -index 0000000..d511905 ---- /dev/null -+++ b/COPYING -@@ -0,0 +1,339 @@ -+ GNU GENERAL PUBLIC LICENSE -+ Version 2, June 1991 -+ -+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., -+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ Everyone is permitted to copy and distribute verbatim copies -+ of this license document, but changing it is not allowed. -+ -+ Preamble -+ -+ The licenses for most software are designed to take away your -+freedom to share and change it. By contrast, the GNU General Public -+License is intended to guarantee your freedom to share and change free -+software--to make sure the software is free for all its users. This -+General Public License applies to most of the Free Software -+Foundation's software and to any other program whose authors commit to -+using it. (Some other Free Software Foundation software is covered by -+the GNU Lesser General Public License instead.) You can apply it to -+your programs, too. -+ -+ When we speak of free software, we are referring to freedom, not -+price. Our General Public Licenses are designed to make sure that you -+have the freedom to distribute copies of free software (and charge for -+this service if you wish), that you receive source code or can get it -+if you want it, that you can change the software or use pieces of it -+in new free programs; and that you know you can do these things. -+ -+ To protect your rights, we need to make restrictions that forbid -+anyone to deny you these rights or to ask you to surrender the rights. -+These restrictions translate to certain responsibilities for you if you -+distribute copies of the software, or if you modify it. -+ -+ For example, if you distribute copies of such a program, whether -+gratis or for a fee, you must give the recipients all the rights that -+you have. You must make sure that they, too, receive or can get the -+source code. And you must show them these terms so they know their -+rights. -+ -+ We protect your rights with two steps: (1) copyright the software, and -+(2) offer you this license which gives you legal permission to copy, -+distribute and/or modify the software. -+ -+ Also, for each author's protection and ours, we want to make certain -+that everyone understands that there is no warranty for this free -+software. If the software is modified by someone else and passed on, we -+want its recipients to know that what they have is not the original, so -+that any problems introduced by others will not reflect on the original -+authors' reputations. -+ -+ Finally, any free program is threatened constantly by software -+patents. We wish to avoid the danger that redistributors of a free -+program will individually obtain patent licenses, in effect making the -+program proprietary. To prevent this, we have made it clear that any -+patent must be licensed for everyone's free use or not licensed at all. -+ -+ The precise terms and conditions for copying, distribution and -+modification follow. -+ -+ GNU GENERAL PUBLIC LICENSE -+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -+ -+ 0. This License applies to any program or other work which contains -+a notice placed by the copyright holder saying it may be distributed -+under the terms of this General Public License. The "Program", below, -+refers to any such program or work, and a "work based on the Program" -+means either the Program or any derivative work under copyright law: -+that is to say, a work containing the Program or a portion of it, -+either verbatim or with modifications and/or translated into another -+language. (Hereinafter, translation is included without limitation in -+the term "modification".) Each licensee is addressed as "you". -+ -+Activities other than copying, distribution and modification are not -+covered by this License; they are outside its scope. The act of -+running the Program is not restricted, and the output from the Program -+is covered only if its contents constitute a work based on the -+Program (independent of having been made by running the Program). -+Whether that is true depends on what the Program does. -+ -+ 1. You may copy and distribute verbatim copies of the Program's -+source code as you receive it, in any medium, provided that you -+conspicuously and appropriately publish on each copy an appropriate -+copyright notice and disclaimer of warranty; keep intact all the -+notices that refer to this License and to the absence of any warranty; -+and give any other recipients of the Program a copy of this License -+along with the Program. -+ -+You may charge a fee for the physical act of transferring a copy, and -+you may at your option offer warranty protection in exchange for a fee. -+ -+ 2. You may modify your copy or copies of the Program or any portion -+of it, thus forming a work based on the Program, and copy and -+distribute such modifications or work under the terms of Section 1 -+above, provided that you also meet all of these conditions: -+ -+ a) You must cause the modified files to carry prominent notices -+ stating that you changed the files and the date of any change. -+ -+ b) You must cause any work that you distribute or publish, that in -+ whole or in part contains or is derived from the Program or any -+ part thereof, to be licensed as a whole at no charge to all third -+ parties under the terms of this License. -+ -+ c) If the modified program normally reads commands interactively -+ when run, you must cause it, when started running for such -+ interactive use in the most ordinary way, to print or display an -+ announcement including an appropriate copyright notice and a -+ notice that there is no warranty (or else, saying that you provide -+ a warranty) and that users may redistribute the program under -+ these conditions, and telling the user how to view a copy of this -+ License. (Exception: if the Program itself is interactive but -+ does not normally print such an announcement, your work based on -+ the Program is not required to print an announcement.) -+ -+These requirements apply to the modified work as a whole. If -+identifiable sections of that work are not derived from the Program, -+and can be reasonably considered independent and separate works in -+themselves, then this License, and its terms, do not apply to those -+sections when you distribute them as separate works. But when you -+distribute the same sections as part of a whole which is a work based -+on the Program, the distribution of the whole must be on the terms of -+this License, whose permissions for other licensees extend to the -+entire whole, and thus to each and every part regardless of who wrote it. -+ -+Thus, it is not the intent of this section to claim rights or contest -+your rights to work written entirely by you; rather, the intent is to -+exercise the right to control the distribution of derivative or -+collective works based on the Program. -+ -+In addition, mere aggregation of another work not based on the Program -+with the Program (or with a work based on the Program) on a volume of -+a storage or distribution medium does not bring the other work under -+the scope of this License. -+ -+ 3. You may copy and distribute the Program (or a work based on it, -+under Section 2) in object code or executable form under the terms of -+Sections 1 and 2 above provided that you also do one of the following: -+ -+ a) Accompany it with the complete corresponding machine-readable -+ source code, which must be distributed under the terms of Sections -+ 1 and 2 above on a medium customarily used for software interchange; or, -+ -+ b) Accompany it with a written offer, valid for at least three -+ years, to give any third party, for a charge no more than your -+ cost of physically performing source distribution, a complete -+ machine-readable copy of the corresponding source code, to be -+ distributed under the terms of Sections 1 and 2 above on a medium -+ customarily used for software interchange; or, -+ -+ c) Accompany it with the information you received as to the offer -+ to distribute corresponding source code. (This alternative is -+ allowed only for noncommercial distribution and only if you -+ received the program in object code or executable form with such -+ an offer, in accord with Subsection b above.) -+ -+The source code for a work means the preferred form of the work for -+making modifications to it. For an executable work, complete source -+code means all the source code for all modules it contains, plus any -+associated interface definition files, plus the scripts used to -+control compilation and installation of the executable. However, as a -+special exception, the source code distributed need not include -+anything that is normally distributed (in either source or binary -+form) with the major components (compiler, kernel, and so on) of the -+operating system on which the executable runs, unless that component -+itself accompanies the executable. -+ -+If distribution of executable or object code is made by offering -+access to copy from a designated place, then offering equivalent -+access to copy the source code from the same place counts as -+distribution of the source code, even though third parties are not -+compelled to copy the source along with the object code. -+ -+ 4. You may not copy, modify, sublicense, or distribute the Program -+except as expressly provided under this License. Any attempt -+otherwise to copy, modify, sublicense or distribute the Program is -+void, and will automatically terminate your rights under this License. -+However, parties who have received copies, or rights, from you under -+this License will not have their licenses terminated so long as such -+parties remain in full compliance. -+ -+ 5. You are not required to accept this License, since you have not -+signed it. However, nothing else grants you permission to modify or -+distribute the Program or its derivative works. These actions are -+prohibited by law if you do not accept this License. Therefore, by -+modifying or distributing the Program (or any work based on the -+Program), you indicate your acceptance of this License to do so, and -+all its terms and conditions for copying, distributing or modifying -+the Program or works based on it. -+ -+ 6. Each time you redistribute the Program (or any work based on the -+Program), the recipient automatically receives a license from the -+original licensor to copy, distribute or modify the Program subject to -+these terms and conditions. You may not impose any further -+restrictions on the recipients' exercise of the rights granted herein. -+You are not responsible for enforcing compliance by third parties to -+this License. -+ -+ 7. If, as a consequence of a court judgment or allegation of patent -+infringement or for any other reason (not limited to patent issues), -+conditions are imposed on you (whether by court order, agreement or -+otherwise) that contradict the conditions of this License, they do not -+excuse you from the conditions of this License. If you cannot -+distribute so as to satisfy simultaneously your obligations under this -+License and any other pertinent obligations, then as a consequence you -+may not distribute the Program at all. For example, if a patent -+license would not permit royalty-free redistribution of the Program by -+all those who receive copies directly or indirectly through you, then -+the only way you could satisfy both it and this License would be to -+refrain entirely from distribution of the Program. -+ -+If any portion of this section is held invalid or unenforceable under -+any particular circumstance, the balance of the section is intended to -+apply and the section as a whole is intended to apply in other -+circumstances. -+ -+It is not the purpose of this section to induce you to infringe any -+patents or other property right claims or to contest validity of any -+such claims; this section has the sole purpose of protecting the -+integrity of the free software distribution system, which is -+implemented by public license practices. Many people have made -+generous contributions to the wide range of software distributed -+through that system in reliance on consistent application of that -+system; it is up to the author/donor to decide if he or she is willing -+to distribute software through any other system and a licensee cannot -+impose that choice. -+ -+This section is intended to make thoroughly clear what is believed to -+be a consequence of the rest of this License. -+ -+ 8. If the distribution and/or use of the Program is restricted in -+certain countries either by patents or by copyrighted interfaces, the -+original copyright holder who places the Program under this License -+may add an explicit geographical distribution limitation excluding -+those countries, so that distribution is permitted only in or among -+countries not thus excluded. In such case, this License incorporates -+the limitation as if written in the body of this License. -+ -+ 9. The Free Software Foundation may publish revised and/or new versions -+of the General Public License from time to time. Such new versions will -+be similar in spirit to the present version, but may differ in detail to -+address new problems or concerns. -+ -+Each version is given a distinguishing version number. If the Program -+specifies a version number of this License which applies to it and "any -+later version", you have the option of following the terms and conditions -+either of that version or of any later version published by the Free -+Software Foundation. If the Program does not specify a version number of -+this License, you may choose any version ever published by the Free Software -+Foundation. -+ -+ 10. If you wish to incorporate parts of the Program into other free -+programs whose distribution conditions are different, write to the author -+to ask for permission. For software which is copyrighted by the Free -+Software Foundation, write to the Free Software Foundation; we sometimes -+make exceptions for this. Our decision will be guided by the two goals -+of preserving the free status of all derivatives of our free software and -+of promoting the sharing and reuse of software generally. -+ -+ NO WARRANTY -+ -+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -+REPAIR OR CORRECTION. -+ -+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -+POSSIBILITY OF SUCH DAMAGES. -+ -+ END OF TERMS AND CONDITIONS -+ -+ How to Apply These Terms to Your New Programs -+ -+ If you develop a new program, and you want it to be of the greatest -+possible use to the public, the best way to achieve this is to make it -+free software which everyone can redistribute and change under these terms. -+ -+ To do so, attach the following notices to the program. It is safest -+to attach them to the start of each source file to most effectively -+convey the exclusion of warranty; and each file should have at least -+the "copyright" line and a pointer to where the full notice is found. -+ -+ -+ Copyright (C) -+ -+ 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; either version 2 of the License, or -+ (at your option) any later version. -+ -+ 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. -+ -+Also add information on how to contact you by electronic and paper mail. -+ -+If the program is interactive, make it output a short notice like this -+when it starts in an interactive mode: -+ -+ Gnomovision version 69, Copyright (C) year name of author -+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -+ This is free software, and you are welcome to redistribute it -+ under certain conditions; type `show c' for details. -+ -+The hypothetical commands `show w' and `show c' should show the appropriate -+parts of the General Public License. Of course, the commands you use may -+be called something other than `show w' and `show c'; they could even be -+mouse-clicks or menu items--whatever suits your program. -+ -+You should also get your employer (if you work as a programmer) or your -+school, if any, to sign a "copyright disclaimer" for the program, if -+necessary. Here is a sample; alter the names: -+ -+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program -+ `Gnomovision' (which makes passes at compilers) written by James Hacker. -+ -+ , 1 April 1989 -+ Ty Coon, President of Vice -+ -+This General Public License does not permit incorporating your program into -+proprietary programs. If your program is a subroutine library, you may -+consider it more useful to permit linking proprietary applications with the -+library. If this is what you want to do, use the GNU Lesser General -+Public License instead of this License. diff --git a/scripts/lib/wic/canned-wks/grub.cfg b/scripts/lib/wic/canned-wks/grub.cfg index c75c2cf5d..f44b7184c 100644 --- a/scripts/lib/wic/canned-wks/grub.cfg +++ b/scripts/lib/wic/canned-wks/grub.cfg @@ -1,16 +1,28 @@ serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 default='Default Provisioning' -timeout=1 +timeout=3 search --set=root --label NIRECOVERY-CD menuentry 'Default Provisioning' { - linux /bzImage rootwait restore=provision quiet loglevel=1 + linux /bzImage rootwait restore=provision-safe quiet loglevel=1 initrd /initrd } menuentry 'Verbose Provisioning' { - linux /bzImage rootwait restore=provision verbose_mode=1 + echo 'Loading Linux ...' + linux /bzImage rootwait restore=provision-safe verbose_mode=1 + echo 'Loading initial ramdisk ...' + initrd /initrd +} + +menuentry 'Get Image' { + linux /bzImage rootwait restore=get-image quiet loglevel=1 + initrd /initrd +} + +menuentry 'Set Image' { + linux /bzImage rootwait restore=set-image quiet loglevel=1 initrd /initrd } diff --git a/scripts/lib/wic/canned-wks/grub_old.cfg b/scripts/lib/wic/canned-wks/grub_old.cfg deleted file mode 100644 index 1f5df762f..000000000 --- a/scripts/lib/wic/canned-wks/grub_old.cfg +++ /dev/null @@ -1,19 +0,0 @@ -serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 -default='Default Provisioning' -timeout=1 - -search --set=root --label NIRECOVERY-CD - -menuentry 'Default Provisioning' { - linux /bzImage rootwait restore=provision-safe quiet loglevel=1 - initrd /initrd -} - -menuentry 'Verbose Provisioning' { - echo 'Loading Linux ...' - linux /bzImage rootwait restore=provision-safe verbose_mode=1 - echo 'Loading initial ramdisk ...' - initrd /initrd -} - -menu background splash.jpg diff --git a/scripts/lib/wic/canned-wks/nilrt-recovery-media.x64.wks b/scripts/lib/wic/canned-wks/nilrt-recovery-media.x64.wks index bc922e627..8453b7a3e 100644 --- a/scripts/lib/wic/canned-wks/nilrt-recovery-media.x64.wks +++ b/scripts/lib/wic/canned-wks/nilrt-recovery-media.x64.wks @@ -6,4 +6,4 @@ part /boot --source isoimage-isohybrid --sourceparams="esp_label=NIRECOVERY,esp_ # note that --append is ignored by grub when using a configfile # and only processed by syslinux as configured below -bootloader --configfile="grub_old.cfg" --append="restore=provision-safe console=ttyS0" +bootloader --configfile="grub.cfg" --append="restore=provision-safe console=ttyS0"