My (custom-made) kernel fails to boot from bootloader menu but works from fastboot - E 2015 Q&A, Help & Troubleshooting

Hi everyone,
I have recently been trying to port Ubuntu Touch to our beloved surnia.
I'm using the phablet-5.1 tree with AOSP-5.1 device, vendor, kernel and other repositories.
I managed to finish the build with the kernel config adapted to work with Ubuntu. (using jamino's phablet-porting-scripts (on github) and patching some files about uid/gid errors). But this isn't the problem, the default defconfig causes the same problems.
I can confirm my kernel/e3 recovery both work and can mount partitions etc, but only when I'm using the
Code:
fastboot boot recovery.img
command AND my custom boot.img isn't flashed to the device.
When trying to boot the recovery directly from the phone I get a
Code:
Error: Failed to load kernel!
error message in the bootloader log.
If my boot.img is flashed to the phone, whatever file I try to load with
Code:
fastboot boot
, I get an error from my computer :
Code:
booting...
FAILED (remote failure)
but no error from the phone
I had to replace the prebuilt gcc toolchains in the android source tree with my system's ones, could it cause the problem?
I'm quite new to android development and all so please don't blame me if the fix is obvious.
Thanks in advance

Related

[Q] View kernel messages on Transformer Prime

Is it possible to see the messages of my CM kernel while booting, either on the tablet screen, or in some other way (e.g. USB serial terminal)? I am trying to find why a kernel doesn't boot (and I suspect that it is flashed correctly but it panics for some reason), so dmesg-after-the-fact is not useful.
The /proc/cmdline of the current CM running on the tablet contains some properties that sound relevant (like 'console' and 'debug_uartport'):
Code:
$ cat /proc/cmdine
tegraid=... [email protected] vmalloc=256M androidboot.serialno=... video=tegrafb no_console_suspend=1 console=none debug_uartport=hsport usbcore.old_scheme_first=1 [email protected] [email protected] core_edp_mv=1300 audio_codec=wm8903 tegraboot=sdmmc gpt gpt_sector=60415999 androidboot.product=TF201 androidboot.carrier=wifi-only
(I have replaced some stuff with ... in the output above)
What I do:
1. Recompile the kernel from its sources, to build a zImage.
2. Get a boot.img from a nandroid backup.
3. Unpack it using the AndroidRoot BootTools.
4. Use the zImage from step 1 with the ramdisk from step 3 and a cmdline like the one at /proc/cmdline to build a boot.img.
5. Boot tablet into fastboot and fastboot -i 0x0b05 boot boot.img to test the new kernel.
But step 5 fails silently, no output is shown (except from the fastboot message "Booting downloaded image"). According to http://bootloader.wikidot.com/linux:android:kmsg, setting console=tty0 should show the messages on the screen, but it doesn't (and neither do "=tty" or "=/dev/tty0").
For step 5... the command should be fastboot -i 0x0b05 boot boot.img
Perhaps this post might help.
http://forum.xda-developers.com/showpost.php?p=27658214&postcount=157
Basically, run your kernel, then flash the file from attachment in above post, then flash a known working kernel. The /proc/last_kmsg from your kernel should be in the /sdcard.
craigacgomez said:
For step 5... the command should be fastboot -i 0x0b05 boot boot.img
Click to expand...
Click to collapse
That was a typo, fixed it in my post, thank you!

[HOWTO][AOSP] Build Nexus 9 volantis target from sources

Building image for Nexus 9 (volantis)
$ lunch aosp_flounder-userdebug
$ make
Building kernel:
Get sources:
$ git clone https://android.googlesource.com/kernel/tegra kernel/tegra
$ git checkout origin/android-tegra-flounder-3.10-lollipop-release
Configuring:
$ make ARCH=arm64 flounder_defconfig
Building:
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-android-
Copying to default place:
$ cp kernel/tegra/arch/arm64/boot/Image.gz-dtb device/htc/flounder-kernel/
Then build the whole image with new kernel
$ make
or build only boot.img with:
$ make bootimage
finikorg said:
Hi All,
I want to build Nexus 9 image from sources myself. Is it correct sequence:
$ lunch aosp_flounder-userdebug
$ make
I also read that there is somewhere target aosp_flounder64-userdebug. Which one is better?
Click to expand...
Click to collapse
You'll need to decide that for yourself. If you do the 64-bit version, be sure to have 64-bit gapps ready to flash.
But are those targets multiarch targets? So it shall be fine to run 32bit apps.
Nexus stops on 'Android' start-up screen after reflash my built image
Hi, I tried to build aosp code and it successes.
Now I failed in flashing all my built image into the Nexus 9.
What I did are :
fastboot flash boot boot.img
fastboot flash system system.img
fastboot flash cache cache.img
fastboot flash recovery recovery.img
fastboot reboot
Then my Nexus 9 has reboot and it stops on the screen of 'android' ......
One more question, please... how can I generate the vender.img ?
Regards,
Tonie Huang said:
Hi, I tried to build aosp code and it successes.
Now I failed in flashing all my built image into the Nexus 9.
What I did are :
fastboot flash boot boot.img
fastboot flash system system.img
fastboot flash cache cache.img
fastboot flash recovery recovery.img
fastboot reboot
Then my Nexus 9 has reboot and it stops on the screen of 'android' ......
One more question, please... how can I generate the vender.img ?
Regards,
Click to expand...
Click to collapse
I used
$ fastboot flashall -w
Hi, Thank for your reply.
But my question is if I download all source code from Google.
And build all on my side.
How can I flash all built images into Nexus 9.
Thanks.
Tonie Huang said:
Hi, Thank for your reply.
But my question is if I download all source code from Google.
And build all on my side.
How can I flash all built images into Nexus 9.
Thanks.
Click to expand...
Click to collapse
fastboot flashall should do this. vendor images you shall extract from factory images.
Hi, I did try it.
What I did were :
~$ lunch aosp_flounder-userdebug
Then ~$ make -j4
Then I copy out/target/product/flounder/
1. boot.img
2. cache.img
3. system.img
4. recovery.img
to the folder that Google released factory image : volantis-lrx22c
Then I've tried to:
1. zip those 4 files shown above and also add vender.img into my own image-my.zip
Then follow official steps to flash the system.
It stopped on 'android' logo after rebooting up.
I also tried to use 'fastboot flash boot boot.img' commands to flash each files.
It also halt on 'android' logo after flashing all files and rebooted.
Any other thing I didn't know ? please advise.
Regards,:crying:
Hi, now it works.
What I did are :
Re-created my own Image zip files (within android-info.txt, boot.img, cache.img, recovery.img, system.img and vender.img), and then using fastboot -w update MyImages.zip...
It works...
Thanks.

[DISCONTINUED][recovery][fota] z3&z3 dual twrp 3.0.0-0

As you know, CM Recovery is useless for now. So i make Twrp Recoveries for our device.
It works on any kernel with extract_elf_ramdisk utility (it's built in mostly all kernels for custom ROMs, but I am not sure).And don't forget, that you are doing on your own risk, I am not responsible for bricked devices, acid rains or thermonuclear war.
Known Issues
-Nothing.
Installation:
Download z3fotatwrpv5
- Extract z3fotatwrpv5.img and place it to the root of your internal SD-card
- Type su and grant root access
- Type
Code:
dd if=/sdcard/z3fotatwrpv5.img of=/dev/block/platform/msm_sdcc.1/by-name/FOTAKernel
- Reboot to recovery to test if it works (if not, try again and check if you are doing it correctly).
Warning
- Don't flash it on stock roms. It will work on custom roms.
Download:
http://www97.zippyshare.com/v/25vBjwMU/file.html
Old Links
Z3fotatwrp- http://www.mediafire.com/download/batu9oc2hzx8d4p/z3fotatwrp.rar
Z3fotatwrpv2- https://www.mediafire.com/?f1pyuh2ac4ucmmd
Z3fotatwrpv3- https://mega.co.nz/#!FswhhLBT!SOBMiNuq6A9waYU8E7YeVVWr-39MCN01OSPYHzqOoeo
Z3fotatwrpv4- https://mega.nz/#!Bl5iTA4Y!j7hkGF5Gk4HT_COW0Gb4O_LCdC8rtX1KJouzkuMAb3U
Z3 DUAL TWRP 2.8.7.0
Many thanks to @rodrigoger for creating this image! https://www.dropbox.com/s/czwgrjjv7g29mpq/z3dualfotatwrpv4.img?dl=0
Some info:
Sony Xperia devices don't have recovery partition. Instead of this in custom kernels is used recovery-in-boot conception with two-stage boot (ramdisk-recovery is packed inside main ramdisk). And there is partition called FOTAKernel that is used for installing official FOTA (firmware-over-the-air) updates. After unlocking your bootloader it partition becomes redundant, because you cannot use OTA function anymore. So it may be used for storing recovery ramdisk. And this very useful future was implemented by a xda member, he developed utility extract_elf_ramdisk (it is merged to almost all kernels for Sony devices), it extracts recovery ramdisk from FOTA partition instead of using regular one from boot image. So even after updating or changing your kernel or ROM you don't lose your current recovery!
BTW, I don't own any of this work, recoveries are not compiled by me.
Update Z3FotaTWRPV5 (TWRP 3.0.0-0)
What's new in 3.0.0-0:
Completely new theme - Much more modern and much nicer looking (by z31s1g)
True Terminal Emulator - Includes arrow keys, tab and tab completion, etc. (by _that)
Language translation - It won’t be perfect and especially some languages that require large font files like Chinese & Japanese won’t be availble on most devices. Also some languages may only be partially translated at this time. Feel free to submit more translations to OmniROM’s Gerrit. (mostly by Dees_Troy)
Flashing of sparse images - On select devices you will be able to flash some parts of factory images via the TWRP GUI (by HashBang173)
Adopted storage support for select devices - TWRP can now decrypt adopted storage partitions from Marshmallow
Reworked graphics to bring us more up to date with AOSP - includes support for adf and drm graphics (by Dees_Troy)
SuperSU prompt will no longer display if a Marshmallow ROM is installed
Update exfat, exfat fuse, dosfstools (by mdmower)
Update AOSP base to 6.0
A huge laundry list of other minor fixes and tweaks
Great work, works fine. Ill have to apply theme due to the fact it does not go full screen lol
Sent from my Xperia Z3 using XDA Free mobile app
Works fine....thx
Odoslané z Xperia Z3 pomocou Tapatalku
TigerrrRawr said:
When installing from external SD the path needs to be corrected to /storage/sdcard1/z3fotatwrpv2.img. The path you posted is for internal SD.
Thanks for creating this image!
Click to expand...
Click to collapse
I'm sorry. I was pensive while i was writing this.
Can you not just go into Fastboot and flash recovery with this file instead of method listed above?
Many thanks
Markieboy said:
Can you not just go into Fastboot and flash recovery with this file instead of method listed above?
Many thanks
Click to expand...
Click to collapse
No, because sony phones do not have a recovery partition
Most xperia recoveries are either in system or in the boot.img, this is the exception
Im a bit confused now, as i swear i flashed 2.8.4.0 and then Cyanogen recovery that way .... ??????
I'm rooted with unlocked bootloader using the exploit so have DRM keys backed up. UK GSM Unbranded
Markieboy said:
Im a bit confused now, as i swear i flashed 2.8.4.0 and then Cyanogen recovery that way .... ??????
I'm rooted with unlocked bootloader using the exploit so have DRM keys backed up. UK GSM Unbranded
Click to expand...
Click to collapse
2.8.4.0 ?
But you cannot flash a recovery in fastboot like on other phones. Cyanogenmod recovery is a boot img is that is flashed to the boot partition on fastboot, hence the code
Code:
fastboot flash BOOT boot.img
Its a kernel not a recovery, but recovery is incorporated in it.
gregbradley said:
2.8.4.0 ?
But you cannot flash a recovery in fastboot like on other phones. Cyanogenmod recovery is a boot img is that is flashed to the boot partition on fastboot, hence the code
Code:
fastboot flash BOOT boot.img
Its a kernel not a recovery, but recovery is incorporated in it.
Click to expand...
Click to collapse
So you can not do:
Code:
fastboot flash recovery fotakernel.img
?
Edit:
Turns out you can.
Verbato said:
So you can not do:
Code:
fastboot flash recovery fotakernel.img
?
Edit:
Turns out you can.
Click to expand...
Click to collapse
That's strange, as the OP says sony phones do not have a recovery partition to flash to... You may be able to
Code:
fastboot flash FOTAkernel fotakernel.img
Markieboy said:
Im a bit confused now, as i swear i flashed 2.8.4.0 and then Cyanogen recovery that way .... ??????
I'm rooted with unlocked bootloader using the exploit so have DRM keys backed up. UK GSM Unbranded
Click to expand...
Click to collapse
Which Nightly Version do u use? It must work. Give me your terminal's screenshot.
gregbradley said:
That's strange, as the OP says sony phones do not have a recovery partition to flash to... You may be able to
Code:
fastboot flash FOTAkernel fotakernel.img
Click to expand...
Click to collapse
Code:
$ fastboot flash FOTAkernel z3fotatwrpv2.img
sending 'FOTAkernel' (10728 KB)...
OKAY [ 0.353s]
writing 'FOTAkernel'...
FAILED (remote: Command not allowed)
finished. total time: 0.356s
Code:
$ fastboot flash recovery z3fotatwrpv2.img
sending 'recovery' (10728 KB)...
OKAY [ 0.353s]
writing 'recovery'...
OKAY [ 0.719s]
finished. total time: 1.072s
Well, what do you know, turns out the command really is:
Code:
fastboot flash recovery fotakernel.img
Verbato said:
Code:
$ fastboot flash FOTAkernel z3fotatwrpv2.img
sending 'FOTAkernel' (10728 KB)...
OKAY [ 0.353s]
writing 'FOTAkernel'...
FAILED (remote: Command not allowed)
finished. total time: 0.356s
Code:
$ fastboot flash recovery z3fotatwrpv2.img
sending 'recovery' (10728 KB)...
OKAY [ 0.353s]
writing 'recovery'...
OKAY [ 0.719s]
finished. total time: 1.072s
Well, what do you know, turns out the command really is:
Code:
fastboot flash recovery fotakernel.img
Click to expand...
Click to collapse
I stand corrected, but that is a new one to me.
EDIT
After talking with some devs it seems we are both correct...
It's both true
Fota IS the recovery partition, but the recovery trigger does nothing to make S1 boot from it...
So it's perfectly possible to store the recovery on the fota partition and trigger the boot to it from there with a small change in the init.
and reading the message
I can conclude fastboot does not know FOTAkernel, but assumes it to be 'recovery'
Click to expand...
Click to collapse
So basically your command is flashing to the FOTAkernel partition because fastboot does not recognise it... Schrodinger's cat... we are both correct and both wrong at the same time.
Sources Please?
hey I was wondering about the sources you used to compile this, I've tried by building with cm breakfast and omni's branch of android bootable but I get multiple errors..
Code:
bootable/recovery/gui/resources.hpp:48: error: undefined reference to 'gr_getMaxFontHeight'
bootable/recovery/gui/resources.hpp:48: error: undefined reference to 'gr_getMaxFontHeight'
bootable/recovery/gui/scrolllist.cpp:205: error: undefined reference to 'gr_clip'
bootable/recovery/gui/scrolllist.cpp:315: error: undefined reference to 'gr_noclip'
bootable/recovery/gui/resources.hpp:48: error: undefined reference to 'gr_getMaxFontHeight'
bootable/recovery/gui/resources.hpp:48: error: undefined reference to 'gr_getMaxFontHeight'
bootable/recovery/gui/console.cpp:198: error: undefined reference to 'gr_maxExW'
bootable/recovery/gui/resources.cpp:186: error: undefined reference to 'gr_freeFont'
Any help please?
I am running the latest CM12 nightly.
Can I fast boot flash the recovery and not worry about my system bricking?
Yes, it's working without any issues. Using fastboot flash recovery on twrp 2.8.5.0. It's great not to use that CM-Recovery.
Any chance we can get 2.8.5.0 for FOTA ? Stock recovery for CM12 Sucks but 2.8.4.0 does not play well with flashing CM12 Roms
Ignore as I just saw your edited OP. You may want to update your title
Sent from my Xperia Z3 using XDA Free mobile app
HaoZeke said:
hey I was wondering about the sources you used to compile this, I've tried by building with cm breakfast and omni's branch of android bootable but I get multiple errors..
Code:
bootable/recovery/gui/resources.hpp:48: error: undefined reference to 'gr_getMaxFontHeight'
bootable/recovery/gui/resources.hpp:48: error: undefined reference to 'gr_getMaxFontHeight'
bootable/recovery/gui/scrolllist.cpp:205: error: undefined reference to 'gr_clip'
bootable/recovery/gui/scrolllist.cpp:315: error: undefined reference to 'gr_noclip'
bootable/recovery/gui/resources.hpp:48: error: undefined reference to 'gr_getMaxFontHeight'
bootable/recovery/gui/resources.hpp:48: error: undefined reference to 'gr_getMaxFontHeight'
bootable/recovery/gui/console.cpp:198: error: undefined reference to 'gr_maxExW'
bootable/recovery/gui/resources.cpp:186: error: undefined reference to 'gr_freeFont'
Any help please?
Click to expand...
Click to collapse
Recoveries are not compiled by me.
Mattadome02 said:
I am running the latest CM12 nightly.
Can I fast boot flash the recovery and not worry about my system bricking?
Click to expand...
Click to collapse
I haven't tried this yet. You can flash this with my codes.

[Q] Porting cyanogenMod12.1, cannot boot the device

Hi,
I'm porting the cyanogenMod12.1 to a new device, as I have the source code of the device, so I port the bootloader and kernel source to cyanogenMod project and use the many config files under /device/../..
And then make the bootimage, but after I flash the boot.img to the device, it failed with below errors.
[400] use_signed_kernel=1, is_unlocked=1, is_tampered=0.
[400] boot_verifier: Device is in ORANGE boot state.
[410] Device is unlocked! Skipping verification...
[410] Loading boot image (31348736): start
[610] Loading boot image (31348736): done
[840] ERROR: Bad magic in device tree table
[840] ERROR: Cannot validate Device Tree Table
[840] ERROR: Could not do normal boot. Reverting to fastboot mode.
[850] fastboot_init()
And I unpacked the boot.img, and I found the "BOARD_DT_SIZE 6868992" which is different with the value "BOARD_DT_SIZE 8192000" which unpacked from the original boot.img getting from the device.
Can anyone tell me what's wrong with my boot.img ? And where the "BOARD_DT_SIZE " is set ?
Thanks.
Linda
lindakang2007 said:
Hi,
I'm porting the cyanogenMod12.1 to a new device, as I have the source code of the device, so I port the bootloader and kernel source to cyanogenMod project and use the many config files under /device/../..
And then make the bootimage, but after I flash the boot.img to the device, it failed with below errors.
[400] use_signed_kernel=1, is_unlocked=1, is_tampered=0.
[400] boot_verifier: Device is in ORANGE boot state.
[410] Device is unlocked! Skipping verification...
[410] Loading boot image (31348736): start
[610] Loading boot image (31348736): done
[840] ERROR: Bad magic in device tree table
[840] ERROR: Cannot validate Device Tree Table
[840] ERROR: Could not do normal boot. Reverting to fastboot mode.
[850] fastboot_init()
And I unpacked the boot.img, and I found the "BOARD_DT_SIZE 6868992" which is different with the value "BOARD_DT_SIZE 8192000" which unpacked from the original boot.img getting from the device.
Can anyone tell me what's wrong with my boot.img ? And where the "BOARD_DT_SIZE " is set ?
Thanks.
Linda
Click to expand...
Click to collapse
Sounds like your trying to hack into someone else device stay out of other peoples phones
Sent from my XT1064 using Tapatalk

Signing release for "fastboot update"?

Device in question, although likely not relevant to the issue I am having: Pixel 2 XL (Taimen). Let me know if there's any info I may have missed sharing that could help solve this.
My overarching goals here are:
1. Build vanilla AOSP "user" variant without root or any other additions
2. Sign the build with my own release keys
3. Be able to git-checkout release tags at a later time, build again, and produce OTA updates for this vanilla AOSP build
So far, I have been able to successfully build the latest release and flash it to my device using:
Code:
fastboot flashall
The device boots and runs as you would expect.
However, that is all using the test-key. I have followed the official documentation for generating release keys:
hxxps://source.android[.]com/devices/tech/ota/sign_builds#release-keys
The same documentation page provides the following listing for generating the release image:
Code:
make dist
./build/make/tools/releasetools/sign_target_files_apks \
-o \ # explained in the next section
--default_key_mappings ~/.android-certs out/dist/*-target_files-*.zip \
signed-target_files.zip
Apparently SignApk.jar doesn't work with password-encrypted keys (it throws an exception then swallows it which causes the whole thing to fail at a later point), and signing the APKs in the target files ZIP fails. Fine, I'm willing to use an unencrypted key for testing this project.
So I successfully get a signed-target_files.zip.
Lastly, the documentation provides the following for producing the release image:
Code:
./build/make/tools/releasetools/img_from_target_files signed-target-files.zip signed-img.zip
This also works successfully (minus the typo with the filename, switching the '_' character for '-'), so I use this to install:
Code:
fastboot update -w signed-img.zip
Then I get symptoms of the problem:
1. Warning that the bootloader is unlocked (fine)
2. White screen with "Google" logo
3. Reboot to bootloader
I never see the "android" splash screen after 2. like when I
Code:
fastboot flashall
to install the test-key version which does work.
So something else that I decided to try was to create an "unsigned-img.zip." I basically used img_from_target_files on the original, unsigned target_files.zip. and did a
Code:
fastboot update -w unsigned-img.zip
. This also booted successfully.
=====================
To recap:
1. Building is successful
2. "fastboot flashall" is successful
3. "fastboot update unsigned-img.zip" is successful
4. "fastboot update signed-img.zip" is NOT successful and always reboots back to the bootloader
Is there something I'm missing with regards to the image signing? If I'm doing this and having this issue on an unmodified AOSP branch, shouldn't everyone else be having these signing issues, as well?
Any help is appreciated.
It worked for me without -w argument:
Code:
fastboot update signed-img.zip

Categories

Resources