Skip to content

Instantly share code, notes, and snippets.

Copy kernel module <module> to the drivers directory.
$ sudo cp <module>.ko /lib/modules/$(uname -r)/kernel/drivers/
Add the simple name of my module to the file /etc/modules. You can edit the file or just append to it as shown here.
$ echo '<module>' | sudo tee -a /etc/modules
Update the list of module dependencies.
$ sudo depmod
Reboot the computer and voila, it worked.
@strezh
strezh / autoload_driver.md
Last active February 7, 2024 12:16
Automatic create /dev file when driver module is loaded, automatic load driver on startup.

Automatic create /dev file

example driver module:

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/fs.h>
change:
1. pci_find_device -> pci_get_device
2. ioctl: XPCIe_Ioctl -> unlocked_ioctl: XPCIe_Ioctl,
3. int XPCIe_Ioctl(struct inode *inode, -> int XPCIe_Ioctl(/*struct inode *inode, */
@strezh
strezh / gist:f889fc79d59b38b4321c
Created June 9, 2015 12:59
STM32 Error: undefined reference to `_sbrk'
In CooCox IDE Repository add to project:
C Library: Implement the minimal functionality...
@strezh
strezh / gmock_debian.md
Created February 17, 2015 09:10
Install google-mock on Debian
cd ${GMOCK_ROOT}
mkdir build
cd build
g++ -I../gtest/include -I../gtest -I../include -I.. -c ../gtest/src/gtest-all.cc
g++ -I../gtest/include -I../gtest -I../include -I.. -c ../gmock/src/gmock-all.cc
ar -rv libgmock.a gtest-all.o gmock-all.o
@strezh
strezh / STM32_WinVM.md
Created February 9, 2015 13:55
Use STM32+CooCoX in VirtualBox VM on Linux
  1. Install VM Extension pack in Virtual Machine
  2. Enable USB2.0 (EHCI) Controller in VM Settings
  3. Start-up and and shutdown VM, to ensure VM installs driver required by USB2.0 Controller
  4. Add USB filter for ST-Link/V2 USB programmer. (Do enter serial number , VM has issue with serial number containing non-readable ascii characters. )
  5. Install ST-Link utility in VM.
  6. Plug-in ST-Link programmer. Note: Host may install driver for USB2.0 Controller. Apparently this only works on USB2.0 host port , but later versions of Virtual Box may support USB3.0 ports.

If you got error:

Could not load the Host USB Proxy Service

@strezh
strezh / convert_y4m_to_yuv.sh
Last active August 29, 2015 14:14
convert input y4m file to 3 different YUV formats - YUV420, YUV422, YUV444
#!/bin/bash
if [[ $#>0 ]]
then
INPUT_FILE_NAME=$1
else
exit
fi
FILE_NAME=`sed 's/\.y4m$//' <<< ${INPUT_FILE_NAME}`
  1. Маленькая и удобная утилита для получения изображений с вебкамеры.
fswebcam -q -d /dev/video1 -r 800x600 /path/to/webcam.jpg
  1. Конвертирование y4m в различные форматы (вместо avconv может быть ffmpeg):
avconv -i <file_name>.y4m -pix_fmt yuv420p <file_name>.yuv
avconv -i <file_name>.y4m -pix_fmt yuv422p <file_name>.yuv
avconv -i <file_name>.y4m -pix_fmt yuv444p <file_name>.yuv
@strezh
strezh / stm32_tools_linux.md
Last active August 29, 2015 14:14
Сборка инструментов для STM32 под Linux
@strezh
strezh / QuestaSimNotes.md
Last active September 27, 2023 12:20
QuestaSim notes

Установка под Linux

При установке под линукс (проверено на Ubuntu 16):

  1. Устанавливаем wine
  2. Из папки crack копируем файл MentorKG.exe в <install_dir>/linux (или /linux_x86_64)
  3. Выполняем
sudo chown root:root ~/.wine