diff --git a/xCAT-server/share/xcat/install/ubuntu/cudafull.ubuntu14.04.2.ppc64el.pkglist b/xCAT-server/share/xcat/install/ubuntu/cudafull.ubuntu14.04.2.ppc64el.pkglist new file mode 100644 index 000000000..1bf539888 --- /dev/null +++ b/xCAT-server/share/xcat/install/ubuntu/cudafull.ubuntu14.04.2.ppc64el.pkglist @@ -0,0 +1,22 @@ +bash +nfs-common +openssl +isc-dhcp-client +libc-bin +linux-image-generic-lts-utopic +openssh-server +openssh-client +wget +vim +ntp +rsync +busybox-static +gawk +dnsutils + +build-essential +dkms + +zlib1g-dev + +cuda diff --git a/xCAT-server/share/xcat/install/ubuntu/cudaruntime.ubuntu14.04.2.ppc64el.pkglist b/xCAT-server/share/xcat/install/ubuntu/cudaruntime.ubuntu14.04.2.ppc64el.pkglist new file mode 100644 index 000000000..0ad23cb04 --- /dev/null +++ b/xCAT-server/share/xcat/install/ubuntu/cudaruntime.ubuntu14.04.2.ppc64el.pkglist @@ -0,0 +1,22 @@ +bash +nfs-common +openssl +isc-dhcp-client +libc-bin +linux-image-generic-lts-utopic +openssh-server +openssh-client +wget +vim +ntp +rsync +busybox-static +gawk +dnsutils + +build-essential +dkms + +zlib1g-dev + +cuda-runtime-7-0 diff --git a/xCAT-server/share/xcat/netboot/ubuntu/cudacommon.ubuntu14.04.2.ppc64el.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/cudacommon.ubuntu14.04.2.ppc64el.pkglist new file mode 100644 index 000000000..fa146b85d --- /dev/null +++ b/xCAT-server/share/xcat/netboot/ubuntu/cudacommon.ubuntu14.04.2.ppc64el.pkglist @@ -0,0 +1,19 @@ +bash +nfs-common +openssl +isc-dhcp-client +libc-bin +linux-image-generic-lts-utopic +openssh-server +openssh-client +wget +vim +ntp +rsync +busybox-static +gawk +dnsutils + +build-essential +zlib1g-dev +dkms diff --git a/xCAT-server/share/xcat/netboot/ubuntu/cudafull.otherpkgs.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/cudafull.otherpkgs.pkglist new file mode 100644 index 000000000..089f044f4 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/ubuntu/cudafull.otherpkgs.pkglist @@ -0,0 +1 @@ +cuda diff --git a/xCAT-server/share/xcat/netboot/ubuntu/cudaruntime.otherpkgs.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/cudaruntime.otherpkgs.pkglist new file mode 100644 index 000000000..f0971c771 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/ubuntu/cudaruntime.otherpkgs.pkglist @@ -0,0 +1 @@ +cuda-runtime-7-0 diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index f2c87c44d..a5a67ed8f 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -414,6 +414,9 @@ unless ($onlyinitrd) { elsif ($p =~ /linux-image-generic/) { $kernelimage = $p; } + elsif ($p =~ /linux-headers/ && $kernelver) { + push @npa, "linux-headers-$kernelver"; + } elsif ($p =~ /^@/) { push @npa, "\"$p\""; } @@ -473,6 +476,9 @@ unless ($onlyinitrd) { $otherpkglist = imgutils::get_profile_def_filename($osver, $profile, $arch, $customdir, "otherpkgs.pkglist"); unless ($otherpkglist) { $otherpkglist=imgutils::get_profile_def_filename($osver, $profile, $arch, $pathtofiles, "otherpkgs.pkglist"); } } + # Hack uname to get the corrent kernel ver, must be here because pkglist name depend on uname binary, put hacked uname script here to overwrite the orignal uname + use_hackuname(); + my %extra_hash=(); if ($otherpkglist) { $updates{'otherpkglist'} = $otherpkglist if ($tempfile); @@ -584,6 +590,9 @@ unless ($onlyinitrd) { # } # ignore any return code } + # Hack uname to get the corrent kernel ver, use the original uname binary + unuse_hackuname(); + print("Umount /proc, /dev, /sys, pkgdir and otherpkgdir to the rootimg.\n"); umount_chroot($rootimg_dir); @@ -1902,13 +1911,52 @@ sub load_dd () return @dd_drivers; } +#To hack the uname +sub use_hackuname { + if ( -e "$rootimg_dir/bin/uname-binary") { + system("rm $rootimg_dir/bin/uname-binary"); + } + if ( -e -x "$rootimg_dir/bin/uname" ) { + move("$rootimg_dir/bin/uname", "$rootimg_dir/bin/uname-binary"); + } + + # write the hacked uname script + my $unamefile; + open($unamefile, ">", "$rootimg_dir/bin/uname"); + print $unamefile "#!/bin/bash \n"; + print $unamefile "case \"\$1\" in \n"; + print $unamefile "\"-m\") \n"; + print $unamefile " ARCH=\"\$(dpkg --print-architecture || \n"; + print $unamefile " rpm -q kernel-\$(\"\$0\" -r) --qf '%{arch}')\" \n"; + print $unamefile " case \"\$ARCH\" in \n"; + print $unamefile " \"amd64\") ARCH=\"x86_64\" ;; \n"; + print $unamefile " \"ppc64el\") ARCH=\"ppc64le\" ;; \n"; + print $unamefile " esac \n"; + print $unamefile " echo \"\$ARCH\" ;; \n"; + print $unamefile "\"-r\") cd /lib/modules && for d in * ; do : ; done && echo \$d ;; \n"; + print $unamefile "\"-s\"|\"\") echo \"Linux\" ;; \n"; + print $unamefile "esac \n"; + print $unamefile "exit 0 \n"; + close $unamefile; + chmod(0755, "$rootimg_dir/bin/uname"); +} + +sub unuse_hackuname { + if ( -e "$rootimg_dir/bin/uname" ) { + system("rm -fr $rootimg_dir/bin/uname"); + } + if ( -e -x "$rootimg_dir/bin/uname-binary") { + move("$rootimg_dir/bin/uname-binary", "$rootimg_dir/bin/uname"); + } +} + sub mount_chroot { my $rootimage_dir = shift; my $otherpkgdir = shift; my $pkgdir = shift; my $kerneldir = shift; #system("mount -o bind /dev $rootimage_dir/dev"); - #system("mount -o bind /proc $rootimage_dir/proc"); + system("mount -o bind /proc $rootimage_dir/proc"); #system("mount -o bind /sys $rootimage_dir/sys"); if ($pkgdir) { if (-d $pkgdir) { @@ -1940,7 +1988,7 @@ sub mount_chroot { sub umount_chroot { my $rootimage_dir = shift; #system("umount $rootimage_dir/dev"); - #system("umount $rootimage_dir/proc"); + system("umount $rootimage_dir/proc"); #system("umount $rootimage_dir/sys"); system("umount $rootimage_dir/mnt/pkgdir"); rmdir("$rootimage_dir/mnt/pkgdir"); diff --git a/xCAT/postscripts/addcudakey b/xCAT/postscripts/addcudakey new file mode 100755 index 000000000..2ab69f2ba --- /dev/null +++ b/xCAT/postscripts/addcudakey @@ -0,0 +1,33 @@ +#!/bin/bash + + +if [ -r /xcatpost/cudakey ]; then + GPGKEY=`cat /xcatpost/cudakey` +else + GPGKEY="-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v2.0.9 (GNU/Linux) + +mQGiBFFoeGMRBACjjvkdqqBafo0msmm9251rB7ocN4Es4cCq6O/8eOVoPx8fFrAK +LHExbZODXp7eKJMkKHIlGwmG9SZR02wJO2bvnqn3AdbRydRsNPGlb0+8Xl9uvRyc +2feeDLYQfbUW/8D2nKkAhbZ8EiUvezDZYG6hs24bMpPFmn+fTqdtmSfMHwCg7X+q +v1EJl25niTiQVb3F2qvj950D/ib0LQWMHDiPCc2NhCfXjaDJ9QrNaF+z083I4xMk +GS/7jLWuM07+8izyaThePJbFad2KyK6csN7AFH54VIqHerLsy9xCS4xd5aX0UXmp +uiae8XyWdj8kvJ9ujWxx5xgPABaDGIGxW6Bifiy75mI6okV4GwrAg5QW81/agm+k +NqZ+BACRNIw3w+wNLk5kLfbyK01fMr5UhgBWDKKIbyXxnmonSdpcvl1jF47/r59u +XMfRmyVnW5qepKN3sO2jQcySh713t+Oc23/vHeQNDoET8/FDpyqRq/zXIfS8KZg7 +7mIrzdfohRyj8hjBGS3XBT4OaSk1Kp2ecK/oECsUleJXWGYgPLQgY3VkYXRvb2xz +IDxjdWRhdG9vbHNAbnZpZGlhLmNvbT6IYAQTEQIAIAUCUWh4YwIbAwYLCQgHAwIE +FQIIAwQWAgMBAh4BAheAAAoJENiMPThcN9O+M2EAoI/q1YTdia8WMdcoJxQKhuWl +0dxLAJ0YMMLZywIU8XJX3GkscXbn/LerOrkBDQRRaHhjEAQArb/oDncYCzLzHZEp +mXA9EKx/MLXfyammV4Yb9gFrpmVbcMGYqakSnSwimqp/Rc94pGNBekkddUw36eCo +Tww2mWKbHhXQ5fAMInrfbkbqqNl2rlf/fllej6vLI1yOFbAR4OIY8RMMVmTW38kk +RTQIHsiPDv4FRkjdT5jQgCfjtNsAAwYD/0yEUdGDLxCygyPQERsYZOxA4loN8Ts0 +2zSkhaRW4oLPedMdwEqHLIU1xXypq41Oc/vwggQo2Nuf5l4iclZf9KGaMkTDqnOS +4PaLN+h3g76pqprdfbj8XwvUL1fp59m4E7zrPmFEC77mN5juL0G0Vd2hATc/tHtn +JE1twuU/z0M9iEkEGBECAAkFAlFoeGMCGwwACgkQ2Iw9OFw3075WiQCePaId+3oa +Gxt50E+HszCx9nLtSIUAoIeoy/nWEJqX/uYHglHBLe4qdfcH +=lRUP +-----END PGP PUBLIC KEY BLOCK-----" +fi + +echo "$GPGKEY" | apt-key add -