Changeset 1408 in ProjectBuilder


Ignore:
Timestamp:
Feb 6, 2012, 9:37:38 AM (12 years ago)
Author:
Bruno Cornec
Message:

r4511@cabanilles: bruno | 2012-02-06 09:29:48 +0100

  • New sync point which brings a start of kernel analysis for pbmkbm
Location:
devel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/etc/pb.conf

    r1403 r1408  
    396396mkbmbootcmds linux = perl,mt,awk,gawk,dd,grep,uname,df,loadkeys,pidof,gzip,klogd,syslogd,rsyslogd,syslog-ng,mount,mount.nfs,mount.nfs4,sshfs,mount.fuse,fusermount,ssh,ulockmgr_server,mount.cifs,mount.cifs3,mount.smb,mount.smb3,mount.smbfs,mount.smbfs3,mount.ntfs,mount.ntfs-3g,MAKEDEV,udev.static,udevsend,udevd,hwup,path_id,scsi_tur,udeadm,udevstart.static,udev_volume_id,start_udev,udevstart,create_static_dev_nodes,scsi_id,insmod,lsmod,modprobe,mdadm,mdassemble,raidstart,multipath,dmsetup,kpartx,dmraid,mpath_prio_alua,mpath_wait,mpath_ctl,mpath_prio_emc,mpath_prio_hds_modular,mpath_prio_netapp,mpath_prio_ontap,mpath_prio_rdac,mpath_prio_tpc,ping,ifconfig,ip,route,dhclient,dhcpcd,
    397397
     398# Where is your kernel file - optional if you want to really be sure of what is used
     399#mkbmkerneldir linux = /boot
     400# Where is your kernel directory
     401mkbmkerneldir linux = /boot
     402#mkbmkerneldir linux = /boot/efi
     403# What is the regular expression to find the kernel file
     404mkbmkernelnamere linux = ^linu|^vmlinu|^xen
     405
    398406# Files to add on the boot media to support a full working system
    399407mkbmbasefiles linux = /etc/modules.conf,/etc/fstab,/etc/hosts,/etc/host.conf,/etc/resolv.conf,/etc/hosts.allow,/etc/hosts.deny,/etc/nsswitch.conf,/usr/share/misc/file/magic,/usr/share/file/magic,/usr/share/file/magic.mgc
     
    405413#
    406414# To support debug
    407 mkbmbbgfiles linux =
    408 mkbmbbgcmds linux = ldd,strace,valgrind,dmidecode,lsusb,lshw,lspci,ethtool
    409 mkbmbbgdirs linux = /usr/lib/valgrind,/usr/lib64/valgrind
     415mkbmdbgfiles linux =
     416mkbmdbgcmds linux = ldd,strace,valgrind,dmidecode,lsusb,lshw,lspci,ethtool
     417mkbmdbgdirs linux = /usr/lib/valgrind,/usr/lib64/valgrind
    410418
    411419# Where are the ISO bootloader for this OS
  • devel/pb-modules/etc/pb.conf.pod

    r1386 r1408  
    1212=head1 SYNOPSIS
    1313
    14 Those files have the same format, which is near from a a perl hash structure:
     14Those files have the same format, which is near from a perl hash structure:
    1515keyword key = value1[,value2,...]
    1616
     
    111111 Example: filteredfiles mindi = rootfs/sbin/init,mindi,install.sh,doc/mindi.8
    112112
     113=item B<logcmd>
     114
     115 Nature: Mandatory
     116 Key: project (as defined in the -p option or PBPROJ environment variable)
     117 Value: internal (the application then handles the logging of what it finds useful) or the name of an application to launch to log context (e.g. sos, cfg2html, ...).
     118 Conffile: pb
     119 Example: logcmd pbmkbm = sos
     120
     121=item B<logcmds>
     122
     123 Nature: Optional
     124 Key: project (as defined in the -p option or PBPROJ environment variable)
     125 Value: In case the B<logcmd> command is internal, a coma separated list of the commands whose trace execution is to be captured in order to log context.
     126 Conffile: pb
     127 Example: logcmds pbmkbm = mount,lsmod,esxcfg-module -l,df -T
     128
     129=item B<logfiles>
     130
     131 Nature: Optional
     132 Key: project (as defined in the -p option or PBPROJ environment variable)
     133 Value: In case the B<logcmd> command is internal, a coma separated list of the files to capture in order to log context.
     134 Conffile: pb
     135 Example: logfiles pbmkbm = /etc/raidtab,/proc/cmdline,/proc/swaps
     136
     137=item B<logopt>
     138
     139 Nature: Optional
     140 Key: project (as defined in the -p option or PBPROJ environment variable)
     141 Value: In case the B<logcmd> command is not internal, the options of the B<logcmd> application to launch to log context
     142 Conffile: pb
     143 Example: logcmd pbmkbm = --all
     144
     145=item B<mkbmbootcmds>
     146
     147 Nature: Mandatory
     148 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch). The family name is generaly used here.
     149 Value: coma separated list of commands to be copied from the original OS to the target boot media tree (works recursively for directory creation on the target). Their actual path is deduced from the PATH variable.
     150 Conffile: pb
     151 Example: mkbmbootcmds linux = perl,awk,gawk,dd,grep,uname
     152
     153=item B<mkbmbootdirs>
     154
     155 Nature: Mandatory
     156 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch). The family name is generaly used here.
     157 Value: coma separated list of directories to be copied from the original OS to the target boot media tree (works recursively on the target).
     158 Conffile: pb
     159 Example: mkbmbootdirs linux = /etc/ssh,/etc/udev,/etc/mdadm
     160
     161=item B<mkbmbootfiles>
     162
     163 Nature: Mandatory
     164 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch). The family name is generaly used here.
     165 Value: coma separated list of files to be copied from the original OS to the target boot media tree (works recursively for directory creation on the target).
     166 Conffile: pb
     167 Example: mkbmbootfiles linux = /etc/mdadm.conf,/etc/raidtab,/etc/modprobe.conf
     168
     169=item B<mkbmkerneldir>
     170
     171 Nature: Mandatory
     172 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch). The family name is generaly used here.
     173 Value: path of the directory containing your kernel.
     174 Conffile: pb
     175 Example: mkbmkerneldir linux = /boot
     176
     177=item B<mkbmkernelfile>
     178
     179 Nature: Optional
     180 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch). The family name is generaly used here.
     181 Value: full path of the your kernel.
     182 Conffile: pb
     183 Example: mkbmkernelfile linux = /boot/vmlinuz-specific
     184
     185=item B<mkbmkernelnamere>
     186
     187 Nature: Mandatory
     188 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch). The family name is generaly used here.
     189 Value: Perl Regular Expression allowing to find OS kernel names in the B<kerneldir> directory.
     190 Conffile: pb
     191 Example: mkbmkerneldir linux = ^linu|^vmlinu|^xen
     192
    113193=item B<mkbmpath>
    114194
     
    118198 Conffile: pb
    119199 Example: mkbmpath default = /var/cache/pbmkbm
     200
     201=item B<mkbmtargetdirs>
     202
     203 Nature: Mandatory
     204 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch). The family name is generaly used here.
     205 Value: coma separated list of empty directory paths to be created on the target boot media.
     206 Conffile: pb
     207 Example: mkbmtargetdirs linux = /tmp,/dev
    120208
    121209=item B<namingtype>
  • devel/pb-modules/lib/ProjectBuilder/Base.pm

    r1402 r1408  
    393393
    394394# On linux can also use /proc/sys/kernel/osrelease
    395 my $rel = `uname -m`;
     395my $rel = `uname -r`;
    396396chomp($rel);
    397397return($rel);
  • devel/pbmkbm/bin/pbmkbm

    r1403 r1408  
    306306            $lcmd = pb_check_req($lcmd,1);
    307307            if (not defined $lcmd) {
    308                 pb_log(1,"INFO: command $lcmd (in $c) doesn't exist\n");
     308                pb_log(1,"INFO: command $c doesn't exist\n");
    309309                pb_log(1,"------------------\n");
    310310                next;
     
    405405
    406406# Create the directory structure needed on the target dir
    407 my ($tdirs,$bdirs,$bfiles,$bcmds) = pb_distro_get_param($pbos,pb_conf_get("mkbmtargetdirs","mkbmbootdirs","mkbmbootfiles","mkbmbootcmds");
     407my ($tdirs,$bdirs,$bfiles,$bcmds) = pb_distro_get_param($pbos,pb_conf_get("mkbmtargetdirs","mkbmbootdirs","mkbmbootfiles","mkbmbootcmds"));
    408408# Create empty dirs for these
    409409foreach my $d (split(/,/,$tdirs)) {
    410     $targettree->{$d} = "emptydir";
     410    $targettree{$d} = "emptydir";
    411411}
    412412# And copy dirs for those
    413413foreach my $d (split(/,/,$bdirs)) {
    414414    if (-d $d) {
    415         $targettree->{$d} = "dir";
     415        $targettree{$d} = "dir";
     416    } elsif (-l $d) {
     417        $targettree{$d} = "link";
    416418    } else {
    417         pb_log(
     419        pb_log(1,"INFO: Directory $d doesn't exist\n");
     420    }
    418421}
    419422foreach my $f (split(/,/,$bfiles)) {
    420     $targettree->{$d} = "dir";
    421 }
     423    $targettree{$f} = "file";
     424}
     425pb_log(2,"INFO: Target Tree is now: ".Dumper(%targettree)."\n");
    422426# Once the environment is made, add what is needed for this boot media to it.
    423427# Keyboard
     
    425429# List of commands
    426430# List of dependencies
    427 # Kernel
     431# Kernel - We use 2 objects, the running kernel and the target kernel which could be different
     432my %rkernel;
     433my %tkernel;
     434pb_mkbm_find_kernel(\%rkernel);
    428435# Initrd
    429436# init
     
    471478}
    472479
     480sub pb_mkbm_find_kernel {
     481
     482my $kernel = shift;
     483
     484$kernel->is_xen = undef;
     485# See if we're booted from a Xen kernel
     486# From http://wiki.xensource.com/xenwiki/XenCommonProblems#head-26434581604cc8357d9762aaaf040e8d87b37752
     487if ( -f "/proc/xen/capabilities") {
     488    # It's a Xen kernel
     489    pb_log(2,"INFO: We found a Xen Kernel running\n");
     490}
     491
     492my $kfile = pb_distro_get_param($pbos,pb_conf_get_if("mkbmkernelfile"));
     493if ((defined $kfile) && ($kfile ne "")) {
     494    pb_log(1,"INFO: You specified your kernel as $kfile, so using it\n");
     495    $kernel->file = $kfile;
     496} else {
     497    $kernel->dir = pb_distro_get_param($pbos,pb_conf_get("mkbmkerneldir"));
     498    die "ERROR: The mkbmkerneldir content ($kernel->dir) doesn't refer to a directory\n"if (! -d $kernel->dir);
     499    pb_log(1,"INFO: Analyzing directory $kernel->dir to find your kernel");
     500    $kernel->namere = pb_distro_get_param($pbos,pb_conf_get("mkbmkernelnamere"));
     501}
     502
     503# TODO: Look at a better way to find the name of the kernel we run
     504# look at /proc/sys/kernel/bootloader_type /proc/sys/kernel/bootloader_version
     505# to have a better guess
     506my $dh;
     507die "ERROR: Unable to open the mkbmkerneldir content ($kernel->dir)" if (! opendir($dh,$kernel->dir));
     508while (readdir $dh) {
     509    # Skip non-files
     510    next if ((! -f $_) && (! -l $_));
     511    # Skip files not correpsonding to the RE planned
     512    next if ($_ !~ /$kernel->namere/);
     513    #my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat("$f/$_");
     514}
     515closedir($dh);
     516$kernel->release = pb_get_osrelase();
     517}
     518
    473519sub pb_mkbm_create_media {
    474520
Note: See TracChangeset for help on using the changeset viewer.