First, it is simpler to create a cscope database specific to a particular architecture as follows : In Linux kernel's top folder, run
ARCH=x86 make cscope
This creates a cscope with relative paths.
Now you can ask vim to interpret the paths relative to the location of the cscope.out file in one of two ways:
Way 1 : Use cscoperelative
. Output of :help csre
:
If 'cscoperelative' is set, then in absence of a prefix given to cscope
(prefix is the argument of -P option of cscope), basename of cscope.out
location (usually the project root directory) will be used as the prefix
to construct an absolute path. The default is off. Note: This option is
only effective when cscope (cscopeprg) is initialized without a prefix
path (-P). Examples: >
:set csre
:set nocsre
Way 2 : (From Aaron Hs' answer in this question) When adding the cscope database in vim, specify base location. Example:
:cs add <base_location>/cscope.out <base_location>/
From vim's help page for cscope add:
USAGE :cs add {file|dir} [pre-path] [flags]
[pre-path] is the pathname used with the -P command to cscope.