Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: MSM DRM/KMS Driver For Snapdragon Progresses

  1. #11
    Join Date
    Oct 2009
    Posts
    2,061

    Default

    Alright, don't be expecting too much out of that feature... the new story is that qualcomm refuses to provide the sbl binaries necessary to actually use it.

    The good news is that they will be looking into (within the next few days) the option of building a boot.img that pulls a kernel off the sdcard.

  2. #12
    Join Date
    Oct 2009
    Posts
    2,061

    Default

    I dd'd the eMMC to the sdcard, and it does boot off the sdcard. I don't know how far it boots on the sdcard until it switches over to emmc, but definitely something happens. I'm hoping that it switches over during or after aboot.

    Edit... damned thing switches over *before* aboot.
    Its sbl1. It boots up to sbl1 on the sdcard, then switches over to emmc.
    Last edited by droidhacker; 07-23-2013 at 03:55 PM.

  3. #13
    Join Date
    Sep 2011
    Posts
    218

    Default

    Quote Originally Posted by droidhacker View Post
    Huh, seems that littlekernel/aboot (mmcblk0p5) is open source and builds along with CAF.
    yeah.. although I think some of the early partitions have some firmware and/or trustzone/securemonitor code, which is not open.

    But, I think if you leave all the partitions that preceed the boot partition, that should be safe. Sadly, trying to use gparted to resize/recreate boot partition confuses the bootloader. Somehow it isn't writing the partition table in the way that the bootloader expects. Otherwise it would be really easy ;-)

  4. #14
    Join Date
    Sep 2011
    Posts
    218

    Default

    Quote Originally Posted by droidhacker View Post
    I dd'd the eMMC to the sdcard, and it does boot off the sdcard. I don't know how far it boots on the sdcard until it switches over to emmc, but definitely something happens. I'm hoping that it switches over during or after aboot.

    Edit... damned thing switches over *before* aboot.
    Its sbl1. It boots up to sbl1 on the sdcard, then switches over to emmc.
    fwiw, one of the codeaurora guys on ##linux-msm thought that the bootloader (I think he was referring to lk) was a bit hard-coded to use eMMC. So probably the hw supports various different boot devices for the boot-rom loading the 1st stage bootloader, but then the 1st stage needs to do something other than be hard coded to load kernel/initrd off eMMC ;-)

    At least that is my understanding of the situation, but I don't claim to be expert at the msm boot architecture.

  5. #15
    Join Date
    Oct 2009
    Posts
    2,061

    Default

    Quote Originally Posted by robclark View Post
    fwiw, one of the codeaurora guys on ##linux-msm thought that the bootloader (I think he was referring to lk) was a bit hard-coded to use eMMC. So probably the hw supports various different boot devices for the boot-rom loading the 1st stage bootloader, but then the 1st stage needs to do something other than be hard coded to load kernel/initrd off eMMC ;-)

    At least that is my understanding of the situation, but I don't claim to be expert at the msm boot architecture.
    Right, its a secure chain up to and including sbl3 (aboot/lk should be free of the secure nonsense), so we can't even hexedit the bootloaders to do anything different. I'm going to wait and see what IFC comes up with, if nothing, then I'm going to try chainloading another aboot in place of the kernel. If that goes well, I'll see about a custom aboot to try hitting up the sdcard first, and then falling back to emmc.
    Last edited by droidhacker; 07-23-2013 at 10:42 PM.

  6. #16
    Join Date
    Oct 2009
    Posts
    2,061

    Default

    The bootup goes PBL (that's on the 24C128 eeprom U2 between the SoC and the expansion header), then SBL1, SBL2, SBL3, and then finally LK (on the "aboot" partition), which loads the kernel. LK is the first stage in the bootup that is NOT protected by the secure/trust nonsense.

    This morning I received confirmation from IFC that the LK images built with CAF Android are actually viable, and it should be possible (but obviously dangerous) to write these to the aboot partition and end up with a working system.

    Now the deal with the switches, is that they say where (eMMC or uSD) to look for SBL1. SBL1 is definitely coded to at least *prefer* to find SBL2 on the eMMC. It may or may not revert to uSD if it is unable to find it on eMMC -- I can't find any confirmation of this, and unfortunately, the only way to test this would be to wipe the eMMC -- which I'm definitely not willing to try.

    The good news is that LK is flexible. It is definitely capable of pulling a kernel from uSD. I'm still obviously learning LK, but there are indications that it may even fall back to uSD under certain conditions; check out lk/target/msm8960/init.c:

    Code:
    static unsigned mmc_sdc_base[] =
        { MSM_SDC1_BASE, MSM_SDC2_BASE, MSM_SDC3_BASE, MSM_SDC4_BASE };
    And then later;
    Code:
    	/* Trying Slot 1 first */
    	slot = 1;
    	base_addr = mmc_sdc_base[slot - 1];
    	if (mmc_boot_main(slot, base_addr)) {
    		/* Trying Slot 3 next */
    		slot = 3;
    		base_addr = mmc_sdc_base[slot - 1];
    		if (mmc_boot_main(slot, base_addr)) {
    			dprintf(CRITICAL, "mmc init failed!");
    			ASSERT(0);
    		}
    	}
    SDC1 is the eMMC.
    SDC2 is not connected.
    SDC3 is the uSD card.
    SDC4 is ... wifi.

    So what I'm doing now is trying to determine what conditions would be required to convince LK to pull the kernel from the sdcard, and what needs to be done to have it find it. It might be something as simple as having a gpt partition named "boot" on the sdcard while the boot partition on the eMMC is blank.

  7. #17
    Join Date
    Sep 2011
    Posts
    218

    Default

    Quote Originally Posted by droidhacker View Post
    The bootup goes PBL (that's on the 24C128 eeprom U2 between the SoC and the expansion header), then SBL1, SBL2, SBL3, and then finally LK (on the "aboot" partition), which loads the kernel. LK is the first stage in the bootup that is NOT protected by the secure/trust nonsense.

    This morning I received confirmation from IFC that the LK images built with CAF Android are actually viable, and it should be possible (but obviously dangerous) to write these to the aboot partition and end up with a working system.

    Now the deal with the switches, is that they say where (eMMC or uSD) to look for SBL1. SBL1 is definitely coded to at least *prefer* to find SBL2 on the eMMC. It may or may not revert to uSD if it is unable to find it on eMMC -- I can't find any confirmation of this, and unfortunately, the only way to test this would be to wipe the eMMC -- which I'm definitely not willing to try.

    The good news is that LK is flexible. It is definitely capable of pulling a kernel from uSD. I'm still obviously learning LK, but there are indications that it may even fall back to uSD under certain conditions; check out lk/target/msm8960/init.c:

    Code:
    static unsigned mmc_sdc_base[] =
        { MSM_SDC1_BASE, MSM_SDC2_BASE, MSM_SDC3_BASE, MSM_SDC4_BASE };
    And then later;
    Code:
    	/* Trying Slot 1 first */
    	slot = 1;
    	base_addr = mmc_sdc_base[slot - 1];
    	if (mmc_boot_main(slot, base_addr)) {
    		/* Trying Slot 3 next */
    		slot = 3;
    		base_addr = mmc_sdc_base[slot - 1];
    		if (mmc_boot_main(slot, base_addr)) {
    			dprintf(CRITICAL, "mmc init failed!");
    			ASSERT(0);
    		}
    	}
    SDC1 is the eMMC.
    SDC2 is not connected.
    SDC3 is the uSD card.
    SDC4 is ... wifi.

    So what I'm doing now is trying to determine what conditions would be required to convince LK to pull the kernel from the sdcard, and what needs to be done to have it find it. It might be something as simple as having a gpt partition named "boot" on the sdcard while the boot partition on the eMMC is blank.
    cool.. keep me posted. Fwiw, 8960 is a different (older) device, compared to apq8064. (But I admit to being pretty confused by their part numbering :-P)

    my main goal at the end is really just to pull kernel+initrd off a larger partition on eMMC. For filesystem, I use SATA or USB drive anyways, as that seems to perform better for doing things like recompiling stuff (like mesa), and generally be better for desktop linux filesys.

  8. #18
    Join Date
    Oct 2009
    Posts
    2,061

    Default

    Quote Originally Posted by robclark View Post
    cool.. keep me posted. Fwiw, 8960 is a different (older) device, compared to apq8064. (But I admit to being pretty confused by their part numbering :-P)

    my main goal at the end is really just to pull kernel+initrd off a larger partition on eMMC. For filesystem, I use SATA or USB drive anyways, as that seems to perform better for doing things like recompiling stuff (like mesa), and generally be better for desktop linux filesys.
    Older? Yes and no. Older in the sense that the code was written for msm8960 "in hand", so a lot of the file names got stuck with 8960 even though they apply to both (and then some). Mainly it is just a different device. Its distinguished by having only 2 cores, Adreno 225, plus cellular connectivity (which APQ lacks).

    My phone's SoC has another name again, its an 8260A (very very different from an 8260), which is basically an 8960 without LTE/CDMA. It too uses files for 8960.

    When you said "Sadly, trying to use gparted to resize/recreate boot partition confuses the bootloader. Somehow it isn't writing the partition table in the way that the bootloader expects. Otherwise it would be really easy ;-)", what kind of changes did you make to the partition table? The reason I ask, is that SBL2 calls code in the TZ partition, which is positioned AFTER the boot partition. If SBL2 has a hard coded offset, it may not be able to find TZ.


  9. #19
    Join Date
    Oct 2009
    Posts
    2,061

    Default

    I think I understand it now.

    What it does, is it goes through all the partitions on the eMMC, and then all the partitions on the uSD card, and adds them and their details (including names) into an array called "partition_entries".

    Later on, it runs the aboot application, starting with aboot_init, which calls boot_linux_from_mmc().
    Now THAT function does this;

    Code:
    	if (!boot_into_recovery) {
    		index = partition_get_index("boot");
    		ptn = partition_get_offset(index);
    		if(ptn == 0) {
    			dprintf(CRITICAL, "ERROR: No boot partition found\n");
                        return -1;
    		}
    	}
    That partition_get_index goes through the array of partitions sequentially looking for the label "boot". Since the eMMC was scanned before the uSD, its boot partition will come out first and that is the one it will favor.

    Obviously for us, we would prefer it to scan the uSD first, and if it finds a boot partition there, use it, otherwise fall back to eMMC.


    I believe, that renaming the boot partition on the eMMC to... anything else, would allow you to boot from an sdcard with a GPT partition named "boot". For a bit of added flexibility, renaming it to "recovery" should boot normally from the eMMC when header pin25 is held low (because it will boot from the *first* partition named "recovery").
    Last edited by droidhacker; 07-24-2013 at 01:40 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •