Install kernel source:
First you need to add source-URIs to the sources.list. Just run:
Code:
sudo software-properties-qt
(On KDE) and activate "Source code" on the first tab.
Code:
mkdir kernel
cd kernel
apt source linux-source-<version>
sudo apt build-dep linux-source-<version>
sudo apt install linux-headers-generic libncurses-dev
Change directory to kernel source and show running kernel version:
Code:
cd linux-*
cp -v /lib/modules/`uname -r`/build/Makefile .
uname -r
Set your Linux version in the Makefile
Example for my version 4.15.0-59-generic:
Code:
VERSION = 4
PATCHLEVEL = 15
SUBLEVEL = 0
EXTRAVERSION = -59-generic
Build kernel module:
Code:
cp -v /lib/modules/`uname -r`/build/Module.symvers .
cp -v /boot/config-`uname -r` .config
sudo cp -v /boot/System.map-`uname -r` System.map
make menuconfig
select: File systems -> Miscellaneous filesystems -> UFS file system write support (DANGEROUS)
Save, overwrite .config and exit.
Code:
make prepare
make archprepare
make modules M=scripts
make modules M=fs/ufs
Install kernel module:
Code:
sudo mv /lib/modules/`uname -r`/kernel/fs/ufs/ufs.ko{,.old}
sudo make INSTALL_MOD_DIR=kernel/fs/ufs modules_install M=fs/ufs
Mount with following command:
Code:
sudo mount -t ufs -o ufstype=ufs2,rw /dev/sdb1 /mnt
And this if necessary:
Code:
sudo mount -o remount,rw /mnt