Tuesday, 21 January 2020

[linux] changes

Duplicating your current config

cp /boot/config-`uname -r`* .config

Making the default config

make defconfig

Change a module

vim drivers/net/ethernet/intel/e1000e/netdev.c
=>
......
struct e1000_hw *hw;

printk(KERN_ALERT "DEBUG: Passed %s %d \n",__FUNCTION__,__LINE__);

Compile a kernel

make M=drivers/usb/serial -j8 # Build only a portion of the kernel with 4 core CPU
lscpu # check how many core the pc has
make -j8 # Build entire kernell with 4 core CPU

make localmodconfig

Build kernel

make -JX

Run on QEMU

qemu-system-x86_64 -no-kvm -kernel arch/x86/boot/bzImage -hda /dev/zero -append "root=/dev/zero console=ttyS0" -serial stdio -display none

Install a kernel

sudo make install

Build a module 

make modules SUBDIRS=drivers/the_module_directory

Install a module

sudo make modules_install SUBDIRS=drivers/the_module_directory

OR (if the driver installed as a module, just recompile it)

make drivers/usb/host/xhci-hcd.ko

Reload the module

sudo rmmod xhci-hcd && sudo insmod drivers/usb/host/xhci-hcd.ko

Remove kernel from boot

sudo rm -rf /lib/modules/3.3.7*
sudo rm -rf /usr/lib/modules/$(uname -r)
/boot
/lib/modules

update-grub

Remove kernel from grab


Now I understand the difference between an updated kernel and install and compile a kernel. I compiled all this kernel and the solution to delete was:
I went to nautilus as root sudo nautilus and just deleted:
/boot/vmlinuz "kernel I want to delete"
/boot/initrd "kernel I want to delete"
/boot/System "kernel I want to delete"
/boot/config "kernel I want to delete"
/lib/modules "kernel I want to delete"
and updated the grub sudo update-grub2
OR

locate *5.5.0-rc6*
sudo rm /lib/modules/5.5.0-rc6+
sudo rm -rf /lib/modules/5.5.0-rc6+

Loadable Kernel Modules


list modules

lsmod
......
e1000e                249856  0
......

module info

modinfo e1000e
......
name:           e1000e
vermagic:       5.3.0-26-generic SMP mod_unload 
signat:         PKCS#7
signer:         
sig_key:        
sig_hashalgo:   md4
parm:           debug:Debug level (0=none,...,16=all) (int)
parm:           copybreak:Maximum size of packet that is copied to a new buffer on receive (uint)
parm:           TxIntDelay:Transmit Interrupt Delay (array of int)
parm:           TxAbsIntDelay:Transmit Absolute Interrupt Delay (array of int)
parm:           RxIntDelay:Receive Interrupt Delay (array of int)
parm:           RxAbsIntDelay:Receive Absolute Interrupt Delay (array of int)
parm:           InterruptThrottleRate:Interrupt Throttling Rate (array of int)
parm:           IntMode:Interrupt Mode (array of int)
parm:           SmartPowerDownEnable:Enable PHY smart power down (array of int)
parm:           KumeranLockLoss:Enable Kumeran lock loss workaround (array of int)
parm:           WriteProtectNVM:Write-protect NVM [WARNING: disabling this can lead to corrupted NVM] (array of int)
parm:           CrcStripping:Enable CRC Stripping, disable if your BMC needs the CRC (array of int)

search the module

git grep e1000e -- '*Makefile'

load module at boot

normally

sudo vim /etc/modules
=>
......
e1000e

with params

sudo vim /etc/modprobe.d/e1000e.conf
=>
option e1000e debug=11

No comments:

Post a Comment

vm - Centos - Boot into latest Kernel

sudo grub2-set-default 0 sudo grub2-mkconfig -o /boot/grub2/grub.cfg sudo reboot