CID_PATH not defined!

In an attempt to update the AOKP 7.1.1 rom for the Samsung Galaxy S4 to 7.1.2, I received an error about AOKP712/hardware/libhardware_legacy/wifi/wifi.c:179.18. The error complained that the CID_PATH was not defined, declared, or was not known.

Obviously, it was supposed to be declared somewhere, and I had two choices, declare it, or replace it with the actual path. I did the latter. Here is the old file:

[CODE]
#ifdef SAMSUNG_WIFI
char* get_samsung_wifi_type()
{
char buf[10];
int fd = open(CID_PATH, O_RDONLY);
if (fd < 0)
return NULL;
[/CODE]

And here is the new file changes:

[CODE]
#ifdef SAMSUNG_WIFI
char* get_samsung_wifi_type()
{
char buf[10];
int fd = open(“/data/.cid.info”, O_RDONLY); // WJH
if (fd < 0)
return NULL;
[/CODE]

And, to God be the glory, it works! One error down, only dozens to go!

Linux – keep it simple.

Advertisements

Updated the S4Camera app!

As we spoke about last time, there were two problems with my custom S4 camera app:

  1. No way to stop the recording, you had to wait for the 1 or 3 minute timer to elapse.
  2. No audio was recorded.

Well, I haven’t fixed everything yet, but I was able to fix issue #1, stopping the recording. Essentially, I added a button which was invisible all of the time, unless you were recording. Once you start recording (still for 1 or 3 minutes), the stop recording button will become visible in the corner of the screen.

Pressing that stop recording button causes a super user command to be sent using pkill -2 to kill the screenrecord function. A -2 pkill command is the same as a ^c (control-c) command. That is a very nice command which tells it to wrap up and then stop, but do so now! I tried other pkill commands, which literally kill the process in a less than nice fashion, but when I do that, the video is not “ended” properly and becomes unreadable. This method allows the screenrecord function to properly close writing to the video so it is readable!

You can check out the changes and download the latest version on my Github:

https://github.com/alaskalinuxuser/S4camera_app

https://github.com/alaskalinuxuser/S4camera_app/commit/51f0934ee7eed612f1fd168e20b27afc148e6a17

Linux – keep it simple.

A special camera app for the Samsung Galaxy S4!

Recently I was fortunate enough to compile a working version of AOKP Nougat for the Samsung Galaxy S4 JFLTETMO/JFLTEXX phones (Praise God!). For the most part, it seems to work great. The only big issue is a problem with the camera.

It’s not that the camera doesn’t work. In fact it still takes wonderful pictures. What doesn’t work, however, is creating a video recording. Actually, it causes the camera app to crash just attempting to select video mode from the app. I tried several different apps, and they all produce the same results. So, I decided to do something about it.

I tried looking over the crash logs, and it just didn’t make enough sense for me to make changes to the device trees for the camera. But, I didn’t want to give up. Instead, I decided to make a custom camera app that would overcome these difficulties. By God’s grace, I was successful!

It is still a work in progress, but it works well enough for now. The actual command to open the camera and take a video just isn’t working, so I made a workaround. Instead, the camera app simply displays the camera on a surface view, and I leveraged root (su) permission to record that surface view to a file: /sdcard/Pictures/video.mp4. After the recording is complete, there is a command to rename the file the current time in milliseconds, so the user doesn’t have to worry about overwriting their just recorded video by making another recording.

There is a camera picture button, which allows you to take a picture. The picture is taken via the normal camera method, since that portion works correctly. To take a video, you can click on the 1m/3m icon to choose 1 minute or 3 minutes of video recording, then hit the record button. Once you press record, the icons disappear and only the camera view is displayed, as the surface view is being recorded.

There are currently two main problems:

  1. There is no way currently to stop the recording. You simply have to “wait it out”. After the 1 or 3 minutes that you chose are up, the icons re-appear and a pop-up informs you that it is done. If you exit the app at this time, your home screen will be recorded instead until the time expires.
  2. There is currently no audio. I am fairly new at Android app making, and this is a huge learning curve for me, so I have not gotten the audio figured out yet.

You can check it out on my Github if you would like to view the source, you are welcome to use or abuse the source code in any way that helps you with your own projects as well. The app is build-able in Android Studio.

https://github.com/alaskalinuxuser/S4camera_app

And, if you want to download the app, it is also located on that Github page.

Linux – keep it simple.

Error! Sometimes they are hard to find!

Sometimes errors can be nested deep in the terminal output, in fact, sometimes it is so deep that you have to scroll back several HUNDRED LINES just to find it. Consider this real example from helping a fellow developer:

[CODE]

….EDITED FOR SPACE….
….LINE# 135….

device/samsung/grandprimeve3g/libs/audio/audio_hw.c:666:34: error: ‘AUDIO_DEVICE_OUT_FM_SPEAKER’ undeclared here (not in a function)
{ AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_FM_SPEAKER, “speaker” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:667:75: error: ‘AUDIO_DEVICE_OUT_FM_HEADSET’ undeclared here (not in a function)
{ AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_FM_HEADSET, “headphone” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:670:44: error: ‘AUDIO_DEVICE_OUT_ALL_FM’ undeclared here (not in a function)
{ AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET | AUDIO_DEVICE_OUT_ALL_FM, “line” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:684:32: error: invalid operands to binary | (have ‘int’ and ‘const struct dev_names_para_t *’)
{ AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_FM_SPEAKER, “speaker” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:684:5: error: initializer element is not constant
{ AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_FM_SPEAKER, “speaker” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:684:5: error: (near initialization for ‘dev_names_digitalfm[0].mask’)
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:685:73: error: invalid operands to binary | (have ‘int’ and ‘const struct dev_names_para_t *’)
{ AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_FM_HEADSET, “headphone” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:685:5: error: initializer element is not constant
{ AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_FM_HEADSET, “headphone” },
^
device/samsung/grandprimeve3g/libs/audio/audio_hw.c:685:5: error: (near initialization for ‘dev_names_digitalfm[1].mask’)
In file included from device/samsung/grandprimeve3g/libs/audio/audio_hw.c:810:0:

….EDITED FOR SPACE….
….LINE# 843….

build/core/binary.mk:803: recipe for target ‘/home/hassan/Working/LiquidDark-RRO-Layer-Ih24n/out/target/product/grandprimeve3g/obj/SHARED_LIBRARIES/audio.primary.sc8830_intermediates/audio_hw.o’ failed
make: *** [/home/hassan/Working/LiquidDark-RRO-Layer-Ih24n/out/target/product/grandprimeve3g/obj/SHARED_LIBRARIES/audio.primary.sc8830_intermediates/audio_hw.o] Error 1
make: *** Waiting for unfinished jobs….

….EDITED FOR SPACE….
….LINE# 990….

device/samsung/grandprimeve3g/libs/audio/record_process/aud_proc_config.c:956:5: warning: (near initialization for ‘recordeq_filter_set[0]’) [-Wmissing-braces]
device/samsung/grandprimeve3g/libs/audio/record_process/aud_proc_config.c: In function ‘AUDPROC_ProcessDp’:
device/samsung/grandprimeve3g/libs/audio/record_process/aud_proc_config.c:1319:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(si=0;si<uiSrcCount;si++)//AUDIO POST PROCESS
^

#### make failed to build some targets (53:06 (mm:ss)) ####

Total time elapsed: 53 minutes 12 seconds

[/CODE]

As you can see, the "make failed" line is around line 990 of the terminal output. However, the line that actually shows that make has an error is back at line 840, and the reason make has an error is all the way back at line 135! Sometimes what we are looking for is really hard to find, especially if you are scrolling through seemingly endless terminal outputs trying to read every line, looking for your failure.

One great trick that you can use is to copy your output into a text file. Then you can use standard search tools, like grep, or even your text applications search functions to find key words like: error, fail, stop, forbidden warning, or other similar words that clue you in to the real problem.

In this case, the issue that he had was captured in line 135 of his copied output from the terminal:

[CODE]

device/samsung/grandprimeve3g/libs/audio/audio_hw.c:666:34: error: 'AUDIO_DEVICE_OUT_FM_SPEAKER' undeclared here (not in a function)
{ AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_FM_SPEAKER, "speaker" },

[/CODE]

There are several options, one of which is this:

The audio_hw.c file line 666:

{ AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_FM_SPEAKER, "speaker" },

Wecould remove "AUDIO_DEVICE_OUT_FM_SPEAKER"

Like this:
{ AUDIO_DEVICE_OUT_SPEAKER, "speaker" },

And do the same for the other lines with errors. The compiler is saying that it does not know what AUDIO_DEVICE_OUT_FM_SPEAKER is, so we either need to declare it or get rid of it. To declare it is tricky and would take a little bit of ingenuity and fore thought, as well as a full understanding of what it should be declared as. If we remove it, then that function will not work. E.G., the Audio device out FM speaker. As long as you have the main other speakers defined, then it should work. If the sound then does not work in the finished product, then we can come back and declare it instead.

Sometimes there are other options for something that doesn't exist in your phone model, other times, these items need to be declared from your device tree as either existing or not, and if so, what they are supposed to be declared as. Either way, it was fun to help another developer with their project, and I am sure that they will turn out some great work!

Linux – keep it simple.

​Change the color please!

I often use a different texting app then the one which comes with my custom ROMs that I build. Often, the built in texting application is very bland. However, lately I have been trying to actually use more of the built in programs that come with the ROMs source, to see how well they function on their own, right out of the box.
One of those apps is the messaging app. For as simple as it is, it works surprisingly well. Everything about it just “works”. No bells, no whistles, just real functionality. The only problem with it is the Android green color scheme.

Yuck.

So, I changed it:

All I had to do was open the colors.xml file is the res/values folder, and change the hex coded colors from green to something else. I chose orange, and I call this rendition of orange and white my sherbet theme. After that, I recompiled the app, and, to God be the glory, it changed the colors!

 

Pretty easy, huh? I wonder what other colors I can make it?

Here’s the link if you want to try out the sherbet version: https://www.mediafire.com/download/76w2oy761242y2o

Linux – keep it simple.

Gello and Maven errors while compiling AOKP MM!

Let’s take a look at the problem code:

[CODE]
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:get (default-cli) on project standalone-pom: Couldn’t download artifact: Could not transfer artifact org.cyanogenmod:gello:apk:40 from/to central (https://maven.cyanogenmod.org/artifactory/gello_prebuilds): peer not authenticated
[ERROR] org.cyanogenmod:gello:apk:40
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false),
[ERROR] central (https://maven.cyanogenmod.org/artifactory/gello_prebuilds, releases=true, snapshots=true)
[ERROR] -&gt; [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Export includes file: art/compiler/Android.mk — /home/alaskalinuxuser/compile/build_aokp6/out/target/product/jfltetmo/obj/SHARED_LIBRARIES/libart-compiler_intermediates/export_includes
Export includes file: art/runtime/Android.mk — /home/alaskalinuxuser/compile/build_aokp6/out/target/product/jfltetmo/obj/SHARED_LIBRARIES/libart_intermediates/export_includes
make: *** [/home/alaskalinuxuser/compile/build_aokp6/out/target/common/obj/APPS/Gello_intermediates/org.cyanogenmod.gello-40.apk] Error 1
make: *** Waiting for unfinished jobs….
[/CODE]

Here was a problem that stumped me for quite some time. Mainly because the solutions offered online were the wrong ones. Every Google search I did led me to the same two answers: install maven and update my keys for openJDK-7. The problem with those solutions is that neither one of them were the real problem. At least, not that I know of. I did find a workaround for this issue, but never actually solved it.

The problem: apparently, to save time while compiling, Gello, CM’s new browser, is downloaded via maven rather than actually built on your machine. I am sure that cuts down on the compile time by a minute or two, but probably doesn’t actually save much time. Especially on my slow internet connection.

For some reason, when contacting the maven.cyanogenmod.org repo and trying to download the prebuilt Gello, something goes wrong. The only way to see what went wrong would be to re-run maven with the -e switch to get all of the details.

The workaround:
While working on this, I decided to attack this from a different angle, I decided, rather than solving the problem, to find a workaround. How can I get Gello without using the prebuilts? Well, you can:

export WITH_GELLO_SOURCE=true

And then when you compile, make will attempt to build Gello from the source you have. Except that you probably don’t have the source in your tree, like I found out by trying this. Yes, since you are expected to download the prebuilt, you then don’t download the source. So that would work, if you go and download all of the source.

Or you can just ditch Gello by deleting the Gello folder from the vendor/aokp folder. Then you will not build Gello, or so I though. This does work, provided that your device tree does not specifically call for Gello to be made in your boardconfig file or your device.mk file. Provided those are both true, then you will not get this error.

But, what if you want Gello? Well, you can always download the prebuilt version yourself and add it to your prebuilt folder. Which is the easy way around this mess.

Linux – keep it simple.

Building a kernel for an Android phone without the rom source

For the record, I do not recommend building kernels this way, I recommend that you build them within your ROM source. This method will work, but is far more labor intensive. However, here is how to build the kernel for a Samsung Galaxy Note Edge on Ubuntu 14.04.

Part 1 – The setup:
Go to

[CODE]
$ sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 git make -y
[/CODE]

This will take a while. Then:

[CODE]
$ cd ~
$ mkdir playground
$ cd playground/
$ mkdir toolchain
$ cd toolchain
[/CODE]

Now type this for 4.9:

[CODE]
$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9
[/CODE]

OR this for 4.8, but for this I recommend 4.8.

[CODE]
$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8
[/CODE]

The output either way should look like this:

[CODE]
Cloning into ‘arm-linux-androideabi-4.8’…
remote: Sending approximately 170.26 MiB …
remote: Counting objects: 124, done
remote: Finding sources: 100% (124/124)
………EDITED FOR SPACE………………
Resolving deltas: 100% (652/652), done.
Checking connectivity… done.
[/CODE]

That will take a few minutes. Then:

[CODE]
$ mkdir kernel
$ cd kernel
$ git clone https://github.com/alaskalinuxuser/kernel_samsung_tblte.git
Cloning into ‘kernel_samsung_tblte’…
remote: Counting objects: 49082, done.
remote: Compressing objects: 100% (32/32), done.
………EDITED FOR SPACE………………
Checking connectivity… done.
Checking out files: 100% (46422/46422), done.
[/CODE]

This will take another few minutes, maybe longer, depending on your internet connection.

Part 2 – The kernel modifications

Before going further, this is when you can edit the files of the kernel, add things, remove things from the kernel itself. See the other posts here for how to do that. When you are ready, you can move onto the build.

Part 3 – The build

Open ~/playground/toolchain/kernel/kernel_samsung_tblte/Makefile, and go to line 195, it should say ARCH, edit it as such:

[CODE]
ARCH =arm
CROSS_COMPILE =/home/{YOURUSERNAME}/playground/toolchain/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-
[/CODE]

[CODE]
$ cd ~/playground/toolchain/kernel/kernel_samsung_tblte/
$ make clean
$ make mrproper
[/CODE]

You will likely see an error about TARGET, that is okay, just ignore it.

[CODE]
$ make menuconfig apq8084_sec_defconfig
[/CODE]

OR

[CODE]
$ make menuconfig apq8084_sec_tblte_eur_defconfig
[/CODE]

After some scrolling text, you will see a menu option. Use the arrow keys and the space bar to make selections. Make any changes you want. Remember, not all changes are good. With this setup, you will need to make changes to make this function.

Once you are done, select exit. Then select yes to save your config.

Now that you are back at the command line, all you have to do is type one more command:

[CODE]
$ make
[/CODE]

You will see a lot of scrolling text, like this:

[CODE]
arch/arm/kernel/return_address.c:63:2: warning: #warning “TODO: return_address should use unwind tables” [-Wcpp]
#warning “TODO: return_address should use unwind tables”
^
CC arch/arm/kernel/sched_clock.o
CC arch/arm/kernel/setup.o
CC arch/arm/kernel/signal.o
CC arch/arm/kernel/stacktrace.o
CC arch/arm/kernel/sys_arm.o
CC arch/arm/kernel/time.o
CC arch/arm/kernel/traps.o
CC arch/arm/kernel/atags_parse.o
CC arch/arm/kernel/cpuidle.o
[/CODE]

This is good. Make is making your kernel.
If you are good, or lucky, then it will compile successfully, if not, it will error. Check your changes and use Google to search for errors if you need help. Again, I recommend to build kernels within the backdrop of ROM source, as I mentioned in the other post, it is much, much easier. This method will work, but you may have to add or change a lot of options in your config to make it happen.

Linux – keep it simple.

 

Adding a kernel governor can be a Nightmare!

Okay, so a little play on words, especially since I am adding the Nightmare governor to the tblte (Samsung Galaxy Note Edge) kernel, but it did turn out to be a bit of a problem child, fortunately, it was quickly corrected. As you can see, I did the standard additions, as well as adding the cpufreq_nightmare.c file:

Added to Makefile:

[CODE]
………….EDITED FOR SPACE…………………..
obj-$(CONFIG_CPU_FREQ_GOV_NIGHTMARE) += cpufreq_nightmare.o
………….EDITED FOR SPACE…………………..
[/CODE]

Added to Kconfig:

[CODE]
………….EDITED FOR SPACE…………………..
config CPU_FREQ_DEFAULT_GOV_NIGHTMARE
bool “nightmare”
select CPU_FREQ_GOV_NIGHTMARE
help
Use the CPUFreq governor ‘nightmare’ as default. -WJH
………….EDITED FOR SPACE…………………..
config CPU_FREQ_GOV_NIGHTMARE
tristate “‘nightmare’ cpufreq policy governor”
help
‘nightmare’ – This driver is a modified PegasusQ.

To compile this driver as a module, choose M here: the
module will be called cpufreq_nightmare.

For details, take a look at linux/Documentation/cpu-freq.

If in doubt, say N. -WJH
………….EDITED FOR SPACE…………………..
[/CODE]

Added to cpufreq.h:

[CODE]
………….EDITED FOR SPACE…………………..
#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_NIGHTMARE)
extern struct cpufreq_governor cpufreq_gov_nightmare;
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_nightmare)
………….EDITED FOR SPACE…………………..
[/CODE]

Added to config:

[CODE]
………….EDITED FOR SPACE…………………..
CONFIG_CPU_FREQ_GOV_NIGHTMARE=y
………….EDITED FOR SPACE…………………..
[/CODE]

But, when I ran the compiler, I got this output:

[CODE]
/home/alaskalinuxuser/Documents/projects/phones/compile/build_slim6/kernel/samsung/tblte/drivers/cpufreq/cpufreq_nightmare.c: In function ‘nightmare_check_cpu’:
/home/alaskalinuxuser/Documents/projects/phones/compile/build_slim6/kernel/samsung/tblte/drivers/cpufreq/cpufreq_nightmare.c:540:2: error: implicit declaration of function ‘cpufreq_notify_utilization’ [-Werror=implicit-function-declaration]
cpufreq_notify_utilization(policy, max_load);
[/CODE]

So I edited that line out in build_slim6/kernel/samsung/tblte/drivers/cpufreq/cpufreq_nightmare.c:

[CODE]
// WJH cpufreq_notify_utilization(policy, max_load);
[/CODE]

And viola! By God’s grace it even worked! That usually doesn’t get fixed so easily, so I guess that wasn’t so bad.

Linux – keep it simple.

 

Insert an explicit cast to silence issue…

In the continuing saga of compiling AOSP 7 for the Samsung Galaxy S4, T-Mobile variant (SGH-M919, JFLTETMO) I ran into an interesting problem. While this used to be a non-issue for building Marshmallow and earlier, libcopybit seems to now have a problem in Nougat. Let’s take a look:

[CODE]
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1390:40: note: insert an explicit cast to silence this issue
struct copybit_rect_t dr = { 0, 0, dst->w, dst->h };
^~~~~~
static_cast<int>( )
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1390:48: error: non-constant-expression cannot be narrowed from type ‘uint32_t’ (aka ‘unsigned int’) to ‘int’ in initializer list [-Wc++11-narrowing]
struct copybit_rect_t dr = { 0, 0, dst->w, dst->h };
^~~~~~
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1390:48: note: insert an explicit cast to silence this issue
struct copybit_rect_t dr = { 0, 0, dst->w, dst->h };
^~~~~~
static_cast<int>( )
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1391:40: error: non-constant-expression cannot be narrowed from type ‘uint32_t’ (aka ‘unsigned int’) to ‘int’ in initializer list [-Wc++11-narrowing]
struct copybit_rect_t sr = { 0, 0, src->w, src->h };
^~~~~~
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1391:40: note: insert an explicit cast to silence this issue
struct copybit_rect_t sr = { 0, 0, src->w, src->h };
^~~~~~
static_cast<int>( )
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1391:48: error: non-constant-expression cannot be narrowed from type ‘uint32_t’ (aka ‘unsigned int’) to ‘int’ in initializer list [-Wc++11-narrowing]
struct copybit_rect_t sr = { 0, 0, src->w, src->h };
^~~~~~
hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp:1391:48: note: insert an explicit cast to silence this issue
struct copybit_rect_t sr = { 0, 0, src->w, src->h };
^~~~~~
static_cast<int>( )
4 errors generated.
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
[/CODE]

So, I changed hardware/qcom/display/msm8960/libcopybit/copybit_c2d.cpp from this:

[CODE]
struct copybit_rect_t dr = { 0, 0, dst->w, dst->h };
struct copybit_rect_t sr = { 0, 0, src->w, src->h };
[/CODE]

To this:

[CODE]
struct copybit_rect_t dr = { 0, 0, (int)dst->w, (int)dst->h };
struct copybit_rect_t sr = { 0, 0, (int)src->w, (int)src->h };
[/CODE]

And it compiled sucessfully. Unfortunately, I don’t know how well that fixed the problem (or, if at all), since the AOSP 7 will currently not boot on my S4. But I’ll keep at it!

Linux – keep it simple.

Device configurations are no longer allowed to change the global flags… error bailing…

Sometimes Android does stuff that is probably a good idea, but is really annoying to the compiler. By compiler, I mean guys or gals like you and I who really want to compile AOSP 7.0, but can’t because all of our old device trees have cflags set. Without warning, AOSP institues the ninja build system, and then declares all cflags to be illegal. Bummer.

Bummer that is, unless we disable the bailout.

Open up ./build/core/config.mk, and scroll down to line 630, where you should see the below.

[CODE]
# ###############################################################
# Set up final options.
# ###############################################################

ifneq ($(COMMON_GLOBAL_CFLAGS)$(COMMON_GLOBAL_CPPFLAGS),)
$(warning COMMON_GLOBAL_C(PP)FLAGS changed)
$(info *** Device configurations are no longer allowed to change the global flags.)
$(info *** COMMON_GLOBAL_CFLAGS: $(COMMON_GLOBAL_CFLAGS))
$(info *** COMMON_GLOBAL_CPPFLAGS: $(COMMON_GLOBAL_CPPFLAGS))
$(error bailing…)
endif
[/CODE]

Which I changed to this:

[CODE]
# ###############################################################
# Set up final options.
# ###############################################################
#I disagree with your cflags policy. So there. (Go ahead and tell AOSP how you really feel.)
#ifneq ($(COMMON_GLOBAL_CFLAGS)$(COMMON_GLOBAL_CPPFLAGS),)
#$(warning COMMON_GLOBAL_C(PP)FLAGS changed)
#$(info *** Device configurations are no longer allowed to change the global flags.)
#$(info *** COMMON_GLOBAL_CFLAGS: $(COMMON_GLOBAL_CFLAGS))
#$(info *** COMMON_GLOBAL_CPPFLAGS: $(COMMON_GLOBAL_CPPFLAGS))
#$(error bailing…)
#endif
[/CODE]

Problem solved. you may now use your good ol’ cflags. Carry on.

Linux – keep it simple.