From 3724aed861aca7f813fa362a3965774e7573ffef Mon Sep 17 00:00:00 2001 From: daniceexi Date: Sun, 30 Jun 2013 04:26:38 +0000 Subject: [PATCH] Code drop for Xeon Phi (mic) support. manage the image for mic. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16834 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/share/xcat/netboot/mic/genimage | 71 +++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 xCAT-server/share/xcat/netboot/mic/genimage diff --git a/xCAT-server/share/xcat/netboot/mic/genimage b/xCAT-server/share/xcat/netboot/mic/genimage new file mode 100755 index 000000000..ae7e93758 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/mic/genimage @@ -0,0 +1,71 @@ +#!/usr/bin/env perl +# generate the image for mic +# Since the root file system for mic is generated on the host by +# micctrl command, this script only help to generate the /etc/hosts, +# /root/.ssh from the management node to the root file system. + +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; + +use strict; +use File::Path; +use File::Basename; +use File::Copy; +use Getopt::Long; +Getopt::Long::Configure("bundling"); +Getopt::Long::Configure("pass_through"); + +my $pkglist; +my $srcdir; +GetOptions( + 'pkglist=s' => \$pkglist, + 'srcdir=s' => \$srcdir, +); + +my $fsdir = "$srcdir/opt/intel/mic/filesystem"; +my $systemdir = "$fsdir/overlay/system"; +mkpath ($systemdir); + +# this is the file list which includes the files which should be copied +# from MN to the root file system +my @sysfilelist = ( + "/etc/hosts", + "/etc/group", + "/etc/passwd", + "/etc/shadow", + "/etc/resolv.conf", + "/etc/nsswitch.conf", + "/etc/ssh/ssh_host_rsa_key", + "/etc/ssh/ssh_config", + "/etc/ssh/ssh_host_key", + "/etc/ssh/sshd_config", + "/etc/ssh/ssh_host_dsa_key", + "/etc/ssh/ssh_host_key.pub", + "/root/.ssh/id_rsa", + "/root/.ssh/id_rsa.pub", + "/root/.ssh/authorized_keys",); + +# do the copy +foreach my $file (@sysfilelist) { + my $dirname = dirname("$systemdir/$file"); + unless (-d $dirname) { + mkpath ($dirname); + } + copy ($file, "$systemdir/$file"); +} + +#Change the /bin/bash to /bin/sh in the /etc/passwd since base file system of mic only has sh. +my $cmd = "sed \"s/\\/bin\\/bash/\\/bin\\/sh/\" $systemdir/etc/passwd > /tmp/passwd.mic; mv /tmp/passwd.mic $systemdir/etc/passwd;"; +system ($cmd); + +# Create emtpy common dir and common.filelist for later using +mkpath ("$fsdir/common"); +system ("touch $fsdir/common.filelist"); + + +print "Genimage for mic has been done.\n"; + +1;