user1959697
user1959697

Reputation: 31

Modifying the bio structure in linux

I am attempting to modify the bio structure (in blk_types.h) for linux-3.2.0 (running Ubuntu). The only thing I need to do to this structure is to add an additional variable to keep track of an integer variable (it is for a tainting algorithm). However, adding a single line such as "int id;" to the structure halts the boot sequence of the OS.

It compiles, but when booting it gives the following error:

>Gave up wiating for root device. Common problems:  
>Boot args  
>check rootdelay= ...  
>check root= ...  
>missing modules (cat /proc/modules; ls /dev)  
>ALERT! /dev/disk/by-uuid/15448888-84a0-4ccf-a02a-0feb3f150a84 does not exist. Dropping to a shell!  
>BusyBox Built In Shell ...  
>(initramfs)

I took a look around using the given shell and could not find the desired file system by uuid or otherwise (no /dev/sda). Any ideas what might be going on?

Thanks,

-Misiu

Upvotes: 2

Views: 367

Answers (2)

user1959697
user1959697

Reputation: 31

I managed to fix the problem with your help Caf. Though re-building/installing the modules did not seem to help immediately, I was able to get the system to boot by building the SATA drivers into the kernel, as advised by this forum thread: https://unix.stackexchange.com/questions/8405/kernel-cant-find-dev-sda-file-during-boot.

Thanks for your help,

-Misiu

Upvotes: 1

Carlos Carvalho
Carlos Carvalho

Reputation: 11

I suppose you are trying to modify the Linux kernel header bio.h, not its userland "friend" bui.h.

Said that I must warn you that in many places around kernel sizeof() may be used which is more portable and perhaps some other implementation or API may expect some fixed size. If the later is true then you'll have problems since bio' struct size has been changed by you.

It is a guessing with no further investigation from my side (I mean I hadn't investigate about bio in detail) but when patching the Linux kernel one must make sure of any possible side effects and take the whole scenario on account, specially when modifying lower levels implementation.

Bio helper functions do lots of low level operations on bio struct, take a loot at bio_integrity.c for example.

Upvotes: 1

Related Questions