Where is the kernel config in AOSP Android 10? - linux-kernel

I've found various kernel configs in kernel/configs/q.
When I alter them, and run mm in kernel/msm-4.14 the kernel is not rebuilt.
Where do I edit the kernel config, such that a kernel rebuild is forced when mm is run?

The kernel is built separately from the Android platform first. Then the Android platform build system is pointed at where the kernel image is located, using the TARGET_PREBUILT_KERNEL environment variable.
Here is an outline of how I usually configure and build. I have done it this way for both Android 9 and 10, for various vendors. The scheme I use is mentioned in the docs here. Non-Google kernels usually don't come with version control (repo), I don't know what you're dealing with so I'll cover both.
Configuring the kernel
For repo-checkout kernels, you do the config in build/build.config. Basically, after defconfig was taken as basis, you use the ${KERNEL_DIR}/scripts/config tool to alter the config. This usually looks as follows:
POST_DEFCONFIG_CMDS="check_defconfig && update_config"
function update_config() {
${KERNEL_DIR}/scripts/config --file ${OUT_DIR}/.config \
-d CONFIG_SOMETHING_I_DISABLE \
-e CONFIG_SOMETHING_I_ENABLE \
--set-val CONFIG_FOO = 123
}
If you don't have a repo-checkout kernel, locations and details may differ but the basic idea is usually the same: Find/Create the script that kicks of the build, and add invocations of the config tool after making defconfig.
Run the config tool by its own to see full options and more info on its usage, but the above is usually all you need. Beware: If you make syntactically-correct invalid changes (e.g. enable symbols of which the dependencies are not met), the build system will NOT complain and ignore these changes silently. If you face this situation, e.g. use menuconfig to find out what's wrong, as it shows dependencies.
Building AOSP / Making boot.img
After you've built your kernel, you will have Image.lz4 in out/.../dist (or Image.gz in out/.../private/msm-google/arch/arm64/boot). You go to your Android source, and in addition to the usual things (source build/envsetup.sh, lunch) you point the build system at the image you built, e.g. export TARGET_PREBUILT_KERNEL=/path/to/Image.lz4. Then just start the build normally, e.g. make bootimage or m droid.
Note that for Android 10 at least in some cases, you'll have to copy over the kernel modules from out/.../dist too, since the new kernel can't load the old ones. With this part, I am having problems myself at the moment. I think they have to be copied to device/VENDOR/DEVICE (e.g. google/coral-kernel), you may also copy your kernel image there btw, since the original prebuilt one also is there by default. The problem is that at least in my case, the new kernel modules were not copied to device after all.

Related

Yocto / Bitbake: How to do something with every binary build by the system?

Use Case:
I am developing a IoT Linux system for my Raspberry Pi. Read Only rootfs is not an option, because I want to upgrade executables on the fly. What I thought is my solution: I develop a tool which can sign ELF-Files (Linux executables and libraries). It signes the sections with some pub/priv key, saves the signature into a section and checks the file before executing it (like DigSig but with the help of openssl-lib). The library loader(glibc) is also modified to check all linux ".so"-libraries before loading it. At the end I want to publish the project and my solution under an open source license. Currently it is not finish and far away from stability.
Develoment state:
ELF-File Sign tool is finished.
Kernel is modified (new security module / own syscall function to check elf-binary signature).
Glibc is modified and patched for my local source.
Quemu is patched to support my new syscall.
Yocto environment is set up. And the image runs on my RaspberryPi 2 test machine.
So far so good. I have the feeling I am very close to my solution.
Now I need to:
Make Yocto / bitbake enable that ALL ELF-Files are signed after the build process. Best would be if the rpm-files have already the signed ELF-files included. And the signing process would be done by one recipe for all the other packages. (So I do not want to create a post installation script which modifies only the files on the root folder).
After searching hours in google and checking the documentation of yocto I have no solution. It would be very great if someone can help me.
I think you can customize package.bbclass in poky/meta/classes, in particular, split_and_strip_files function helps to strip every files
oe.utils.multiprocess_exec(sfiles, oe.package.runstrip)
You can add signing then add your custom tools in poky/meta/lib/oe/package.py

buildroot does not regard config changes

Im playing around with buildroot together with linaro 2016.11 for arm.
Im actually building the latest Linux Kernel for the i.MX6 Processors.
So far so good.
I have setup the buildroot config with
$ make makeconfig
I have configured an external toolchain (the linaro one). I also configured the uboot to be built. In the uboot section, i had to choose the appropriate board name for the defconfig.
Now the problem:
I have done a full make which was successfull without any errors.
After that, i have changed the uboot board name to something which does not exist in the source. Just to make sure everything is working correct.
i have restartet the build process with
$ make uboot-rebuild
to my confusion, the build was sucessfull. After a deeper look to the shell commands, i saw, that the new config was just ignored. I have tried everything without success. It only rebuilds correctly after i do a
$make clean
$make
but this will build the whole thing again and it takes a lot of time.
I hope someone could help me with that and give me some hint.
Thanks.
make <pkg>-rebuild rebuilds the package without applying a new configuration, so what happens is correct.
After changing the U-Boot configuration you have to run make uboot-reconfigure. This command first applies the configuration, then it does the same actions as uboot-rebuild.
See also the Buildroot manual, section Understanding how to rebuild packages.

To produce a pure statically linked binary, is it still necessary to compile with -tags netgo in Go 1.5+?

I'm trying to create a pure statically linked binary to run in a minimal Docker container. Prior to Go 1.5, I was building them like this:
go build -a -tags netgo -installsuffix netgo myfile.go
I understand that C has been stripped out of the Go compiler in version 1.5. Is it still necessary to build with -tags and -installsuffix?
https://golang.org/doc/go1.5#net
The DNS resolver in the net package has almost always used cgo to
access the system interface. A change in Go 1.5 means that on most
Unix systems DNS resolution will no longer require cgo, which
simplifies execution on those platforms. Now, if the system's
networking configuration permits, the native Go resolver will suffice.
The important effect of this change is that each DNS resolution
occupies a goroutine rather than a thread, so a program with multiple
outstanding DNS requests will consume fewer operating system
resources.
The decision of how to run the resolver applies at run time, not build
time. The netgo build tag that has been used to enforce the use of the
Go resolver is no longer necessary, although it still works. A new
netcgo build tag forces the use of the cgo resolver at build time. To
force cgo resolution at run time set GODEBUG=netdns=cgo in the
environment. More debug options are documented here.
This change applies to Unix systems only. Windows, Mac OS X, and Plan
9 systems behave as before.
So no.

How to install and use open source library on Windows?

I'd like to use open source library on Windows. (ex:Aquila, following http://aquila-dsp.org/articles/iteration-over-wave-file-data-revisited/) But I can't understand anything about "Build System"... Everyone just say like, "Unzip the tar, do configure, make, make file" at Linux, but I want to use them for Windows. There are some several questions.
i) Why do I have to "Install" for just source code? Why can't I use these header files by copying them to the working directory and throw #include ".\aquila\global.h" ??
ii) What are Configuration and Make/Make Install? I can't understand them. I just know that configuration open source with Windows need "CMake", and it is configuration tool... But what it actually does??
iii) Though I've done : cmake, mingw32-make, mingw32-make install... My compiler said "undefined references to ...". What this means and what should I do with them?
You don't need to install for sources. You do need to install for the libraries that get built from that source code and that your code is going to use.
configure is the standard name for the script that does build configuration for the software about to be built. The usual way it is run (and how you will see it mentioned) is ./configure.
make is a build management tool (as the tag here on SO will tell you). One of the most common mechanisms for building code on linux (etc.) is to use the autotools suite which uses the aforementioned configure script to generate build configuration information for use by generated makefiles which make then uses to build the software. make is also the way to run the default build target defined in a makefile (which is often the all target and which usually builds the appropriate library/binary/etc.).
make install is a specific, secondary, invocation of the make tool on the install target which (generally) installs the (in this case previously) built code into an appropriate location (in the autotools/configure universe the default location is generally under /usr/local).
cmake is, again as the SO tag says, a build system that generates configuration files for other build tools (make, VS, etc.). This allows the developers to create the build configuration once and build on multiple platforms/etc. (at least in theory).
If running cmake worked correctly then it should have generated the correct information for whatever target system you told it to use (make or VS or whatever). Assuming that was make that should have allowed mingw32-make to build the software correctly (assuming additionally that mingw32-make is not a distinct cmake target than make). If that is not working correctly then something is still missing from your system (and cmake probably should have caught that).
But to give any more detail you will need to give more detail about what errors you are actually getting and from what command.
(Oh, and on Windows, and especially if you plan on building your software with VS (or some other non-mingw32-make tool) the chances of you needing to run mingw32-make install are incredibly small).
For Windows use cmake or latest ninja.
The process is not simple or straight, but achievable. You need to write CMake configuration.
Building process is not simple and straight, that's why there exists language like Java(that's another thing though)
Rely on CMake build the library, and you will get the Open-Source library for Windows.
You can distribute this as library for Windows systems, distribute and integrate with your own software, include the Open Source library, in either cases, you would have to build it for Windows.
Writing CMake helps, it would be helpful to build for other platforms as well.
Now Question comes: Is there any other way except CMake for Windows Build
Would you love the flavor of writing directly Assembly?
If obviously answer is no, you would have to write CMake and generate sln for MSVC and other compilers.
Just fix some of the errors comes, read the FAQ, Documentation before building an Open Source library. And fix the errors as they lurk through.
It is like handling burning iron, but it pays if you're working on something meaningful. Most of the server libraries are Open Source(e.g. age old Apache httpd). So, think before what you're doing.
There are also not many useful Open Source libraries which you could use in your project, but it's the way to Use the Open Source libraries.

How can i set what version of a product I'm in Eclipse?

I've created, debugged, and revised a project that I've been working on, but now I want to be able to specify what version of the binary I'm on. I'm using Eclispe-CDT with MinGW to make this project on my local system, so there is no versioning software involved. Does anyone know how to specify this for both Windows and Linux platforms?
On Windows, the idea is to produce a COFF file with the relevant information.
That is done by adding a step to the build, using windres (found also here).
See this thread as an example.
you could add windres via the project properties/Builders as an additional builder and add the generated object file in the C/C++ Build/GCC C++ Linker/Miscellaneous/Other Objects.
Then you
- a) could do a clean build if the resource is changed or
- b) could change the build options (if you have patience) to change to do a clean build every time you save the project.
On Unix, this doesn't seem to be supported in a similar fashion.

Resources