We have been facing issues with booting android 5.0 to GUI in our simulation environment.
We have been able to successfully boot it on QEMU with our kernel image and rootfs.
In our sw only environment there is an issue of rootfs not able to go higher than 400 MB so by removing some of the unneeded stuff we have brought it down to 400mb
In our environment we pack system.img , userdata.img and cache.img into one package and provide it as rootfs. kernel and ramdisk are provided as is.
We were able to boot kitkat on the above simulation environment.
I am going to attach log below. What we see is lot of binder transation failures after surface flinger is loaded. We can see android logo but no gui after that.
What we are suspecting is the following either issue with selinux(we have set se linux to permissive in kernel command line.) or issue with recognising userdata.img and cache.img by init.
Any pointers to the potential issue here would be really helpful. I am new to android booting mechanisms although i have surpassable knowledge of driver development.
Attaching a link to the logs: https://www.dropbox.com/scl/fi/im33ikwo6zvjobw70zl46/fsim_swonly.log?dl=0&oref=e&r=AAUTkq0XmQwwdsnOGAUqodCFdVHzt-2ejEstlhF40PWkNA4tjglBxO-WCtWxdRJK4GjXXemYenvq9_m9BtkEPLsDDvtw1r7qjRGDTlor5NU0EvLorixw6NgytVfYJa7FfBBpXU574_QnbbNRdjhFcM9NZRcYO0fCYmbuPllHKBbrzS8yFJWoKk3A_2D27BSXpco&sm=1
Related
I am trying to run Docker on Android, using a Pixel 3a XL rooted, running stock rom but flashed a custom kernel. I need to enable cpu, cpuset, memory, io, and pid controllers in cgroupv2. After enabling them in menuconfig and flashing the kernel, the script used to check shows only pid available under cgroupv2 controllers.
What do I need to do besides enabling these options in the kernel’s menuconfig? Did I maybe not enable all the necessary options?
If I run
cat /sys/fs/cgroup/cgroup.controllers
it only returns "pids".
With the current state, when I run docker I get a warning for each item,
WARN: Unable to find cpu controller”
and
error setting cgroup config for procHooks process: bpf_prog_query(BPF_CGROUP_DEVICE)
As I understand it, these options may be mounted with cgroupv1 and this is why they do not show up?
I am using this guide: https://gist.github.com/FreddieOliveira/efe850df7ff3951cb62d74bd770dce27
and these are the options I enabled in my kernel using menuconfig: https://wiki.gentoo.org/wiki/Docker
From the config I flashed in my kernel:
CONFIG_CGROUPS=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CPUSETS=y
CONFIG_CGROUP_CPUACCT=y
I flash the kernel by flashing the Image.lz4-dtb file that is created after building the kernel.
Here is a photo after running the script to check if kernel options are all enabled. Am trying to change these from missing to available/enabled.
photo
The solution was to run: sudo mount -t tmpfs cgroup_root /sys/fs/cgroup which created directories for each of the cgroup resources and allowed Docker to run.
Useful is section 2.1:
https://android.googlesource.com/kernel/common/+/android-trusty-3.10/Documentation/cgroups/cgroups.txt
I recently changed my computer and took the opportunity to move from Mageia to Fedora. But I can't do any Android development anymore because, as stated in the title, starting any AVD makes the whole system to freeze (screen, mouse and keybord) if the AVD can't connect to adb daemon. The only thing I can do is hard shutdown.
The problem here is adb daemon is always started when I try to launch an AVD as the service is enabled by default, so that shouldn't happen.
What I've been able to collect so far is a few logs in a file by lauching the emulator from command-line. All it says before freezing is:
emulator: INFO: GrpcServices.cpp:301: Started GRPC server at 127.0.0.1:8554, security: Local
emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037
But, if I manually restart the adb service just before lauching the AVD, I don't experience the freeze. Instead, I get the following errors before the AVD crashes:
cannot add library .../android-sdk-linux/emulator/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed
added library .../android-sdk-linux/emulator/lib64/vulkan/libvulkan.so
cannot add library .../android-sdk-linux/emulator/lib64/vulkan/libvulkan.so.1: full
My best guess here is there's something bad going on with the graphic card. Something I am seemingly the only one to exprerience as I couldn't find any relevant result on internet. I must mention here that I've already tried to run several AVDs in multiple API versions, both software and hardware rendered graphics and I always get the same result.
My system configuration is
AMD Ryzen 9
Nvidia GeForce RTX 2070 using the Nouveau drivers
kernel 5.11.
If anyone ever stumbles upon this question facing the same issue than me, that was solved by getting rid of the Nouveau drivers and using Nvidia's proprietary drivers. A handful of other disturbing bugs on my computer were solved by doing just that.
I really don't understand why some Linux distribution still strongly advise to use the Nouveau drivers over Nvidia'as when they have a such a really poor support of the GPUs...
I am a newbie student.
I am trying to run a Raspberry Pi Emulator on QEMU.
PC specs are Intel q8200, quad-core 2,4 GHz, Nvidia GeForce 1 GB. 4GB RAM
https://prnt.sc/uvpi0h
The above image is where you can see the commands and the state of the running QEMU. And other things.
https://prnt.sc/uvplco
This is in my download folder for this project.
I've tried to run different kernels (stretch and booster), even different Pi Emulator images, but the same mistake.
I've seen that in some solutions, a guy said that he hadn't included his BIOS in commands and that helped him, but I dunno how to include or specify BIOS in CMP.
All files inside the Qemu folder (images and kernel) are matching the start.bat commands folder, so that is all ok.
I've tried to do all of that through this channel instructions, but since it is outdated, I've just downloaded the latest software.
https://www.youtube.com/watch?v=xiQX0YXYuqU&t=138s&ab_channel=TechWizTime
What could be the solution and what is the problem?
Thanks in advance!
EDIT: Windows10 pro is the OS
UPDATE 1: Added this command: -boot no -display gtk,gl=of
still the same.
UPDATE 2:
qemu-system-arm -kernel kernel-qemu-4.4.12-jessie -cpu arm1176 -m 256 -M versatilepb \
-no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" \
-redir tcp:5022::22 \
-hda 2016-05-27-raspbian-jessie-lite.img
I've used this to solve the problem. Although it is another version of the Raspberry Pi, for my needs it is not relevant now.
The important error message in the output is the one from the guest kernel which reads:
Error: unrecognized/unsupported machine ID (r1 = 0x00000183)
and then lists the machine types it is capable of booting on. (As a side note, providing error messages as screenshot images is rather awkward -- copying the text itself into the question makes it searchable and copyable.)
It looks like you're trying to boot a guest kernel which requires a device tree, but you haven't passed it a device tree. You need to give QEMU also a -dtb option whose argument is the correct dtb for this kernel and for the machine type ('versatilepb') that you are running it on.
I am trying to learn the kernel customization and for this I have target OnePlus 6T device. I am able to compile the kernel source code on my Ubuntu 18 with the following steps:
Download latest dtc from https://packages.ubuntu.com/cosmic/a...piler/download and install it.
Clone kernel source code: git clone https://github.com/OnePlusOSS/androi...lus_sdm845.git
Clone ToolChain: git clone -b linaro-4.9-arm-linux-androideabi https://github.com/ArchiDroid/Toolchain prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-linaro-4.8
Open terminal at prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-linaro-4.9 and run: export CROSS_COMPILE=$(pwd)/bin/aarch64-linux-android-
Navigate to kernel source code path in the same terminal.
export ARCH=arm64 && export SUBARCH=arm64
make clean
make mrproper
mkdir Out
make O=Out sdm845_defconfig
make O=Out DTC_EXT=dtc CONFIG_BUILD_ARM64_DT_OVERLAY=y DTC_EXT=dtc -j4
Following are the last lines of compilation:
CC drivers/media/platform/msm/broadcast/tspp.mod.o
CC drivers/media/platform/msm/dvb/adapter/mpq-adapter.mod.o
CC drivers/media/platform/msm/dvb/demux/mpq-dmx-hw-plugin.mod.o
GZIP arch/arm64/boot/Image.gz
CC drivers/soc/qcom/llcc_perfmon.mod.o
CC drivers/video/backlight/lcd.mod.o
CC net/bridge/br_netfilter.mod.o
LD [M] drivers/char/rdbg.ko
LD [M] drivers/media/platform/msm/broadcast/tspp.ko
LD [M] drivers/media/platform/msm/dvb/adapter/mpq-adapter.ko
LD [M] drivers/media/platform/msm/dvb/demux/mpq-dmx-hw-plugin.ko
LD [M] drivers/soc/qcom/llcc_perfmon.ko
LD [M] drivers/video/backlight/lcd.ko
LD [M] net/bridge/br_netfilter.ko
CAT arch/arm64/boot/Image.gz-dtb
make[1]: Leaving directory '/home/.../KernelCustomization/android_kernel_oneplus_sdm845/Out'
Now, the next step is to flash the image. I have rooted OnePlus 6T device and I am confused with the three image files generated after successful compilation i.e.
arch/arm64/boot/Image.gz-dtb
arch/arm64/boot/Image.gz
arch/arm64/boot/Image
I need a favour in:
What image can I use to flash on android device?
Is booting a image with TWRP is enough to flash kernel?
Found Google documentation
https://source.android.com/devices/bootloader/partitions-images
As per following lines from google documentation:
boot: The boot partition contains a kernel image and a RAM disk combined via mkbootimg. In order to flash the kernel directly without flashing a new boot partition, a virtual partition can be used:
kernel: The virtual kernel partition overwrites only the kernel (zImage, zImage-dtb, Image.gz-dtb) by writing the new image over the old one. To do this, it determines the start location of the existing kernel image in eMMC and copies to that location, keeping in mind that the new kernel image may be larger than the existing one. The bootloader can either make space by moving any data following it or abandoning the operation with an error. If the development kernel supplied is incompatible, you may need to update the dtb partition if present, or vendor or system partition with associated kernel modules.
I think I have to use arch/arm64/boot/Image.gz-dtb for flashing the kernel. My understanding is that Image.gz-dtb is a virtual image that can be used to flash only kernel on android.
Still, I am not able to figure out the correct step to flash it. I am wondering if I will do something wrong then I will break my device so I want to be sure before flashing that it will work.
Any help or guidance will be very helpful at this moment.
I found the steps that are needed to flash the custom kernel on android device i.e.
First we need to get the boot image of stock firmware we can get it by running following commands:
adb shell "ls -la /dev/block/platform/soc/1d84000.ufshc/by-name/" > MoreInfo\msm_partitions.txt
Note the boot partition name e.g. boot_a -> /dev/block/sde11 boot_b -> /dev/block/sde39
Missing steps to make boot.img with command dd command.
Download the latest Android Image Kitchen from this thread.
Run the following with the boot image: unpackimg.sh .img
Locate the zImage file and replace it with your kernel image (rename it to what came out of the boot image)
Run the following to repack: repackimg.sh
Flash the new boot image with fastboot or TWRP!
I need some more information on the missing steps. Actually the process written above is working on devices that has only one boot partition. Does any one know how can I flash my single kernel image on a device that has a/b partitioning?
Update:
I searched over the internet for A/B partitioning and I found that these are used for seamless updates i.e. One partition is active at a time and another partition which is inactive can be used to flash the update. On reboot, another partition will become active and One partition will become inactive. More Info: https://www.xda-developers.com/how-a...opment-on-xda/
If my understanding is true then I just need to follow following steps to find the correct image to be used at the first step of flashing the kernel:
fastboot getvar all | grep “current-slot”
dd if="path to boot of active slot" of=/sdcard/boot.img
Continue with boot.img and flash the kernel with above written steps for flashing a kernel.
Anyone who has this knowledge, please confirm. I will be very thankful to you.
A/B OTA update
Firstly, you need to confirm whether your phone is A/B OTA update or not by following command
fastboot getvar slot-count
If the command returns '2', then your phone supports A/B OTA update which means you have two boot
partitions 'boot_a' and 'boot_b', otherwise, there should only be one partition 'boot'
boot image
The images you built (Image.gz-dtb) are just kernel images with device tree. They
are not enough for flashing to boot partition since there should be ramdisk and boot arguments combined.
The ramdisk content contains normal boot binaries for non-A/B OTA system or recovery binaries for
A/B OTA system. You need to find official ramdisk images and combine with your kernel image. Normally
mkbootimg will be used to create boot image in AOSP android.
Flashing
fastboot flash boot boot.img
This works on both A/B and non-A/B system since image will be flashed to default active partition (boot_a
is by default if you do not have OTA or using 'fastboot set_active' to change it)
On A/B system, you can also use 'fastboot getvar current-slot' to get active slot and specific flash
partition 'fastboot flash boot_a boot.img' or 'fastboot flash boot_b boot.img'
XDA provides scripts to flash kernel images (Image.gz-dtb) with following steps:
a. Dump boot.img from your phone
b. Extract ramdisk.img from boot.img
c. Combine Image.gz-dtb with ramdisk.img to new boot.img
d. Flash new boot.img to boot partition
https://forum.xda-developers.com/oneplus-6t/development/kernel-holydragon-t3878107
provides customized kernel and flash scripts, you should check and find your suitable way to flash your kernel image.
Is it possible to mount a ramdisk in Android before the Android framework starts, but after the underlying Linux kernel has started? If so, what commands should I use?
Thanks!
Based on some reference books I read, an Android system starts up in following main steps:
CPU reads a hard-coded address which usually points to some bootloader program
The bootloader initializes the RAM, puts basic hardware in a quiescent state, loads the the kernel and RAM disk, and jumps to the kernel.
start_kernel() initializes subsystems and proceeds to call the init function of built-in drivers.
The kernel mount its root system (from ramdisk.img).
init.rc is then called to set up the environment variables such as system path, mount other filesystems, start native daemons and so on.
Now, to answer your question: "Is it possible to mount a ramdisk in Android before the Android framework starts, but after the underlying Linux kernel has started?"
-- I think this is exactly what android did.
You have to write shell script which you invoke from init.rc files. Another approach could be write a C program which gets launched from init.rc as daemon.
The init is the middle place where linux has booted almost while android frameowrk is about to begin booting.