- 
                Notifications
    
You must be signed in to change notification settings  - Fork 411
 
          fix Moto sanders DTB
          #560
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
  
    fix Moto sanders DTB
  
  #560
              
            Conversation
ede6b8b    to
    7d94961      
    Compare
  
    9fba757    to
    20c6ebb      
    Compare
  
    sanders DTB
      | 
           This PR is complete (in my opinion)  | 
    
| 
           Can you separate the new features into a separate PR so that there is only the actual fix for #559 in this PR? I appreciate the work you did to enable booting downstream boot images, but I'm afraid I'm not entirely sure yet if we can accept that change. Generally, booting downstream with lk2nd is only supported on a "least effort" basis. It's good if it works, but the problem is that there are tons of subtly incompatible vendor modifications to the boot image, DTB selection or QCDT format and it would be an extreme effort to support all of those. With the 150+ devices we support nowadays, there is also a significant risk that implementing the modifications of one vendor breaks booting on the devices from another vendor. In this case for example I'm concerned that changing the  What is the use case you have in mind for these changes? How often would one really boot downstream with lk2nd on these devices?  | 
    
          
 True, but. 
 About splitting  
 Adding lz4 increases the size of the final binary for everyone, and a non-significant amount of people actually needs this. But I'm not sure that we know about all instances where adding lz4 would actually resolve a problem that somebody had. So, I think that adding lz4 have still more advantages than disadvantages. Also, I didn't add a specific commit of lz4, but just tag 1.10.0 which can be observed in  Lines 131 to 133 in 20c6ebb 
 
 It's very useful to have "dual boot" with lk2nd, because we can have stock kernel in phone, and WIP mainline from sdcard. Which allows anybody to still have a working phone while working on mainline kernel to support said phone. (Not only mainline, maybe some custom kernel from stock, IDK, I just provided an example that relevant to me) 
 If you really-really want only this change, just cherry-pick d2d0b98 commit into main, this will also automatically close the issue. But please reconsider.  | 
    
          
 That is true, but the problem I meant was that there are multiple vendors who modified this structure differently. I'm pretty sure we've had some weird QCDT table from OPPO before that we decided against supporting. If we start adding all sorts of different formats it will become really difficult to maintain (as in: required effort, but also making sure none of the many vendor-specific modifications break when making changes). As it stands, lk2nd wouldn't integrate perfectly into such a setup anyway. You would need to flash the downstream boot image manually on each update (since the OTA process won't respect the lk2nd offset). While doing that, couldn't you also repack the downstream image to fit the expectations of lk2nd better? If you decompress the LZ4 QCDT, we could already drop that extra dependency. That would be easy to do with a simple script. The  You could probably also drop the extra field from the  More generally: I'm not opposed to add a couple of simple and straightforward lines to improve booting behavior where possible, but it needs to be as minimal as possible. lk2nd is already extremely complex to maintain with so many supported devices, I'm afraid we don't have the capacity to maintain larger amounts of device or vendor-specific code. I wish this was different, but that's unfortunately how it is today.  | 
    
          
 I've had an idea of instead of changing  
 Actually, I wish I knew how to utilize that functionality, I couldn't find any example or anything that will explain how and with what  
 I could repack it in the way that will not require lz4 dependency in lk2nd, but QCDT structure will still be  
 You mean changing QCDT structure itself in  
 Yeah, I wanted to completely rewrite it someday in Zig, and I gave up on 1%.  | 
    
          
 Yeah it's pretty unobvious, but it's filled by  lk2nd/platform/msm_shared/dev_tree.c Lines 2479 to 2496 in 0cf7784 
 Basically that thing goes through the parsing/matching sequence for a  lk2nd/lk2nd/device/dts/msm8916/msm8916-samsung.dts Lines 32 to 33 in 0cf7784 
 The reason why it won't work for you is that you have multiple qcom,board-id entries in the sanders DT, so it doesn't know which one to use. You would need to expose  
 Right. I would probably prepare some simple Python script to do this. lk2nd has a script for replacing the kernel inside an Android boot image for example: https://github.com/msm8916-mainline/lk2nd/blob/main/lk2nd/scripts/patch-boot-img.py Also, in a different repository we have a script to unpack QCDT images: https://github.com/msm8916-mainline/linux-mdss-dsi-panel-driver-generator/blob/master/tools/unpackqcdt.py Should be easy to modify this to unpack the Motorola-extended format and then produce the standard format instead.  | 
    
          
 Will splitting dts into 6 different versions help? Also, I'll look into writing a Python code to patch moto dt, but where should I put it, make it a part of   | 
    
          
 patch-boot-img.py is intended for lk2nd testing, so not really meant for your purpose. I guess a gist with the script and some instructions would be helpful. 
 That would work, yes. In this specific case I do wonder if anyone actually has p1/p2/p3. Sounds a bit like preproduction versions that were never sold.  | 
    
| 
           @stephan-gh That's better?  | 
    
sanders DTBsanders DTB
      | 
           Other motos are not splitted by revisions maybe it is also not necessary for sanders.  | 
    
          
 It's necessary for a stock boot.img, for non-stock it doesn't matter.  | 
    
| 
           As lk2nd overriding feature only works with dts where and/or  lk2nd/platform/msm_shared/dev_tree.c Lines 970 to 974 in 0cf7784 
 And overriding feature is required for stock boot.img to boot successfully. Overriding feature requires complete rewrite to be able to handle overriding without splitting dtb's.  | 
    
| 
           It seems   | 
    



Closes: #559
boot.imgof Motorola G5s Plus (sanders) have:qcom,board-idvalueslk2nd, by splitting dts into separate dt'ssanders) (this closes Moto G5s Plus (msm8953) fails to boot with lk2nd – "Error: failed to load kernel" #559)