|
|
|
@ -142,18 +142,14 @@ class cl_kernel(color_print):
|
|
|
|
|
suffixName = "genkernel-%(march)s-%(fullver)s"%\
|
|
|
|
|
{"march":march,
|
|
|
|
|
"fullver":kernelFullVer}
|
|
|
|
|
fullVerWithoutCalculate = kernelFullVer.replace("-calculate","")
|
|
|
|
|
newSuffixName = "%s-%s-%s-installed"%(fullVerWithoutCalculate,
|
|
|
|
|
clVars.Get('os_arch_machine'),
|
|
|
|
|
clVars.Get('os_linux_shortname'))
|
|
|
|
|
baseInitrdName = path.join(bootDir,"initramfs-%s"%suffixName)
|
|
|
|
|
baseKernelName = path.join(bootDir,"kernel-%s"%suffixName)
|
|
|
|
|
baseSystemMap = path.join(bootDir,"System.map-%s"%suffixName)
|
|
|
|
|
|
|
|
|
|
newInitrdName = path.join(bootDir,"initramfs-%s"%newSuffixName)
|
|
|
|
|
newKernelName = path.join(bootDir,"vmlinuz-%s"%newSuffixName)
|
|
|
|
|
newSystemMap = path.join(bootDir,"System.map-%s"%newSuffixName)
|
|
|
|
|
newConfigName = path.join(bootDir,"config-%s"%newSuffixName)
|
|
|
|
|
newInitrdName = self._getName("initramfs")
|
|
|
|
|
newKernelName = self._getName("vmlinuz")
|
|
|
|
|
newSystemMap = self._getName("System.map")
|
|
|
|
|
newConfigName = self._getName("config")
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
os.rename(baseInitrdName,newInitrdName)
|
|
|
|
@ -163,7 +159,6 @@ class cl_kernel(color_print):
|
|
|
|
|
except OSError,e:
|
|
|
|
|
self.printERROR(_("Can not rename kernel files: %s")%e.strerror)
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def _installFile(self,source,target,removeSource=True,symlink=False):
|
|
|
|
@ -198,16 +193,9 @@ class cl_kernel(color_print):
|
|
|
|
|
if oldtarget:
|
|
|
|
|
map(os.unlink,targetLinkFiles)
|
|
|
|
|
map(lambda x:os.symlink(path.basename(oldtarget),x),targetLinkFiles)
|
|
|
|
|
|
|
|
|
|
def installBootFiles(self):
|
|
|
|
|
"""Copy -install files to without suffix name, and save old copy.
|
|
|
|
|
|
|
|
|
|
initramfs, vmlinuz, System.map, config with suffix installed copy
|
|
|
|
|
withou suffix. Save old files by append suffix .old.
|
|
|
|
|
Search link files boot directory link to oldfiles and fix symlink.
|
|
|
|
|
Create link iniramfs-UUID,vmlinuz-UUID,System.map-UUID.
|
|
|
|
|
Create initramfs install (copy of initramfs)
|
|
|
|
|
"""
|
|
|
|
|
def _getName(self,obj):
|
|
|
|
|
"""Get names for (initramfs,initramfs-install,vmlinuz,System.map,
|
|
|
|
|
config) after kernel compilation (installed)"""
|
|
|
|
|
clVars = self.clVars
|
|
|
|
|
bootDir = clVars.Get('cl_kernel_boot_path')
|
|
|
|
|
kernelFullVer = clVars.Get('cl_kernel_full_ver')
|
|
|
|
@ -215,39 +203,95 @@ class cl_kernel(color_print):
|
|
|
|
|
suffixName = "%s-%s-%s-installed"%(fullVerWithoutCalculate,
|
|
|
|
|
clVars.Get('os_arch_machine'),
|
|
|
|
|
clVars.Get('os_linux_shortname'))
|
|
|
|
|
return path.join(bootDir,{"initramfs":"initramfs-%s",
|
|
|
|
|
"initramfs-install":"initramfs-%s",
|
|
|
|
|
"vmlinuz":"vmlinuz-%s",
|
|
|
|
|
"System.map":"System.map-%s",
|
|
|
|
|
"config":"config-%s"}[obj]%suffixName)
|
|
|
|
|
|
|
|
|
|
def _getNewName(self,obj):
|
|
|
|
|
"""Get new names for (initramfs,initramfs-install,vmlinuz,System.map,
|
|
|
|
|
config) which they have after renaming"""
|
|
|
|
|
clVars = self.clVars
|
|
|
|
|
bootDir = clVars.Get('cl_kernel_boot_path')
|
|
|
|
|
kernelFullVer = clVars.Get('cl_kernel_full_ver')
|
|
|
|
|
fullVerWithoutCalculate = kernelFullVer.replace("-calculate","")
|
|
|
|
|
newSuffixName = "%s-%s-%s"%(fullVerWithoutCalculate,
|
|
|
|
|
clVars.Get('os_arch_machine'),
|
|
|
|
|
clVars.Get('os_linux_shortname'))
|
|
|
|
|
initrdName = path.join(bootDir,"initramfs-%s"%suffixName)
|
|
|
|
|
kernelName = path.join(bootDir,"vmlinuz-%s"%suffixName)
|
|
|
|
|
systemMap = path.join(bootDir,"System.map-%s"%suffixName)
|
|
|
|
|
configName = path.join(bootDir,"config-%s"%suffixName)
|
|
|
|
|
newInitrdName = path.join(bootDir,"initramfs-%s"%newSuffixName)
|
|
|
|
|
newInitrdNameInstall = path.join(bootDir,
|
|
|
|
|
"initramfs-%s-install"%newSuffixName)
|
|
|
|
|
newKernelName = path.join(bootDir,"vmlinuz-%s"%newSuffixName)
|
|
|
|
|
newSystemMap = path.join(bootDir,"System.map-%s"%newSuffixName)
|
|
|
|
|
newConfigName = path.join(bootDir,"config-%s"%newSuffixName)
|
|
|
|
|
return path.join(bootDir,{"initramfs":"initramfs-%s",
|
|
|
|
|
"initramfs-install":"initramfs-%s-install",
|
|
|
|
|
"vmlinuz":"vmlinuz-%s",
|
|
|
|
|
"System.map":"System.map-%s",
|
|
|
|
|
"config":"config-%s"}[obj]%newSuffixName)
|
|
|
|
|
|
|
|
|
|
def _getSymlink(self,obj):
|
|
|
|
|
"""Get uid symlinks (initramfs,initramfs-install,vmlinuz,System.map)
|
|
|
|
|
they pointet to object by _getNewName"""
|
|
|
|
|
clVars = self.clVars
|
|
|
|
|
bootDir = clVars.Get('cl_kernel_boot_path')
|
|
|
|
|
kernelUid = clVars.Get('cl_kernel_uid')
|
|
|
|
|
symlinkInitrdName = path.join(bootDir,"initrd-%s"%kernelUid)
|
|
|
|
|
symlinkInitrdNameInstall = path.join(bootDir,
|
|
|
|
|
"initrd-%s-install"%kernelUid)
|
|
|
|
|
symlinkKernelName = path.join(bootDir,"vmlinuz-%s"%kernelUid)
|
|
|
|
|
symlinkSystemMap = path.join(bootDir,"System.map-%s"%kernelUid)
|
|
|
|
|
return path.join(bootDir,{"initramfs":"initrd-%s",
|
|
|
|
|
"initramfs-install":"initrd-%s-install",
|
|
|
|
|
"vmlinuz":"vmlinuz-%s",
|
|
|
|
|
"System.map":"System.map-%s"}[obj]%kernelUid)
|
|
|
|
|
|
|
|
|
|
def createUidSymlinks(self):
|
|
|
|
|
"""Create link iniramfs-UUID,vmlinuz-UUID,System.map-UUID."""
|
|
|
|
|
if self.skipByChrootAndShortname():
|
|
|
|
|
return True
|
|
|
|
|
newInitrdName = self._getNewName("initramfs")
|
|
|
|
|
newInitrdNameInstall = self._getNewName("initramfs-install")
|
|
|
|
|
newKernelName = self._getNewName("vmlinuz")
|
|
|
|
|
newSystemMap = self._getNewName("System.map")
|
|
|
|
|
symlinkInitrdName = self._getSymlink("initramfs")
|
|
|
|
|
symlinkInitrdNameInstall = self._getSymlink("initramfs-install")
|
|
|
|
|
symlinkKernelName = self._getSymlink("vmlinuz")
|
|
|
|
|
symlinkSystemMap = self._getSymlink("System.map")
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
self._installFile(newInitrdName,symlinkInitrdName, symlink=True)
|
|
|
|
|
self._installFile(newInitrdNameInstall,symlinkInitrdNameInstall,
|
|
|
|
|
symlink=True)
|
|
|
|
|
self._installFile(newKernelName,symlinkKernelName, symlink=True)
|
|
|
|
|
self._installFile(newSystemMap, symlinkSystemMap, symlink=True)
|
|
|
|
|
except IOError,e:
|
|
|
|
|
self.printERROR(
|
|
|
|
|
_("Can not create symlink to current kernel: %s '%s'")%
|
|
|
|
|
(e.strerror,e.filename))
|
|
|
|
|
self.printERROR(_("May be kernel was not compiled"))
|
|
|
|
|
return False
|
|
|
|
|
except OSError,e:
|
|
|
|
|
self.printERROR(_("Can not create symlink to current kernel: %s")%
|
|
|
|
|
e.strerror)
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def installBootFiles(self):
|
|
|
|
|
"""Copy -install files to without suffix name, and save old copy.
|
|
|
|
|
|
|
|
|
|
initramfs, vmlinuz, System.map, config with suffix installed copy
|
|
|
|
|
withou suffix. Save old files by append suffix .old.
|
|
|
|
|
Search link files boot directory link to oldfiles and fix symlink.
|
|
|
|
|
Create initramfs install (copy of initramfs)
|
|
|
|
|
"""
|
|
|
|
|
initrdName = self._getName("initramfs")
|
|
|
|
|
kernelName = self._getName("vmlinuz")
|
|
|
|
|
systemMap = self._getName("System.map")
|
|
|
|
|
configName = self._getName("config")
|
|
|
|
|
newInitrdName = self._getNewName("initramfs")
|
|
|
|
|
newInitrdNameInstall = self._getNewName("initramfs-install")
|
|
|
|
|
newKernelName = self._getNewName("vmlinuz")
|
|
|
|
|
newSystemMap = self._getNewName("System.map")
|
|
|
|
|
newConfigName = self._getNewName("config")
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
self._installFile(initrdName,newInitrdName,removeSource=False)
|
|
|
|
|
self._installFile(initrdName,newInitrdNameInstall)
|
|
|
|
|
self._installFile(kernelName,newKernelName)
|
|
|
|
|
self._installFile(systemMap,newSystemMap)
|
|
|
|
|
self._installFile(configName,newConfigName)
|
|
|
|
|
|
|
|
|
|
if not self.skipByChrootAndShortname():
|
|
|
|
|
self._installFile(newInitrdName,symlinkInitrdName, symlink=True)
|
|
|
|
|
self._installFile(newInitrdNameInstall,symlinkInitrdNameInstall,
|
|
|
|
|
symlink=True)
|
|
|
|
|
self._installFile(newKernelName,symlinkKernelName, symlink=True)
|
|
|
|
|
self._installFile(newSystemMap, symlinkSystemMap, symlink=True)
|
|
|
|
|
except (OSError,IOError),e:
|
|
|
|
|
self.printERROR(_("Can not install kernel files: %s")%e.strerror)
|
|
|
|
|
return False
|
|
|
|
|