I want to try my simple kernel module hello.ko on QEMU. I have root filesystem on hdd.img file and compiled kernel in another folder. I run QEMU by this command from directory with sources:
qemu-system-i386 -m 128M -kernel arch/x86/boot/bzImage -append "root=/dev/sda" -hda hdd.img
How to install my module? Modprobe? But how to specify WHERE to install? As I
understand, modprobe install module to my host system, not to QEMU-related?
Installing own kernel module into target machine is very similar to installing into current machine:
Mount device with root filesystem for target machine. Mount point is referred as <mount-point> below.
Copy (e.g. with cp command) your module file (hello.ko) into directory with other kernel's modules, located at <mount-point>/lib/modules/<kernel-version>/. It is better to use additional subdirectory extra/ for 3d-party modules.
If you want you module to be loaded with modprobe on target machine, you need to use depmod command, which has been used for the kernel itself:
depmod -b <mount-point>/lib/modules/<kernel-version>
Related
I am trying to mount a remote dir onto my local machine using sshfs.
My local is running Ubuntu 20.04. When I try:
sudo modprobe fuse
I get:
modprobe: FATAL: Module fuse not found in directory /lib/modules/5.4.162-1-pve
Fuse (2.9.9-3) is installed on my local machine. The /lib path does not hold a modules/ directory.
How can I make modprobe work?
The remote machine is a Linux container. That explains why the modprobe command is not working.
I was trying to test qemu on Windows OS and when I tried to start an ubuntu iso whith the following command:
qemu-system-x86_64.exe -boot d -cdrom .\ubuntu-20.04.1-desktop-amd64.iso -m 2048
Then I getting the following error:
qemu: could not load PC BIOS 'bios-256k.bin'
Qemu folder is set in Enviroment Varibles and the bios-256k.bin file is in the folder
How can I solve this problem?
Add an option for bios file directory entry with -L switch. Your command should look like this:
qemu-system-x86_64.exe -boot d -cdrom .\ubuntu-20.04.1-desktop-amd64.iso -m 2048 -L "C:\Program Files\qemu"
Of course in case your default qemu installation is in C:\Program Files\qemu and bios files are inside that directory. For some reason, qemu has a bug that doesn't search bios files in defined path and look for them in current working directory.
Edit: I found a bug report that mentions this issue. It also seems to be fixed in newest version. Anyway, here is the link: https://bugs.launchpad.net/qemu/+bug/1915794
This is a known and documented problem with a simple workaround: "Known issue: currently requires start from installation directory or -L option to specify the location of the firmware files."
And it is already fixed in the newer installer.
Just synced up to latest Linux bpf-next repo (5.3.0) and trying to compile samples/bpf directory. The Linux kernel compiles fine. This is on a Linux host and the default config was taken from /boot/config-* and changed to define XDP param. I do have root access to the build machine.
This is what I get and no .o's are seen in the dir.
sudo make samples/bpf/
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
I have a checkout of the repo (5.2.0-rc*) in a ubuntu VM and the build succeeds fine there.
What am I missing? Any pointers appreciated.
Thanks!
I'm trying to create a shared folder between MacOS (Host) and Debian (Guest) in virtualbox. I've completed the steps of installing guest additions, creating a shared folder called "share" and a folder in debian called "sf", but when I try to run
sudo mount -t vboxsf share ~/sf
I get the error
mount: realpath /Users/USERNAME/sf: No such file or directory
I'm under the impression the second path is meant to be the directory in Debian. This also happens when I remove the ~/.
Looks like you are trying to run this command from your OSX shell. Is that possibly the case?
If yes, switch to your shell on the Debian guest. Also make sure the directory ~/sf actually does exist before you run the mount command.
Hope this helps.
I am looking for a way to load my linux device driver automatically on start-up. For that I created a udev rules file:
KERNEL=="k1", SUBSYSTEM=="subx", SYMLINK+="sym_subx", ATTRS{vendor}=="0x14ab", ATTRS{device}=="0xe001", MODE="0660", GROUP="xyz"
I manually installed the driver first and then restarted the udev. After this, for the first time, I uninstalled and then installed the driver. I could see the driver getting installed correctly and also the symlink being created.
Now when I restart the machine, I am expecting that the driver is loaded automatically on start-up but its not the case. What could be missing here? Is there any entry that I need to do in some .conf file (modprobe.conf or any other)? Where should I put my module.ko file?
I am suspecting that something minor is missing. Any help will be highly appreciated.
Regards,
Sapan
I was finally able to do it myself. Steps to load the driver automatically are:
Put module.ko in /lib/modules/$(uname -r)/kernel/drivers/ - You may need to create the "module" directory for the first time
Write Udev Rules
% sudo depmod -a
This will update the dependencies of the drivers
Check /lib/modules/$(uname -r)/modules.dep file and search for modules.ko . It should list the dependencies on other modules if any
% sudo /sbin/reboot OR sudo udevadm trigger
It worked for me Linux SLES11