Sony Open Device Project and the Xperia XA2 Ultra….

Now that I’ve built a few ROMs for the XA2 Ultra (AOKP and Resurrection Remix), I’ve turned my attention to the Sony Open Devices Project. The SODP, as it is abbreviated, is an effort to make custom ROMs for various Sony devices that are as open source as possible. This includes reducing the amount of vendor blobs (binary large objects) by replacing them with open source code wherever possible.

While the phones in this program are not 100% vendor blob free, they are dramatically reduced and continue progressing as time goes on and developers continue their work. It’s a great idea with several volunteer and professional staff members (courtesy of Sony), and I am all for it. Here is their statement from their web page linked above:

For some of the Xperia™ devices, we provide Android™ Open Source Project (AOSP) device configurations on GitHub. This means that the software will be open for you as a developer to use and contribute to. This is a way for us to support the open Android community, and it is also a tool for us to facilitate and verify contributions to AOSP.

That said, I’ve started progressing in that direction. I’m not skilled enough to do the helpful work of breaking down blobs and coding an open source alternative, but I’m jumping in by using their material as a base for my ROMs that I build.

One of the greatest advantages I see in using this material is the newer kernels. The XA2 Ultra comes with kernel version 4.4. However, the SODP includes kernels 4.9 and 4.14! Using a newer kernel brings better performance and enhanced security, which is always a plus!

It will be interesting to see what comes of this, how functional the ROMs are, and where I can go from here….

Linux – Keep it simple.

Homemade Bluetooth Auto-start Still Trucking!

start

Well, after a year of service, thousands of miles, and a full fall, winter, spring, and summer, my home made Bluetooth auto-start is still trucking! It’s been really convenient as the weather once again turns cold to pull out my phone, press start, and hear my truck fire up!

There was, however, one blip along the way. several months ago, one of the relays inside the control unit failed. It was simple enough to replace, and within a few minutes, the whole ordeal was over. I don’t think that was a design flaw (not that my design is perfect), but rather a part issue with using cheap relays. The relay that I replaced has worked flawlessly since, and none of the other relays failed, either, leading me to believe it was just a defect in that particular relay.

image20180719_054103226

Linux – keep it simple.

Chirp – programming a HAM radio

While this tool isn’t new for most HAM’s, it was new for me. It’s called CHIRP, and it is a programmer for your radio. More or less, it allows you to input channels, change settings, and download/upload content to your radio. All of these functions can be done from the radio head itself, but this allows you to do it in a nice python scripted interface.

Of note, however, is that the Ubuntu and Debian repositories have incredibly old versions of the program. So old, in fact, that it could not read the downloaded information from the RepeaterBook query that I ran.

If you run into the same issue, be sure to check out chirp’s website: https://chirp.danplanet.com/projects/chirp/wiki/Home with this great explanation of how you can add the PPA to your sources list and get the latest version, like so:

sudo apt-add-repository ppa:dansmith/chirp-snapshots
sudo apt-get update
sudo apt-get install chirp-daily

I will mention, if you already installed chirp from the main repository, you will need to remove it first before installing this chirp-daily package. Once I did that, it was smooth sailing!

As for how to use chirp, I learned it all from a Youtube video by David Casler. It’s a great video and very thorough.

Linux – keep it simple.

error: implicit declaration of function ‘INIT_DELAYED_WORK_DEFERRABLE’

While working on the nightmare governor for the Xperia XA2 Ultra (sdm660), I ran into this error:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_nightmare.c:714:3: error: implicit declaration of function ‘INIT_DELAYED_WORK_DEFERRABLE’ [-Werror,-Wimplicit-function-declaration]
INIT_DELAYED_WORK_DEFERRABLE(&this_nightmare_cpuinfo->work, do_nightmare_timer);
^
/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_nightmare.c:714:3: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
2 errors generated.

On that line, I saw this:

INIT_DELAYED_WORK_DEFERRABLE(&this_nightmare_cpuinfo->work, do_nightmare_timer);

So I did a little digging, and found a great Linux resource site: https://elixir.bootlin.com

What makes it so great, is you can search each version of the kernel (back to 2.6.11) up to the latest version, and search for any term in them. A quick perusal found this term was used up to the 2.6.39 kernel in the include/linux/workque.h file. It goes like this:

#define INIT_DELAYED_WORK(_work, _func)				\
	do {							\
		INIT_WORK(&(_work)->work, (_func));		\
		init_timer(&(_work)->timer);			\
	} while (0)

#define INIT_DELAYED_WORK_ONSTACK(_work, _func)			\
	do {							\
		INIT_WORK_ONSTACK(&(_work)->work, (_func));	\
		init_timer_on_stack(&(_work)->timer);		\
	} while (0)

#define INIT_DELAYED_WORK_DEFERRABLE(_work, _func)		\
	do {							\
		INIT_WORK(&(_work)->work, (_func));		\
		init_timer_deferrable(&(_work)->timer);		\
	} while (0)

But it was later changed to be like this in 4.4:

#define INIT_DELAYED_WORK(_work, _func)					\
	__INIT_DELAYED_WORK(_work, _func, 0)

#define INIT_DELAYED_WORK_ONSTACK(_work, _func)				\
	__INIT_DELAYED_WORK_ONSTACK(_work, _func, 0)

#define INIT_DEFERRABLE_WORK(_work, _func)				\
	__INIT_DELAYED_WORK(_work, _func, TIMER_DEFERRABLE)

#define INIT_DEFERRABLE_WORK_ONSTACK(_work, _func)			\
	__INIT_DELAYED_WORK_ONSTACK(_work, _func, TIMER_DEFERRABLE)

So, I edited the gov like by changing to the newer definition which seems to do the same thing:

INIT_DELAYED_WORK_ONSTACK(&this_nightmare_cpuinfo->work, do_nightmare_timer);

And, praise God! It even worked! I love it when you can find good, helpful resources out there. I know I’ve bookmarked elixir! I’ll be using that reference again!

Linux – keep it simple.

error: implicit declaration of function ‘cputime64_sub’ [-Werror,-Wimplicit-function-declaration]

You might be getting tired of these by now, but I really do use this website as my scratchpad, so I can jump back to something that I worked on before. I also hope that people who are searching for an error can find it here, possibly with an answer…. And today is no different. Another kernel compiling error….

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, and several of them had the same underlying issues. Part of the problem was that I got the governors from a 3.10 kernel and put them into a 4.4 kernel, so understandably some things have changed.

This error popped up in a few of the governors that I was editing, here’s a few examples of the error code before the compiler would grind to a halt:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass.c:206:15: error: implicit declaration of function ‘cputime64_sub’ [-Werror,-Wimplicit-function-declaration]
delta_idle = cputime64_sub(now_idle, this_smartass->time_in_idle);

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:141:29: error: implicit declaration of function ‘cputime64_sub’ [-Werror,-Wimplicit-function-declaration]
delta_idle = (unsigned int) cputime64_sub(now_idle, time_in_idle);

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_brazilianwax.c:217:22: error: implicit declaration of function ‘cputime64_sub’ [-Werror,-Wimplicit-function-declaration]
delta_idle = cputime64_sub(now_idle, this_brazilianwax->time_in_idle);

This was a bit odd. Inside of these governors, there were several adding and subtracting functions. This particular call wants to subtract the second item from the first item. Apparently, this function used to be hosted somewhere that these govs could draw from. So, since it was lacking, I added it in:

// WJH because it is not defined elsewhere
#ifndef cputime64_sub
#define cputime64_sub(__a, __b) ((__a) – (__b))
#endif

By adding the #ifndef tag, it will only add my local definition if it is not positively defined somewhere else first. This avoids any sort of conflict if the gov was later put into a kernel where it was defined for them. I like simple fixes!

Linux – keep it simple.

error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] MODULE_LICENSE(“GPL”);

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, and several of them had the same underlying issues. Part of the problem was that I got the governors from a 3.10 kernel and put them into a 4.4 kernel, so understandably some things have changed.

So here is a funny one. Since I was updating a few governors for a newer kernel, one of the things that must have been previously declared somewhere was to include the “module.h” file that allows modules to have tags. These tags are benign, and are only for reference, since they just state text such as the version number or the license type or title of the module.

However, it will stop your compiler dead in it’s tracks if you run into this, just like it did for me. Here’s a few examples:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_brazilianwax.c:826:16: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
MODULE_LICENSE (“GPL”);

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass.c:751:15: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
MODULE_AUTHOR (“Erasmux”);

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:768:15: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
MODULE_LICENSE(“GPL”);

It’s easy to fix, though, since all you have to do is include the modules.h file, like so:

#include <linux/module.h>

Just put it with the other includes at the beginning of the file, and you should be good to go.

Linux – keep it simple.

error: use of undeclared identifier ‘pm_idle’

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, and several of them had the same underlying issues. Part of the problem was that I got the governors from a 3.10 kernel and put them into a 4.4 kernel, so understandably some things have changed.

Another error that I’ve had pop up numerous times is this whole “pm_idle” issue:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_asswax.c:765:4: error: use of undeclared identifier ‘pm_idle’
pm_idle = pm_idle_old;

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_brazilianwax.c:712:39: error: use of undeclared identifier ‘pm_idle’
pm_idle_old = pm_idle;

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass.c:602:18: error: use of undeclared identifier ‘pm_idle’
pm_idle_old = pm_idle;

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass2.c error: use of undeclared identifier ‘pm_idle’
pm_idle_old = pm_idle;

It appears that somewhere in the older kernel, “pm_idle” was declared somewhere, but it no longer is declared in the newer 4.4 kernel. So, I just declared it in each governor by adding these lines at the beginning:

static void (*pm_idle)(void); // WJH

Now that it is declared (statically, so it stays here), it can be used in the formulas to calculate the needed values for adjusting the CPU frequencies. I’m honestly not sure that this was the best fix, but it certainly did work and now the compiling finished and the governors did function. At least, as far as I could tell….

Linux – keep it simple.

field designator ‘suspend’ does not refer to any field in type ‘struct early_suspend’

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, and several of them had the same underlying issues. Part of the problem was that I got the governors from a 3.10 kernel and put them into a 4.4 kernel, so understandably some things have changed.

I received a series of errors while compiling, complaining about early suspend. Here are some examples:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass2.c: undefined reference to `register_early_suspend’

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass.c:739: undefined reference to `register_early_suspend’

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:641: undefined reference to `register_early_suspend’
/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:670: undefined reference to `unregister_early_suspend’

 

field designator ‘suspend’ does not refer to any field in type ‘struct early_suspend’

All of these errors came after I had received an error about the compiler being unable to find linux/early_suspend.h. So I downloaded that file from the internet and put it in the include directory, only to realize that I needed the c file as well! Again, I downloaded the c file and put it in, only to find that the header and code file didn’t match. They were from different kernels and didn’t match up. Anyhow, once I found the most up to date version of the file, then I could actually use it! Here’s my commit if you want to check it out.

Either way, if you run into a similar message, make sure you have set “CONFIG_HAS_EARLYSUSPEND=Y” in your defconfig, or when you compile your kernel, it wont actually get turned on or built!

Linux – keep it simple.

Picked up two more badges from CompTIA!

Well, I’m not 100% sure how valuable they are, but I picked up a few more CompTIA badges recently. I’ve been going through the CompTIA certifications to renew some that I had, and to pick up some new ones. All told, this now gives me eight badges: A+, Net+, Sec+, Linux+, CIOS, CSSS, CSIS, and CLNP. Now I just need a purpose for all of that alphabet soup!

Previously, my job required just one certification, Linux+, but the month that I went to take the test, my work changed the one requirement from Linux+ to Net+. So I finished taking the Linux+ test, and then the next month took the Net+ test. Now, my work actually doesn’t require any certification at all, “sort of”. It is a little bit complicated in the contractor world, but essentially, my actual employer does not require it, but while the company that they contract through does not either, they are pushing for it with bonuses for companies under them to have certified technicians. I get the feeling that my company will one day decide to secure the bonus by mandating certifications.

If that ever happens, well, I’ll be ready. But for now, I just have a lot of alphabet soup. Required or not, though, I like taking these certification tests because I feel it keeps me sharp and in the loop about the IT world. Sometimes we get rather specialized on a certain group of equipment, and we start to loose focus on the IT world as a whole. These certs help me with that by making sure I’m current on best practices, infrastructure, and technology.

Now I just have to decide which one to take next. I think I’ll go for something like Server+. Any suggestions?

Linux – keep it simple.

cpufreq_interactivex.c:239:9: error: implicit declaration of function ‘strict_strtoul’ [-Werror,-Wimplicit-function-declaration]

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;

 

etc…..

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
kernel.

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.