How to cross-compile Android emulator for Windows on Linux using existing AOSP source tree - android-emulator

I have AOSP sources checked out on a Linux system using the repo command as follows:
repo init -u https://android.googlesource.com/platform/manifest -b android-9.0.0_r30
I've successfully cross-compiled the SDK for Windows but I am having trouble with compilation of the emulator. The prebuilt packages in prebuilts/android-emulator/ are available only for linux and darwin platforms. I tried to add the needed repo by adding the following line to .repo/default.xml:
<project path="external/qemu-android" name="platform/external/qemu-android" groups="pdk" />
but repo sync responded with error:
fatal: couldn't find remote ref refs/tags/android-9.0.0_r30
which is understandable, because this tag indeed doesn't exist. In conclusion, I'd like to have the newest awailable emulator (from master) built for Windows, but without the need for creation of the whole new AOSP source tree (I don't have that much space).

Related

Compiling OpenSC on Windows

Context:
I am following the guide for the open source project OpenSC https://github.com/OpenSC/OpenSC to compile the solution on Windows and get the opensc-pkcs11.dll module to use it for communications (such as OpenSSH) with HSM's via PKCS#11 standard. Currently I am using the latest stable release 0.21.0 (msi installer) and it works perfectly. However when I use https://github.com/OpenSC/OpenSC/wiki/Compiling-on-Windows guide to compile the solution using Visual Studio Developer Command Prompt I can successfully build the libraries however the opensc-pkcs11.dll always returns pkcs11: 0x5: CKR_GENERAL_ERROR when I try to use it and I am not sure what am I missing here.
Setup:
git clone https://github.com/OpenSC/OpenSC.git
git checkout 30180986a08cf71fe4af4b50251a8bb5b1ab95af (0.21.0 commit for the right version)
Manually Creating Built Source Files
nmake /f Makefile.mak
Building it for x64, with x64 Native Tools Command Prompt for VS 2019.
That should be it according to the guidelines as I do not need openpace/openssl/zlib to compile the opensc-pkcs11 as far as I understand.
Problem summary:
If I download from releases https://github.com/OpenSC/OpenSC/releases version OpenSC-0.21.0 the compiled opensc-pkcs11.dll works as expected
If I compile it from source code based on v0.21.0 commit I get 0x5: CKR_GENERAL_ERROR when trying to use the library for e.g. OpenSSH, tested that this happens for other/previous commits as well, there for I suspect that I am missing something here.
Has anyone experienced the same issue? Maybe there is some build config anyone could share so I can understand what am I missing here?

Error when building flutter app for Linux snap package using snapcraft - CMake step failing

This question has been asked here and (erroneously) closed as a duplicate with a link to an old CMAKE question. Probably the closing person did not read the question properly. This has nothing to do with plain CMake configuration, unless you want to configure the CMake use in snapcraft source code.
Error when building flutter app for Linux snap package using snapcraft
The fact is that running snapcraft fails. Running it with --debug gives you a root console of the snapcraft / multipass filesystem, whoami says root, but you only see the snap things around (for instance, not your home). Anyways, the error says
CMake Error: The current CMakeCache.txt directory /root/parts/xxxxx/build/build/linux/release/CMakeCache.txt is different than the directory
/home/zolal/flutterapps/xxxxx/build/linux/release where CMakeCache.txt was created. This may result in binaries being created in the wrong
place. If you are not sure, reedit the CMakeCache.txt
(naturally, you cannot reedit the CMAKECache.txt, because this is created by snapcraft)
It seems that the cmake build starts outside of the snapcraft / multipass VM, and than moves to the multipass VM resulting in CMake error. Because the original question was asked a while ago, obviously this still does not work. Did anyone solve this problem alredy?
Update, purged multipass and tried with lxd:
snapcraft --use-lxd
Launching a container.
Waiting for container to be ready
Waiting for network to be ready...
snap "snapd" has no updates available
The flutter plugin is currently in beta, its API may break. Use at your own risk.
snapd is not logged in, snap install commands will use sudo
snap "core18" has no updates available
Skipping pull flutter-extension (already ran)
Skipping pull geraspine-outcome-pc (already ran)
Skipping pull gnome-3-28-extension (already ran)
Skipping build flutter-extension (already ran)
Building geraspine-outcome-pc
flutter pub get
Woah! You appear to be trying to run flutter as root.
We strongly recommend running the flutter tool without superuser privileges.
/
📎
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Failed to run 'flutter pub get' for 'geraspine-outcome-pc': Exited with code 1.
Verify that the part is using the correct parameters and try again.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
Naturally, the pubspec.yaml is there, but the files are obviously not transferred to the VM.
The solution is to execute following command inside your flutter project root folder (where the build, lib, snap, etc. folders are contained):
snapcraft clean <project-name>
This deletes the build cache inside "/root/parts/>project-name>" folder.
Should that not be enough, you can clean the whole snapcraft parts folder with
snapcraft clean
but this includes all dependencies. This means that all dependencies must be downloaded again the next time you compile your project.
Then delete the whole folder of your_part_name under parts folder
This doesn't work because the "parts" folder is inside "/root" dir and we cannot access or delete the stuff inside manually.
But it would be nice if we can change the parts folder e.g. into our /home dir. But I haven't found any possibilities yet !
If you got any error when building this, just run snapcraft build --debug
Then delete the whole folder of your_part_name under parts folder
Delete build directory and build again.
src github-issue
For me it was important to delete the build directory in my local directory also:
rm -rf build && snapcraft clean <project> && snapcraft

Android AOSP make kernel menuconfig

What is kernel 'make menuconfig' in android AOSP
I tried make kernel from AOSP. it could build kernel only.
But how about if I want to customize kernel config from menuconfig
Regards
Peter
There's a config.sh script for menuconfig in android kernel source.
Here's the step:
download android kernel source code
repo init -u https://android.googlesource.com/kernel/manifest -b BRANCH
repo sync
run menuconfig
BUILD_CONFIG=common/build.config.gki.aarch64 build/config.sh menuconfig
modify menuconfigs and save .config
build kernel
BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
Reference: https://source.android.com/docs/setup/build/building-kernels
Building Android kernels for various devices is documented on source.android.com. It covers the Android Common Kernels as well as some widely used devices that can be built directly from AOSP. While there are no specific instructions for make menuconfig, it contains a section on how to customize the kernel build with specific kernel configuration options.
Such kernel options can of course be discovered through make menuconfig as usual.

-sh /usr/local/sbin/wpa_supplicant no such file or directory

I have built the TI wilink utilities which then I have integrated in my rootfs. This done using petalinux 2016.4 and have created a install template app in yocto build to copy all the tools and libraries in the rootfs.
When I bring up the BOOT.bin and image.ub, I see the files and libraries but when I try to run for example wpa_supplicant it does not work
even wpa_supplicant -h wont work.
It shows me error:
-sh: /usr/local/sbin/wpa_supplicant: no such file or directory.
The file is present and also has executable permissions.
Do you have any idea why it is not able to run ?
Thanks
Typically, this means that executable file is built for the wrong architecture, i.e. there is a mismatch between the environment where are you running and environment for which you are building. This is how you can make sure they do match or not (execute on target):
# file /usr/local/sbin/wpa_supplicant
...
# uname -m
...
If you see mismatch, then it all boils down to how are you building TI wilink.

How do I get debugging to work after building VS Code from source?

I built VS Code from source following the guide How to Contribute. It seems to build fine and launches in Electron.
Problem:
When I try to build vscode-samples, both with the included JavaScript and TypeScript versions (I ran npm install on each first), I'm not able to enter debug mode with F5. It says "Error: No extension installed for 'node' debugging."
Also...
I tried running and debugging an extension I had previously worked on for VS Code (I'm able to do this on the distribution available on http://code.visualstudio.com.
However, I'm getting a similar error:"No extension installed for 'extensionHost' debugging."
Any help would be greatly appreciated. Thanks!
The Dev build version that you are running does not include the node-debugger extension required for debugging node apps.
Lots of VSCode functionality are implemented as extensions, when the product is shipped those extensions are bundled into the released version.
if you need to run the node debugger extension within the build version, you need to add the extension to the OSS build extensions folder, to do that:
cd ~/.vscode-oss-dev/extensions/
git clone https://github.com/Microsoft/vscode-node-debug && cd vscode-node-debug
npm install && gulp build
This will pull the node extensions to dev build extension folder, then will build the extension. Next time you run, the dev build will load this extension, you will be able to do node debugging.