Skip to content

Instantly share code, notes, and snippets.

Compile kernel

  1. make menuconfig
  2. make -j40
  3. sudo make modules_install
  4. sudo make install
  5. sudo reboot

Some dependencies to install before compilation:

  1. sudo apt-get install libncurses5-dev libncursesw5-dev
  2. sudo apt-get install libssl-dev

1. Add a new entry in syscall table

add a entry in arch/x86/entry/syscalls/syscall_64.tbl:

322     64      execveat                stub_execveat  
323     common  userfaultfd             sys_userfaultfd  
324     common  membarrier              sys_membarrier  
325     common  mlock2                  sys_mlock2  
326     common  hello                   sys_hello      <---- 加在这一行  
  1. edit file ~/.Xmodmap
clear control
clear mod4

keycode 105 =
keycode 206 =

keycode 133 = Control_L NoSymbol Control_L
keycode 134 = Control_R NoSymbol Control_R
  1. edit /usr/share/X11/xkb/symbols/pc
key <LCTL> {    [ Super_L       ]   };
key <LWIN> {    [ Control_L     ]   };
key <RCTL> {    [ Super_R       ]   };
key <RWIN> {    [ Control_R     ]   };
  1. clear cache rm -rf /var/lib/xkb/*

RDMA R&W flow

1. Server side

  1. rdma_create_event_channel(); //Opens an event channel used to report communication events

  2. rdma_create_id(); //Creates an identifier that is used to track communication information

  3. rdma_bind_addr(); //associates a source address with an rdma_cm_id

gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier ''

# RDMA resource creation hierarchy
`struct ibv_device` -> `struct context` ---> `struct ibv_pd` ---> `struct ibv_mr`
| |-> `struct ibv_ah`
| |-> `struct ibv_srq`
| |-> `struct ibv_qp`
|
|-> `struct ibv_comp_channel`
|-> `struct ibv_cq`

ssh without password

In client side, make sure current directory is ~/:

  1. generate public key & private key
ssh-keygen -t rsa
  1. make ~/.ssh directory in server side
ssh b@B mkdir -p .ssh
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic
" http://amix.dk - amix@amix.dk
"
" Version:
" 6.0 - 01/04/17 14:24:34
"
" Blog_post:
" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github

PMEM emulation

  1. make sure the kernel version is 4.x;
  2. edit /etc/default/grub:
GRUB_CMDLINE_LINUX="memmap=nn[KMG]!ss[KMG]"

this command reserve physical memory region [ss, ss + nn], the unit could be [KB, MB, GB]; if more than one persistent memory is needed, add more command:

GRUB_CMDLINE_LINUX="memmap=nn1[KMG]!ss1[KMG] memmap=nn2[KMG]!ss2[KMG]"