CentOS : Packing Kernel into RPM - linux

I'm currently using CentOS 6 as a KVM host and will need to customise the kernel to suppport vfio-pci.
Where can I get the spec file for kernel 3.10+ or is there a src.rpm I can download that'll support this feature?
Additionally, I'll also need to patch the kernel with acs override patch and i915 vga arbiter fixes as mentioned in this article: https://bbs.archlinux.org/viewtopic.php?id=162768
Here's a thread for the ACS override patch: https://lkml.org/lkml/2013/5/30/513
and for the i915 vga arbiter fix: https://lkml.org/lkml/2014/5/9/517
How to I apply these patches to the kernel? Thanks.

I've decided to move to Fedora as they're more focussed on leading and advancement. I think it's more suited for the system I'm building.
Anyway, if you still interested in building the kernel on CentOS system, here's some of the things you can do.
SRPM of the kernel can be downloaded from ELRepo via the following link: http://elrepo.org/people/ajb/tmp/
However, it doesn't include the source file. You'll need to download this separately at:
https://www.kernel.org/
For the patch files, it's the difference between the source and target files. Save these differences as files. e.g. I would save the code below as a file called doc_kernel_param_patch:
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 47bb23c..a60e6ad 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
## -2349,6 +2349,16 ## bytes respectively. Such letter suffixes can also be entirely omitted.
nomsi Do not use MSI for native PCIe PME signaling (this makes
all PCIe root ports use INTx for all services).
+ pcie_acs_override =
+ [PCIE] Override missing PCIe ACS support for:
+ downstream
+ All downstream ports - full ACS capabilties
+ multifunction
+ All multifunction devices - multifunction ACS subset
+ id:nnnn:nnnn
+ Specfic device - full ACS capabilities
+ Specified as vid:did (vendor/device ID) in hex
+
pcmv= [HW,PCMCIA] BadgePAD 4
`pd. [PARIDE]`
You'll also need to update the specs file to refer to the patch files created:
Patch0 doc_kernel_param_patch
You can now start the build process. For more information refer to the following post:
https://www.centos.org/forums/viewtopic.php?f=14&t=50512

Related

Nothing provides error - adding new Yocto layer and new machine

I had a question about adding a new machine in Yocto.
I am trying to add both a new layer in Yocto, and a new machine. The machine is based on Atmels SAMA5D27-SOM1-EK-SD evaluation board. I want to enable another UART for this board.
I cloned the kernel source for this board (linux-at91) and added another DTS file based off of at91sama5d27-som1-ek-sd.dts file. I made the changes to enable UART0. I then added this new DTS file to the Makefile in linux-at91/arch/arm/boot/dts . I made a patch to save these changes.
I'm using meta-atmel layer and was following instructions outlined here to build the image for this board.
I have defined another layer that will act as the new Yocto layer that defines my custom machine. I have added some .bbappend files in recipes-kernel to add a patch (which adds a new dts file to the linux at91 kernel source) and to add our custom machine as a compatible machine. My understanding was that we could continue to use the definitions in the meta-atmel layer, but add .bbappend files in the meta-axon layer in the same path, and that would apply the changes that we want.
I have done the same for the recipes-bsp directory. In the meta-axon layer, all the .bbappend files in recipes-bsp only add our custom machine to the list of compatible machines.
However, when I go ahead and build, I get this error:
NOTE: Resolving any missing task queue dependencies
ERROR: Nothing PROVIDES 'at91bootstrap-sam-ba'
at91bootstrap-sam-ba was skipped: incompatible with machine axon-ft3-sp-machine (not in COMPATIBLE_MACHINE)
I'm confused because the recipe file that defines at91bootstrap-sam-ba in meta-atmel does not mention any compatible machines, so I would want to use it from the meta-atmel layer without changing it at all. (edited)
It actually does mention compatible machines.
In at91bootstrap-sam-ba recipe[1], you can find the following line:
require at91bootstrap_${PV}.bb
Let's check out in this recipe then[2]:
COMPATIBLE_MACHINE = '(sama5d3xek|sama5d3-xplained|sama5d3-xplained-sd|at91sam9x5ek|at91sam9rlek|at91sam9m10g45ek|sama5d4ek|sama5d4-xplained|sama5d4-xplained-sd|sama5d2-xplained|sama5d2-xplained-sd|sama5d2-xplained-emmc|sama5d2-ptc-ek|sama5d2-ptc-ek-sd|sama5d27-som1-ek|sama5d27-som1-ek-sd|sama5d2-icp-sd|sam9x60ek|sam9x60ek-sd|sama5d27-wlsom1-ek-sd)'
Using bitbake at91bootstrap-sam-ba -e would show you that, indeed, COMPATIBLE_MACHINE is set and would even tell you where it was set.
P.S.: In some cases, it might actually be a good idea for your custom machine to require the original machine on which it is based (e.g. sama5d27-som1-ek-sd) and make the name of the original machine part of MACHINE_OVERRIDES so that you don't have to add a bbappend for each recipe with a COMPATIBLE_MACHINE. Be careful with the order in MACHINE_OVERRIDES, it is evaluated from right to left with rightmost OVERRIDES being of the highest priority. (Use bitbake -e <recipe> to be sure it's correctly set).
[1] https://github.com/linux4sam/meta-atmel/blob/master/recipes-bsp/at91bootstrap/at91bootstrap-sam-ba_3.9.2.bb#L1
[2] https://github.com/linux4sam/meta-atmel/blob/master/recipes-bsp/at91bootstrap/at91bootstrap_3.9.2.bb#L5

How to create a ubifs with version 5?

I want use the encrypt UBIFS which supported in the linux 4.10 and latter.
And I use the linux 4.18.4 to do the test.
I have done everything OK, and when I use the fscryptctl to set the encrypt policy, I get this error:
fscryptctl set_policy 6de1ee71051bd470 /var/ubifs/
UBIFS error (ubi0:0 pid 1400): ubifs_enable_encryption: on-flash
format version 5 is needed for encryption.
I find place where the error message printed in the kernel, and I try to print the current version for the UBIFS version, and I get the version is 4.
int ubifs_enable_encryption(struct ubifs_info *c)
{
......
if (c->fmt_version < 5) {
ubifs_err(c, "on-flash format version 5 is needed for encryption, current is version %d.", c->fmt_version);
return -EINVAL;
}
......
return err;
}
After I modify the code, And I get the following error message:
UBIFS error (ubi0:0 pid 1400): ubifs_enable_encryption: on-flash
format version 5 is needed for encryption, current is version 4.
So, that means the kernel need version 5 for encrypt, but I use the version 4.
And I need a tool to make the UBIFS with version.
Currently, I use the mtd-utils-2.0.2 which download from http://www.linux-mtd.infradead.org/ to build the ubifs image. And it make the UBIFS with version 4.
I have searched many information about the UBIFS version by google, but get nothing.
Does anyone know how to create a UBIFS with version 5?
Looks like it got added at mtd utils 2.1
Changes from 2.0.2 to `2.1.0:
Features:
- mkfs.ubifs: Implement support for file system encryption
- mkfs.ubifs: Implement selinux labelling support
- ubinize: add support for skipping CRC check of a static volume when opening
- ubimkvol: add support for skipping CRC check of a static volume when opening
- Add lsmtd program

disabling CONFIG_NET_DMA

I'm facing the exact problem mentioned in the following thread :-
Using DMA API in linux kernel but channel is never available
I'm not able to see any DMA channel in /sys/class/dma. The solution for this has been suggested as to disable the CONFIG_NET_DMA. But can you guys tell me how I can disable this particular thing? I checked in make menuconfig but got no idea how to do it.
Output from the search function in menuconfig (type /)
Symbol: NET_DMA [=y]
Type : boolean
Prompt: Network: TCP receive copy offload
Defined at drivers/dma
Kconfig:304
Depends on: DMADEVICES [=y] && DMA_ENGINE [=y] && NET [=y]
Location:
-> Device Drivers
-> DMA Engine support (DMADEVICES [=y])
So you enter ne menu Device Driver and then the sub-menu DMA Engine Support. So, press N on Network: TCP receive copy offload
I took this from a kernel 3.6, but you should be able to find it on any other version.
Probably you can also open the .config file and just remove the line CONFIG_NET_DMA; it should not have other dependent modules

SMACK labels for created files not set

I’m trying to setup SMACK on my system but am having some strange problems.
I have SMACK turned on in my kernel and have added the line:
smackfs /smack smackfs smackfsdef=* 0 0
to my /etc/fstab file. SMACK seems to be enforcing labelled subject/object access as expected. But when I create new files the files do not have the labels of the creating process. Instead the labels are blank.
My kernel version is 3.4.36. My kernel config includes:
CONFIG_NETLABEL=y
CONFIG_SECURITY_NETWORK=y
CONFIG_SECURITY_SMACK=y
CONFIG_DEFAULT_SECURITY_SMACK=y
CONFIG_DEFAULT_SECURITY="smack"
Found the answer to my own question. The yaffs2 file system that my device runs on does not fully support extended attributes for newly created files.

How to compile the linux kernel with an obsolete option?

OK, so I have this embedded kernel whose network card used to work fine with the LLTEMAC option. The new one with LL_TEMAC doesn't. I still see the code with LLTEMAC in the source, but not in the available option in the .config file:
$ ack-grep LLTEMAC
drivers/net/ethernet/xilinx/xilinx_lltemac/Makefile:10:obj-$(CONFIG_XILINX_LLTEMAC) := xilinx_temac.o
drivers/net/ethernet/xilinx/xilinx_lltemac/xlltemac_main.c:2: * Xilinx Ethernet: Linux driver for the XPS_LLTEMAC core.
drivers/net/ethernet/xilinx/xilinx_lltemac/xlltemac_main.c:452:#ifdef CONFIG_XILINX_LLTEMAC_MARVELL_88E1111_RGMII
...
include/linux/xilinx_devices.h:83:/* LLTEMAC platform data */
Is there a way to compile the kernel with this removed option ?
Simply adding CONFIG_XILINX_LLTEMAC=y CONFIG_XILINX_LLTEMAC_MARVELL_88E1111_GMII=y to the .config file does not do anything as the dislaimer states: # Automatically generated file; DO NOT EDIT.
Thanks.
Why not just update this individual driver to understand the new configuration option?

Resources