Lately I’ve been going through the Xperia XA2 Ultra kernel (sdm660) and trying to add new features. Today I was adding in some governors, specific to this post, is the interactiveX governor.

That’s when I ran into this error:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:239:9: error: implicit declaration of function ‘strict_strtoul’ [-Werror,-Wimplicit-function-declaration]
return strict_strtoul(buf, 0, &min_sample_time);

It took me a while to find an answer for it, but once I did, I saw it over and over again as I added more govs to the kernel:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_brazilianwax.c:406:15: error: implicit declaration of function ‘strict_strtoul’ [-Werror,-Wimplicit-function-declaration]
res = strict_strtoul(buf, 0, &input);

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_skywalker.c:723:5: error: implicit declaration of function ‘strict_strtoul’ [-Werror,-Wimplicit-function-declaration]
if(strict_strtoul(buf, 0, &inc_cpu_load)==-EINVAL) return -EINVAL;


/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass2.c: error: implicit declaration of function ‘strict_strtoul’ [-Werror,-Wimplicit-function-declaration]
if(strict_strtoul(buf, 0, &inc_cpu_load)==-EINVAL) return -EINVAL;



With about half of the governors that I added, this error popped up, mainly because I was taking the govs from an older 3.10 kernel and trying to apply them to a 4.4 kernel. That’s a pretty big jump, and several parts of the code gave me interesting errors to hunt down, but this one was so simple to fix, just hard to find. I can’t take the credit, though, since I found this thread where a guy had a similar issue and fixed it.

According to Vasiliy Tolstov:

strict_strtoul() was just a redefinition of kstrtoul() for a long
time. From kernel version of 3.18, strict_strtoul() will not be
defined at all. A compile time kernel version check is needed to
decide which function or macro can be used for a specific version of

Fortunately, the fix was pretty simple. Using gedit, I replaced every instance of “strict_strtoul” with “kstrtoul” in each of these governors. After that, the error not only went away, but the govs actually worked!

Linux – keep it simple.

Leave a Reply

Your email address will not be published. Required fields are marked *