Git Product home page Git Product logo

msm8916-mainline / lk2nd Goto Github PK

View Code? Open in Web Editor NEW
324.0 20.0 297.0 14.97 MB

Custom bootloader for Qualcomm MSM8916/MSM8226/MSM8974/... devices

License: Other

Makefile 1.08% C 90.47% Assembly 2.75% C++ 0.07% Shell 0.12% DIGITAL Command Language 0.56% Perl 4.50% XS 0.02% M4 0.24% eC 0.02% Batchfile 0.01% Python 0.15%
lk2nd qualcomm msm8916 bootloader firmware hacktoberfest lk1st msm8974 msm8939 msm8226

lk2nd's Introduction

lk2nd

lk2nd is a custom bootloader for many different devices based on Qualcomm system-on-chips (SoCs), including smartphones, tablets, smartwatches and a few single board computers (SBCs). It simplifies booting standard operating systems by providing:

  • A unified boot and flashing interface (Android Fastboot), independent of device-specific modifications made to the boot chain (e.g. the proprietary flashing interface on Samsung devices)
  • Automatic device and hardware detection (e.g. display panels, batteries, ...)
  • Additional bootloader features (e.g. file system boot, booting from SD card)
  • Additional firmware features (e.g. booting secondary CPU cores if the firmware lacks PSCI support)
  • Workarounds for various device-specific issues (e.g. USB on some Samsung devices, modem on Motorola smartphones, ...)
  • Various debugging commands that allow better understanding of the hardware for research and development purposes

There are two different configurations:

  • lk2nd: "secondary" bootloader intended for devices where existing firmware cannot be replaced easily (most smartphones and tablets). In this configuration, lk2nd does not replace the stock bootloader. Instead, it is packed into an Android boot image, which is then loaded by the stock bootloader just like the original Android image. The real operating system can be placed in the boot partition with 512 KiB offset or stored in a ext2 file system. It does not have to be Android or even Linux, any kind of kernel can be packed into an Android boot image.

  • lk1st: primary bootloader intended for single-board computers (SBCs) and expert users. In this case, it is the "first" bootloader responsible for loading the main operating system.

This repository is a fork of the original open-source bootloader from Qualcomm (tag LA.BR.1.2.9.1-02310-8x16.0), which is a heavily modified version of the Little Kernel Embedded Operating System.

Supported SoCs

  • lk2nd-msm8916: APQ8016, MSM8216, MSM8916, MSM8929, MSM8939
  • lk2nd-msm8974: MSM8974
  • lk2nd-msm8226: APQ8026, MSM8226, MSM8926

See Chipsets page on the EFIDroid wiki for an exact mapping of LK targets to SoCs.

Supported devices

lk2nd-msm8916

  • Acer Iconia Talk S A1-724 (quirky - see comment in dts/msm8916/msm8916-mtp-smb1360.dts)
  • Alcatel OneTouch Idol 3 (4.7) - 6039*
  • Alcatel OneTouch Idol 3 (5.5) - 6045*
  • ARK Benefit A3 - peach
  • Asus Zenfone 2 Laser (720p) - Z00L
  • Asus Zenfone 2 Laser (1080p) - Z00T
  • Asus Zenfone 2 Laser ZE500KL - Z00E
  • Asus Zenfone Max ZC550KL (2016) - Z010D
  • BQ Aquaris M5 - piccolo (use lk2nd-msm8916-appended-dtb.img)
  • BQ Aquaris X5 - paella, picmt
  • DragonBoard 410c - apq8016-sbc
  • GPLUS FL8005A
  • HTC One M8s - m8qlul (quirky - see comment in dts/msm8916/msm8939-htc-m8qlul.dts)
  • Huawei Ascend G7 - G7-L01
  • Huawei G7 Plus / G8 / GX8 - rio
  • Huawei Honor 5X / GR5 (2016) - kiwi
  • Huawei Y635 - Y635-L01 (quirky - see comment in dts/msm8916/msm8916-huawei-y635-l01.dts)
  • Lenovo A6000
  • Lenovo A6010
  • Lenovo PHAB Plus - PB1-770M, PB1-770N, PB1-770P
  • Lenovo Vibe K5 (Plus) - A6020a40, A6020a40 (HW Code 39), A6020a46, A6020l36
  • LG K10 (m216) - K420
  • LG Leon LTE (c50) - H340, H342, H343, H345, MS345, etc
  • LYF Wind 1 - ls5010
  • Marshall London
  • Motorola Moto E (2015) - surnia
  • Motorola Moto G (2015) - osprey
  • Motorola Moto G4 Play - harpia
  • Samsung Galaxy A3 (2015) - SM-A300F, SM-A300FU
  • Samsung Galaxy A5 (Duos) (2015) - SM-A5000, SM-A500F, SM-A500FU, SM-A500H, SM-A500YZ
  • Samsung Galaxy A7 (2015) - SM-A700YD
  • Samsung Galaxy Ace 4 - SM-G357FZ (quirky - see comment in dts/msm8916/msm8916-samsung-r02.dts)
  • Samsung Galaxy Core Max - SM-G5108Q (quirky - see comment in dts/msm8916/msm8916-samsung-r08.dts)
  • Samsung Galaxy Core Prime LTE - SM-G360F, SM-G360G, SM-G360T (rossaltezt is quirky - see comment in dts/msm8916/msm8916-samsung-r03.dts)
  • Samsung Galaxy E5 - SM-E500F
  • Samsung Galaxy E7 - SM-E7000
  • Samsung Galaxy Grand Max - SM-G720AX
  • Samsung Galaxy Grand Prime - SM-G530FZ, SM-G530H, SM-G530W, SM-G530Y (G530Y is quirky - see comment in dts/msm8916/msm8916-samsung-r11.dts)
  • Samsung Galaxy J3 (2016) - SM-J3109, SM-J320YZ
  • Samsung Galaxy J3 Pro - SM-J3110, SM-J3119
  • Samsung Galaxy J5 (2015) - SM-J5007, SM-J5008, SM-J500F, SM-J500FN, SM-J500H, SM-J500M
  • Samsung Galaxy J5 (2016) - SM-J5108, SM-J510F, SM-J510FN, SM-J510H, SM-J510MN, SM-J510UN
  • Samsung Galaxy J7 (2015) - SM-J7008, SM-J700P
  • Samsung Galaxy On7 (2015) - SM-G6000, SM-G600FY, SM-G600S
  • Samsung Galaxy S4 Mini Value Edition - GT-I9195I
  • Samsung Galaxy Tab 4 10.1 (2015) - SM-T533
  • Samsung Galaxy Tab A 8.0 (2015) - SM-T350, SM-T355, SM-T355Y, SM-T357W
  • Samsung Galaxy Tab A 9.7 (2015) - SM-T550, SM-T555
  • Samsung Galaxy Tab E 9.6 WiFi (2015) - SM-T560NU
  • Vivo Y21L
  • Vodafone Smart prime 6
  • Wileyfox Swift - crackling
  • Xiaomi Mi 4i - ferrari
  • Xiaomi Redmi 2 - wt86047, wt88047
  • Xiaomi Redmi 3 - ido
  • Yamada EveryPad III (rebrand of Lenovo PHAB Plus)
  • Zhihe-series 4G Modem Stick - ufi-001c(b), uf896, uz801-v3.0 ( uz801-v3.0 is quirky - see comment in dts/msm8916/msm8916-512mb-mtp.dts )

lk2nd-msm8974

  • Fairphone 2 - FP2
  • HTC One M8 - m8
  • LG G3 - D855
  • LG Google Nexus 5 - hammerhead D820, D821
  • OnePlus One - bacon (use lk2nd-msm8974-appended-dtb.img)
  • Samsung Galaxy S5 - SM-G900F
  • Samsung Galaxy S5 China LTE (Duos) - SM-G9006V/W, SM-G9008V/W, SM-G9009W
  • Sony Xperia Z3 - leo

lk2nd-msm8226

  • ASUS ZenWatch 2 - sparrow
  • Coolpad 8730L - 8730l
  • HTC One Mini 2 - memul (quirky - see comment in dts/msm8226/msm8926-htc-memul.dts)
  • Huawei Ascend G6 4G - G6-L11 (quirky - see comment in dts/msm8226/msm8926-huawei-g6-l11-vb.dts)
  • Huawei Watch - sturgeon
  • LG G Watch R - lenok (use lk2nd-appended-dtb.img)
  • Motorola Moto G 2013 - falcon
  • Motorola Moto G 4G 2013 - peregrine
  • Motorola Moto G 2014 - titan
  • Samsung Galaxy Grand 2 - SM-G7102
  • Samsung Galaxy Tab 4 10.1 (2014) - SM-T530, SM-T535
  • Samsung Galaxy Tab 4 8.0 (2014) - SM-T330, SM-T330NU

Installation

  1. Download lk2nd.img (available in Releases)
  2. Flash lk2nd.img using the stock flashing interface:
    • Fastboot: fastboot flash boot lk2nd.img
    • Samsung: heimdall flash --BOOT lk2nd.img

If you get fastboot: error: Couldn't parse partition size '0x' try one of the following workarounds:

  • fastboot flash:raw boot lk2nd.img
  • fastboot boot lk2nd.img, then fastboot flash lk2nd lk2nd.img

Usage

lk2nd provides the standard Android fastboot protocol for flashing/booting Android boot images.

Press Volume Down while booting to enter Fastboot mode. Press Volume Up while booting to boot into Recovery mode.

Note: If your stock bootloader uses the same key combinations, you need to wait a bit before pressing the volume keys. Usually, waiting until the screen turns on and/or the device vibrates should be enough to make the stock bootloader ignore the keys.

fastboot flash lk2nd lk2nd.img can be used to update lk2nd directly from its fastboot interface.

Note: fastboot flash boot boot.img will flash the actual boot image with 512 KiB offset into the boot partition. This is done to avoid replacing lk2nd (since it is also booted from the boot partition).

Other fastboot commands work normally.

Troubleshooting

If the device shows up via fastboot you can get a log file from lk2nd using fastboot oem lk_log && fastboot get_staged <output-file>, where <output-file> is either some text file to write to (e.g. output.txt) or /dev/stdout to write the log to standard output.

Building

Check Supported SoCs for the make target you should use below. (It depends on the SoC of your device.)

$ make TOOLCHAIN_PREFIX=arm-none-eabi- lk2nd-msmXXXX

Requirements:

  • ARM (32 bit) GCC tool chain
    • Arch Linux: arm-none-eabi-gcc
    • Alpine Linux and postmarketOS: gcc-arm-none-eabi
    • Debian and Ubuntu: gcc-arm-none-eabi
    • Fedora: arm-none-eabi-gcc-cs
  • Device Tree Compiler
    • Arch Linux: dtc
    • Alpine Linux and postmarketOS: dtc
    • Debian and Ubuntu: device-tree-compiler
    • Fedora: dtc
  • libfdt
    • Alpine Linux and postmarketOS: dtc-dev
    • Debian and Ubuntu: libfdt-dev
    • Fedora: libfdt-devel
  • GNU tar
    • Alpine Linux and postmarketOS: tar

Replace TOOLCHAIN_PREFIX with the path to your tool chain. lk2nd.img is built and placed into build-lk2nd-msmXXXX/lk2nd.img.

Note: Unlike lk2nd, lk1st is still experimental and therefore not described here yet.

Porting

To other devices with a supported SoC

  • Add a simple device tree to dts/. You just need model and the qcom,msm-id/qcom,board-id from downstream.

To other SoCs

Qualcomm maintains separate branches for various groups of SoCs. The branches can be seen on the Chipsets page on the EFIDroid wiki. This version of lk2nd is based on the LA.BR branch for MSM8916. There is a fork for MSM8953 based on the LA.UM branch.

The bootloader will work best when you use the correct branch for your device. Older platforms are usually kept around by Qualcomm but barely tested and may not work, or not even compile.

However, if make files for your SoC are present in this version or the MSM8953 fork you can try to enable it and see if it works well enough for you. Otherwise you would need to go through the Git history and pick the relevant commits to another branch from https://source.codeaurora.org/quic/la/kernel/lk/.

To enable support for a SoC that is already present in this repository:

  1. Create a new project/lk2nd-<target>.mk which looks like the others.
  2. Try to compile it and fix all the compile errors.
  3. Try to run it and hope that it works.

Good luck!

Contact

Ask on Matrix or IRC.

lk2nd's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lk2nd's Issues

BootLoop flashing lk2nd Moto E2

Hi I´m trying to flash lk2nd to MotoE2, tried with different versions and always get a bootloop.
some information from flashboot mode
Model: Surnia XT1527 8GB P3
CPU: MSM8916
Device is UNLOCKED. Status Code 3

tried with lk2nd version 0.14.0 and 0.11.0 and didn´t work.
Tried with stock rom 6.0, cant find stock rom 5.0.2 that works with my device.

is there a way to make it work? Im flashing it as documentation says fastboot flash boot lk2nd.img

Build steps - help needed

I will build this project, but I don't understand what tool chain actually is. Can You help me please?
I use Linux Manjaro 64bit, Linux Kernel 5.13.1-3. Which tool chain prefix I have to use?
make TOOLCHAIN_PREFIX=arm-none-eabi- MSM8916-secondary
Cheers, Roman

Can't flash motorola harpia

I cant flash to Moto G4 Play harpia.
Terminal output:
"(bootloader) has-slot:boot: not found
(bootloader) is-logical:boot: not found
Sending 'boot' (494 KB) OKAY [ 0.042s]
Writing 'boot' (bootloader) Image not signed or corrupt

OKAY [ 0.052s]
Finished. Total time: 0.153s"

Actual support for SM-T350?

Hello. I looked up installing pmOS for SM-T350 but according to this repo that it doesn't list the device.

However I still tried it. I used heimdall to install the bootloader but after installation, somehow fastboot devices doesn't recognize the device.

I went back to the latest Nougat stock image. I would like to hear feedback for the support, thank you.

[Bug] Crash on low-memory devices.

For LTE dongles with 512MB memory, fastboot flash system(or userdata) would crash the device, an additional argument like -S 200M is required to flash a large partition.

[SM-G530H] does not appear on fastboot devices

I flashed lk2nd-msm8916 using heimdall, I can boot into lk2nd, it shows that it is in fastboot mode, but so far I haven't been able to detect it on windows or linux using fastboot devices

I guess it's because the only ones supported in this family are Samsung Galaxy Grand Prime - SM-G530W, SM-G530Y

Proper dualbooting of two linux installs

Currently if there's a linux install on the sdcard, lk2nd will boot that install and will ignore whatever that's on the boot partition.

I purpose adding a feature to choose which install to boot each time a device turns on or allowing some kind of configuration for changing which install is preferred on boot.

Not detected by PC (SM-G600FY)

The image flashed and booted fine and works.
But it is not detected by the PC.

fastboot devices on Linux gives no reply (I have tried running it as root)

On Windows the device doesn't pop up on Device Manager and well fastboot devices doesn't list it either.

Samsung On 7 Pro (SM-G600FY)
MSM-8916

Not recognising SM-T350

The device is Samsung's Galaxy Tab A 8.0, SM-T350. It seems to be supported by #186.

Please tell me what went wrong here:

First I cloned this repo and build with the command

make TOOLCHAIN_PREFIX=arm-none-eabi- lk2nd-msm8916

No errors, then I flashed the image with

fastboot flash lk2nd build-lk2nd-msm8916/lk2nd.img (no, it should be heimdall for the first time)

heimdall flash --BOOT lk2nd.img

When boot into lk2nd, the device is not recognized. It shows:

... ...
MODEL - Unknown (FIXME!)
... ...
DTB - <268 0cx01ff01 0 0x4>
... ...

The dtb info is different from that PR. But I have no idea what that implies.

`fastboot flash partition` doesn't work on lk1st

Is this expected behavior?

$ fastboot getvar product
product: LK1ST_MSM8916
Finished. Total time: 0.002s

$ fastboot flash partition ./gpt_both0.bin
Sending 'partition' (33 KB)                        OKAY [  0.005s]
Writing 'partition'                                FAILED (remote: 'partition table doesn't exist')
fastboot: error: Command failed

lk2nd/app/aboot/aboot.c

Lines 2696 to 2706 in 627d219

#if !WITH_LK2ND
if (!strcmp(pname, "partition"))
{
dprintf(INFO, "Attempt to write partition image.\n");
if (write_partition(sz, (unsigned char *) data)) {
fastboot_fail("failed to write partition");
return;
}
}
else
#endif

Choosing of toolchain

Hi! I don't understand what is toolchain needed. Can you say toolchain, which is used by you?

lk2nd not working on Samsung S4 mini?

Hi there

I'm wanting to use postmarketos and so installed current lk2nd (on Ubuntu) via "heimdall flash --BOOT lk2nd.img". No sign of error occurred and the phone auto-rebooted. I see the Samsung boot logo, and then I held down the Power+VolDown keys, but nothing changes - no sign of lk2nd executing (also tried holding down keys before seeing the logo). I've also tried with just VolDown and even re-flashed with "--no-reboot" and did the reboot myself - no difference - and of course "fastboot flash ..." doesn't work as it's Samsung.

Any ideas what's wrong? The phone has TWRP and LineageOS on it - I don't know if that messes with anything - but I'll mention it for completeness.

Thanks

Please support SM-T560

SM-T560NU is supported but SM-T560 is not. The file for SM-T560NU does not work on SM-T560. Thank you for your consideration. I could test the new builds.

htc-a51tuhl: dtbTool need add some extra item for htc

After checked the dtb generated from stock dts, found it ignores the '--dt-tag "htc,project-id = <"', cause the dtb is lost, from HTC fastboot oem demsg :

INFO[6646622] fastboot_command:[oem dmesg]
INFO[6646636] fb_cmd_oem:dmesg
INFO[6646695] register_debug_console: new entry ptr=0x83000000
INFO[8782573] fastboot_command:[download:000a6010]
INFO[8782588] CMD:download: download:000a6010
INFO[8782665] recv data addr=86800000 size=A6010
INFO[8782677] status: DATA000a6010
INFO[8783007] Prepare to download data[679952 Bytes]...
INFO[8973761] fastboot_command:[boot]
INFO[8973800] [DEBUG] Board pid:379, pcbid:0x80, soc version:0x1
INFO0000
INFO[8973817] [DEBUG] DTB entry[1] pid:239, pcbid:0x1, hw_subtyp
INFOe:0x0, soc version:0x0 (offset:0x800, size:0x33000)
INFO[8973833] [DEBUG] DTB entry[2] pid:241, pcbid:0x1, hw_subtyp
INFOe:0x0, soc version:0x0 (offset:0x800, size:0x33000)
INFO[8973848] [DEBUG] DTB entry[3] pid:263, pcbid:0x1, hw_subtyp
INFOe:0x0, soc version:0x0 (offset:0x800, size:0x33000)
INFO[8973861] [CRITICAL] ERROR: Getting device tree address fail
INFOed

refer :
https://review.lineageos.org/c/LineageOS/android_device_qcom_common/+/32682
https://github.com/LineageOS/android_system_tools_dtbtool/

is there can add that function in dtbTool? it's not like oppo need different dtbtool to build special dtb...

booting with sdcard inserted "fails"

I was trying to setup a dual-boot situation with two surnia's (one xt1526, one xt1527). Both seem to exhibit the same behavior.

What I did:

  • installed lineageos and confirmed OK
  • flashed lk2nd 0.12.0 to boot
  • flashed lineageos boot.img from their zip via lk2nd
  • confirmed boot to lineageos works through lk2nd
  • inserted sdcard created by pmbootstrap
  • restarted

I would expect that postmarketos would start, it doesn't.
I would expect that volume down button would get me into lk2nd, it doesn't.

I just get my "unlocked bootloader" screen and seemingly "stuck".

I didn't see anyway that lk_log would help since I can't get to lk2nd when the sdcard is in.

I checked lk_log when sdcard is not in and I see these lines. Do they indicate just that there is no sdcard or that there is some problem with the sdcard reader?

[150] found GPT
[160] initialising mmc_slot =2
[160]  Initializing MMC host data structure and clock!
[170] Error: Command timeout error
[170] Failure getting OCR response from MMC Card
[170] MMC card failed to respond, try for SD card
[180] Error: Command timeout error
[180] The response for CMD8 does not match the supplied value
[190] Failed to initialize SD card
[190] Failed detecting MMC/SDC @ slot2
[190] sdcard init failed![200] qhypstub image lacks magic, not loading
[200] pm8x41_get_is_cold_boot: cold boot
[200] calling apps_init()
[210] Display Init: Start

lk2nd cannot work well with multi dtbs?

Model:SM-G5108Q
I add its model and qcom,msm-id/qcom,board-id to "msm8916-samsung-r08.dts" to build.After flashing "lk2nd.img" ,it stays at Odin Mode and says "cannot do normal boot".

But after deleting other dtbs of the
"lk2nd/dts/msm8916/rules.mk" ,lk2nd can normally work on SM-G5108Q.

About Honor5X

Hello, the dts of Honor 5X can only be compatible with KIW-L21 models, and models such as AL10 cannot be started (it prompts dtb Not found)
You can see my fork here``

Support for Alcatel P350x (One Touch 8S)

Hi!
I currently own such device, but with Orange branding (Orange Sego). Is there any chance to get lk2nd running here? It have msm8916 chipset.
If any more data is necessary, please let me know :)

Allow additional DT change(s) depending on arbitrary cmdline param

idol347 has variants with different pinctrl setting for tfa9897 codec (mainly gpios numbers)
depending on androidboot.BOARD_ID value (BIT(1) being set or not).
Ideally, lk2nd would change DT according to this value.

How should such feature be implemented ?
Some guidelines would be nice, and I can get a go at it.

About Samsung SM-A7000

I see that this project has support for Samsung Galaxy A7 (2015) - SM-A700YD

The SM-A7000 is its Chinese version (the same processor MSM8939)

This is the official open source kernel source code of this model (4.4-6.0): Kernel_Source_Code

This is the twrp image I normally use: SM-A7000_twrp

Can you complete it ? Thank you !

Touchscreen don't work and Boot can't showing as only black screen on ASUS_Z00T

Hi i have encountered problem when i trying to install PostmarketOS gnome on Asus Zenfone 2 Laser 1080P variant. Until after asus logo can't showing a postmarketos logo it only shown Black screen but it's booted in 2 minutes only. And after booted Touchscreen not working it's only mousepad can used on touch it looks hard to touch and it's controlled by mouse. Any help?

It's according postmarketos wiki said Touch screen works but nothing works on me

Post a new device

How can I post this projcet on a new device(based on msm8974)?
I need help,the device is ZTE S 291(or ZTE Grand SII);
Thanks.

lk2nd 0.11.0 broke support for htc-m8qlul

Some change between lk2nd 0.10.0 and 0.11.0 broke htc-m8qlul. With lk2nd 0.11.0, it boots into HTC's fastboot mode right on boot. I haven't bisected this yet, but I'm making this for tracking purposes.

Edit: A previous version of this post said it boots into EDL mode. I cannot reproduce this any more. It might have been the result of me not doing clean builds. Now, it boots into HTC's fastboot mode instead.

Instructions for using lk2nd together with lineageos for d855

I couldn't figure out how to install lk2nd together with lineageos on a LG G3 D855. I always get this secure boot certificate error. From the [postmarketos] page on this device I can see that the boot image needs to be signed, but I didn't manage to transfer that to a lineageos setup.

Any hints?

Galaxy A3 with product name SM-A3009 is not supported.

When I see that a Samsung Galaxy A3 phone could run postmarketOS, I buy one. But when I try to run lk2nd, I find that my Galaxy A3 is SM-A3008 and that one is not supported by lk2nd. I have tryed some methods such as modifying dts... But I do not known which downstream is about SM-A3009. Is there are some quick method to add support for SM-A3009. Or some help that could let me known how to add support for a variant of Samsung Galaxy A3.
Thanks for reading.

[SM-P550] Not booting to stock android.

Hi, I'm using the Samsung Galaxy Tab A 9.7 2015 [SM-P550] and after flashing the lk2nd bootloader I can't boot into stock android anymore, when selecting the START entry it just reboots to lk2nd. But it works with postmarketos, either when I flash it or load from the sdcard. The stock firmware version is P550XXU1CSJ2_P550ZTO1CSJ2.

Here is the log file captured with fastboot oem lk_log && fastboot get_staged

[SM-A300FU] lk2nd doesn't boot

Hello.
I tried to install postmaketOS in my phone (Samsung Galaxy A3 2015 SM-A300FU).
I have flashed lk2nd in my device with heimdall flash --BOOT lk2nd-msm8916.img.
Here is the end of the message that appears on my computer:
"Uploading BOOT
100%
BOOT upload successful
Ending session...
Rebooting device...
Releasing device interface..."
My phone restarted on a page with the message: "Set Warranty Bit : kernel" and nothing else happens. When i try to connect it on my computer, i see the message "ERROR : Failed to detected compatible download-mode device".
When i press on vol down + home + power, i see the screen in odin mode and i can see the device from lsusb.
When i press on vol down + power, i see the screen with "Set Warranty Bit: kernel" and i can't see the device from lsusb.

msm8953 support

Do you have any plans regarding adding msm8953 support to it!

Nice project ! Keep going

Allow additional DT change(s) from panel selector

There are idol3 variants with different panels and touchscreen.
It seems those are paired (eg. nt35596 panel + rmi4, and r63315 panel + edt5x06).
Ideally, lk2nd would enable the expected touchscreen and disable the other one.

How should such feature be implemented ?
Some guidelines would be nice, and I can get a go at it.

build fails on 99031c972a3bc5e663e582138470edf272b52881

Using the command mentioned:

make TOOLCHAIN_PREFIX=arm-none-eabi- msm8916-secondary

And here's the version of the toolchain and dtc:

$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ dtc --version
Version: DTC 1.4.7

I get the following errors near the end:

--- snip ---
compiling lib/openssl/crypto/sha/asm/sha1-armv4-large.S
compiling lib/openssl/crypto/sha/asm/sha256-armv4.S
compiling lib/zlib_inflate/zutil.c
compiling lib/zlib_inflate/adler32.c
compiling lib/zlib_inflate/inftrees.c
compiling lib/zlib_inflate/inflate.c
compiling lib/zlib_inflate/inffast.c
compiling lib/zlib_inflate/decompress.c
generating build-msm8916-secondary/system-onesegment.ld
linking build-msm8916-secondary/lk
generating image: build-msm8916-secondary/lk.bin
   text    data     bss     dec     hex filename
 292224  164328   44728  501280   7a620 build-msm8916-secondary/lk
arm-none-eabi-objcopy -O binary build-msm8916-secondary/lk build-msm8916-secondary/lk.bin
generating listing: build-msm8916-secondary/lk.lst
generating listing: build-msm8916-secondary/lk.debug.lst
generating symbols: build-msm8916-secondary/lk.sym
generating size map: build-msm8916-secondary/lk.size
generating stripped elf: build-msm8916-secondary/lk_s.elf
compiling dts/apq8016-samsung-r02.dts
build-msm8916-secondary/dts/apq8016-samsung-r02.dtb: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
compiling dts/apq8016-samsung-r07.dts
build-msm8916-secondary/dts/apq8016-samsung-r07.dtb: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
compiling dts/msm8916-motorola-harpia.dts
build-msm8916-secondary/dts/msm8916-motorola-harpia.dtb: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
compiling dts/msm8916-mtp.dts
build-msm8916-secondary/dts/msm8916-mtp.dtb: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
compiling dts/msm8916-qrd9-v1.dts
build-msm8916-secondary/dts/msm8916-qrd9-v1.dtb: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
compiling dts/msm8916-samsung-r01.dts
build-msm8916-secondary/dts/msm8916-samsung-r01.dtb: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
compiling dts/msm8916-samsung-r03.dts
build-msm8916-secondary/dts/msm8916-samsung-r03.dtb: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
build-msm8916-secondary/dts/msm8916-samsung-r03.dtb: Warning (gpios_property): /serranovelte/samsung,muic-reset:i2c-gpios: cell 0 is not a phandle reference
build-msm8916-secondary/dts/msm8916-samsung-r03.dtb: Warning (gpios_property): /serranovelte/samsung,muic-reset:i2c-gpios: Could not get phandle node for (cell 0)
compiling dts/msm8916-samsung-r04.dts
build-msm8916-secondary/dts/msm8916-samsung-r04.dtb: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
build-msm8916-secondary/dts/msm8916-samsung-r04.dtb: Warning (gpios_property): /j5xlte-eur/samsung,muic-reset:i2c-gpios: cell 0 is not a phandle reference
build-msm8916-secondary/dts/msm8916-samsung-r04.dtb: Warning (gpios_property): /j5xlte-eur/samsung,muic-reset:i2c-gpios: Could not get phandle node for (cell 0)
compiling dts/msm8916-samsung-r06.dts
build-msm8916-secondary/dts/msm8916-samsung-r06.dtb: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
compiling dts/msm8916-samsung-r08.dts
build-msm8916-secondary/dts/msm8916-samsung-r08.dtb: Warning (unit_address_vs_reg): /memory: node has a reg or ranges property, but no unit name
libfdt is missing, please install it
make[1]: *** [make/build.mk:52: build-msm8916-secondary/dt.img] Error 1
make[1]: Leaving directory '/home/craig/src/postmarketos/lk2nd'
make: *** [makefile:20: make-make] Error 2

Load new OS or Kernel doesnt work

Well, i already tried many ways to load kernel or OS build from pmbootstrap, but all them fail to load stuff on Cellphone proper enabled on Dev config.

i have try used adb who see devices connected but heimdall/fastboot/pmbootstrap aways wait to some devices appear; heimdall try install but fails as show below:

Initialising protocol...
Protocol initialisation successful.

Beginning session...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...

Some devices may take up to 2 minutes to respond.
Please be patient!

WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
Session begun.

WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
Downloading device's PIT file...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
PIT file download successful.

Uploading RECOVERY
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
0%WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...

1%

2%
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
ERROR: Failed to unpack received packet.

ERROR: Failed to confirm end of file transfer sequence!
ERROR: RECOVERY upload failed!

Ending session...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
Rebooting device...
WARNING: Empty bulk transfer after sending packet failed. Continuing anyway...
Releasing device interface.

should be easy see on steps you and others showed to install , but am facing this barrer. Any help could be welcomed.

Using LK2ND_MSM8226 buttons are wrong

I'm trying to install postmarketos in an old device Samsung Galaxy Tab 10.1 (SMT-535) and wiki is incomplete, for this reason I have seen the next rev (2015) and I follow the README of this github.

When I launch the model identified is ASUS ZenWatch 2 (incorrect)
and the buttons are bad assigned:
Power is doing volume -
Volume - is doing nothing
Volume + is right

This provoke no option could be selected, so... there is a problem with some configuration.

I use the last release of lk2nd-msm8226-appended-dtb.img

0.10.0 not working properly on SM-J5008

on sm-j5008, use [email protected]
fastboot device cannot found
reboot to recovery not work

lk2nd - 0.10.0
PRODUCT_NAME - MSM8916_SECONDARY
MODEL - Unknown (FIXME!)
VARIANT - MTP eMMC
BOOTLOADER VERSION - J5008ZMU1AOH2
PANEL - ss_dsi_panel_S6D7AA0X62_BV050HDM_HD
SERIAL NUMBER - bb2ecae2
DTB - <206 0xce08ff01 0 0x4>

AEM64 - available
EL2 - unavailable
PSCI - unavailable
SECURE BOOT - enabled

[SM-J500M] Future support for this device?

Hey everyone! I have a Galaxy J5 2015 which its model is SM-J500M. As you may have expected it's not on the list of supported devices. My question is, will we see support for more models of the Galaxy J5 2015 in the foreseeable future? And is there a way in which I can contribute? Thank you so much.

kiwi doesn't connect to mobile network

When booting through lk2nd, my huawei-kiwi (Honor 5X, KIW-L21) doesn't connect to the mobile network anymore in my latest LineageOS system ("No service"). Everything is working whenever I boot the device from the stock bootloader.

To illustrate this further, here's my sequence of commands (but of course it is the same result when flashing lk2nd to boot instead of booting it directly):

$ adb reboot bootloader
$ fastboot boot build-msm8916-secondary/lk2nd.img # or an image from the releases download
Downloading 'boot.img'                             OKAY [  0.012s]
booting                                            OKAY [  0.002s]
Finished. Total time: 0.015s
$ fastboot boot ~/boot.img # original LineageOS boot image
Downloading 'boot.img'                             OKAY [  0.969s]
booting                                            OKAY [  0.102s]
Finished. Total time: 1.092s

# phone doesn't connect to mobile network now

$ adb reboot bootloader
$ fastboot boot ~/boot.img
Downloading 'boot.img'                             OKAY [  0.958s]
booting                                            OKAY [  0.017s]
Finished. Total time: 0.986s

# phone now connects to mobile network again

Hoping that it helps, here is an lk_log.txt.

Lenovo A6010 won't boot from ln2nd to recovery.

I am installing PostmarketOS on a Lenovo A6010 specially bought for this purpose. The wiki https://wiki.postmarketos.org/wiki/Lenovo_A6010_(lenovo-a6010) says it has a charging problem: it's recommended to go back into TWRP to charge, because native charger doesn't work. I did everything according to the instructions, successfully flashed lk2nd, installed the system on userdata, everything is fine. But. I can't go into recovery now from lk2nd.

Wiki says:
Fastboot: Power on the device with both Power and Volume Down buttons.

  • it works
    Recovery: Power on the device with Volume Down, Volume Up, and Power buttons.
  • it works
    lk2nd Fastboot: Power on the device. After it vibrates, hold Volume Down.
  • it works
    lk2nd Recovery: Power on the device. After it vibrates, hold Volume Up.
  • does not work, still enters lk2nd.

If you select “Recovery mode” in lk2nd itself, you return to lk2nd.

If you flash the recovery, it flashes successfully. But it still doesn't go in. If you try to make fastboot boot recovery.img from lk2nd, it says

C:\adb_tools>fastboot boot recovery.img
Sending 'boot.img' (24524 KB) OKAY [ 0.766s]
Booting FAILED (remote: 'dtb not found')
fastboot: error: Command failed

In native bootloader this command works fine.

It is possible to enter recovery from native bootloader (to boot into native fastboot, then make fastboot boot recovery.img from native fastboot or using Volume Down, Volume Up, and Power buttons). After that, TWRP is successfully launched. So the problem is with lk2nd. If native bootloader successfully loads recovery, then lk2nd for some reason refuses to do it. Although it loads the PostmarketOS system itself, so I conclude that it is installed normally and copes with the main function.

I use last version of lk2nd, 0.13

Select only exact board-id/msm-id when stock bootloader picks an unexpected dtb

Several manufacturers like Samsung or Motorola use QCDT images for their devices, but did not implement the qcom,msm-id / qcom,board-id properties correctly. In particular, the device information read through SMEM does not match the actual board-id selected by the stock bootloaders. In other words, they patched the dtb selection in the bootloader with some custom, proprietary algorithm.

This is not a problem when booting custom boot images (e.g. with appended DTB), but lk2nd should also be able to boot the downstream kernel (e.g. recovery or the charger). In that case, we should apply the same selection algorithm as used in the stock bootloader.

Reversing that algorithm exactly is difficult. The current solution for this problem is the following:

  1. lk2nd checks the qcom,board-id present in the dtb the stock bootloader has selected.
  2. lk2nd patches the board information read from SMEM so that the DTB selection implemented by Qualcomm would select the same board-id.

static void update_board_id(struct board_id *board_id)
{
uint32_t hw_id = board_id->variant_id & 0xff;
uint32_t hw_subtype = board_id->platform_subtype & 0xff;
uint32_t hlos_subtype = board_id->platform_subtype & 0x700;
uint32_t target_id = board_id->variant_id & 0xffff00;
/* Some Huawei devices seem to use hw_id > 0xff, match entire variant */
if (board_hardware_id() > 0xff)
hw_id = board_id->variant_id;
/* See platform_dt_absolute_match() for the checks made here */
if (board_hardware_id() != hw_id) {
dprintf(INFO, "Updating board hardware id: 0x%x -> 0x%x\n",
board_hardware_id(), hw_id);
board.platform_hw = hw_id;
}
if (board_hardware_subtype() != hw_subtype) {
dprintf(INFO, "Updating board hardware subtype: 0x%x -> 0x%x\n",
board_hardware_subtype(), hw_subtype);
board.platform_subtype = hw_subtype;
}
if ((board_hlos_subtype() & 0x700) != hlos_subtype) {
hlos_subtype |= board_hlos_subtype() & ~0x700;
dprintf(INFO, "Updating board hlos subtype: 0x%x -> 0x%x\n",
board_hlos_subtype(), hlos_subtype);
board.platform_hlos_subtype = hlos_subtype;
}
if (!(target_id <= (board_target_id() & 0xffff00))) {
target_id |= board_target_id() & ~0xffff00;
dprintf(INFO, "Updating board target id: 0x%x -> 0x%x\n",
board_target_id(), target_id);
board.target = target_id;
}
}

This code is kind of weird though and could potentially select incorrect DTBs. This is because the board-ids used by Samsung etc follow some custom scheme and not the hlos_subtype etc. Some important parts of the board-id are masked out and not considered when matching potential DTBs.

Also, currently the code works only for newer platforms using qcom,board-id, but not for MSM8974 which has everything in qcom,msm-id.

I think it would be easier if we would override the DTB selection algorithm instead to select exactly the correct board-id, without going through all this masking etc. Together with that, support for qcom,msm-id could also be added.

[SM-A300FU] LineageOS 17 stuck on splash screen when booted by lk2nd

Here's what I did on my Galaxy A3 2015:

  • I installed TWRP on the recovery partition with Heimdall
  • I installed LineageOS 17.1 which, by itself, booted just fine.
  • With Heimdall, I flashed lk2nd to the boot partition
  • postmarketOS now boots fine from an SD Card, obviously LineageOS does not boot at this point
  • I flashed the LineageOS boot partition in lk2nd with fastboot flash boot boot.img

Now pmOS still boots fine, but when I take out the SD Card, LineageOS first appears to boot, but it gets stuck on its boot logo / animation forever. Flashing its own boot partition in place of lk2nd using Heimdall makes it work again.

I wanted to set up dual boot so that I could boot LineageOS from the internal storage with no SD Card, or insert an SD Card to boot postmarketOS. But right now I have to re-flash the boot partition with either lk2nd or the LOS boot every time I want to switch operating systems.

Add some documentation for fastboot commands / fs-boot / ...

Some initial work is in https://github.com/msm8916-mainline/lk2nd/tree/docs

Temporary documentation of some fs-boot stuff:

  • ext2 boot partition on eMMC system/userdata/cache (sub-partitions like pmOS possible)
  • lk2nd loads /boot/boot.img* (perhaps just /boot/boot.img in the future)
  • Magic file /boot/lk2nd_skip makes lk2nd skip the boot partition
  • Magic file /boot/lk2nd_rproc_mode with content none|no-modem|all makes lk2nd disable certain remoteprocs in mainline DTBs, including reserved memory to save RAM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.