Skip to content
This repository has been archived by the owner. It is now read-only.

Passing a boot.img to Motorola Droid 4 with safestrap #1275

ollieparanoid opened this issue Feb 28, 2018 · 8 comments

Passing a boot.img to Motorola Droid 4 with safestrap #1275

ollieparanoid opened this issue Feb 28, 2018 · 8 comments


Copy link

@ollieparanoid ollieparanoid commented Feb 28, 2018

@MartijnBraam wrote:

The current issue with the droid 4 is that I have no idea how to make it boot another initfs/kernel, it seems like the safestrap bootloader can very easily swap out the system and data partition but can't find anything about boot.img

@sre: Could you please tell us how to pass a kernel and initramfs (or alternatively boot.img file which has both) to the Droid 4 with safestrap?

CC: @NotKit

Copy link

@sre sre commented Feb 28, 2018

Assuming, that you are using Tony's ddroid repository as a starting point, you need to modify the kexec parameters in system/etc/kexec/kexec, line 36.

Copy link

@MerlijnWajer MerlijnWajer commented Feb 28, 2018

This might also be of help (we use arm-sdk when building maemo-leste images):

You just need to add the initramfs and modify the params, as suggested.

Copy link
Member Author

@ollieparanoid ollieparanoid commented Mar 5, 2018

Thanks for the pointers guys, that's very helpful!

Alright, so @NotKit, @MartijnBraam, @V13Axel and I were discussing the other day how to properly integrate this into postmarketOS. (They have a Droid 4, I do not, but I want to help with getting pmOS booting on it).

I think the easiest way is using safestrap (vs. kexecboot etc.), as that is what Maemo Leste is also using right now (so it's easy to switch between both for people who want to contribute/test something in both projects).

For reference:

This is how I would approach it:

  1. Proof of concept
  • Start with @NotKit's PR in #1039, rebase it to master
  • Do the usual installation with pmbootstrap install
  • Run pmbootstrap export to export the system image, kernel and initramfs
  • Manually generate a safestrap zip file based on the links above from the kernel and initramfs (please document this step by step in the wiki page)
  • Copy everything to the SD card
  • Add it to safestrap (via clicking through the UI, please document this as well, ideally with photos)
  • Boot it. The initramfs hook that @NotKit already wrote (part of the PR) should mount the postmarketOS image and let the initramfs code find all partitions as usually from what I understand.
  • When this works and it is all documented, I recommend to merge the Droid 4 PR.
  1. Integrate it properly
  • build everything needed for the safestrap zip file from source (we want to do it properly, after all)
  • add a new deviceinfo variable generate_safestrap_zip
  • when that is set, at the end of our mkinitfs script, generate the zip file (in the place where we optionally generate a boot.img file)
  • add the safestrap zip file to pmbootstrap export
  • make a PR with all changes
  • update documentation in the wiki

What do you think, everyone?

@V13Axel: You wrote something along the lines that you'd love to bring pmOS on your Droid 4, but you were missing the instructions - do you want to give this a shot? We'll help you wherever you get stuck!

@tmlind: I know you recommended droid4-kexecboot over in #1039 (comment). Maybe we could support that as well once we have safestrap working, if you're interested in helping us to integrate and testing it.

Copy link

@MartijnBraam MartijnBraam commented Mar 5, 2018

As far as I can see we can both support kexecboot and safestrap at the same time, for kexecboot we only need a config file in /boot and put it on the SD card. It works mostly like the n900 boot process. The downside is that it requires some extra flashing steps to get droid4-kexecboot on the device.

I think kexecboot is neater if you want to run from SD and safestrap is neater if you want to run from internal storage as dual boot.

Copy link

@tmlind tmlind commented Mar 18, 2018

Good to see this merged :) Yeah as long we don't add limitations to booting mainline kernels we should support both options. And by limitations I mean there should be no need for hardcoded kernel cmdline, reading options from a VFAT partition for mounting file systems etc. But I guess that's all sorted out by now for most part by NotKit :)

@ollieparanoid: I have my hands full with mainline kernel related issues, so I doubt I can help much beyond my daily average fun tinkering quota of about 30 mins per day of carrying pine needles to the mainline kernel antpile.. But yeah droid4-kexecboot should just work the way standard Linux bootloaders work as MartijnBraam described above.

@MartijnBraam: I think I've pretty much figured out how to make droid4-kexecboot also support pivot_root to the stock kernel (and SafeStrap), we just need to start kexecboot as init process from /sbin/ wrapper script. Need a bit more time on that one though.

Copy link

@pavelmachek pavelmachek commented Mar 20, 2018

For the record, I'd really like to get a safestrap image. I'm fighting with Droid 4 (not) booting for 3 days now :-(. I tried the instructions on but they did not work for me (and they seem pretty dangerous as they overwrite kernel image used by Cyanogen). Thanks for maemo-leste pointer; it should be useful for bootloader debugging.

Copy link

@NotKit NotKit commented Mar 20, 2018

@pavelmachek Did you try installing with --no-fde and connecting to device via USB network? Display won't output anything without a tool to activate framebuffer (discussed in pull request #1039).

Copy link

@tmlind tmlind commented Mar 24, 2018

FYI, I pushed out droid4-kexecboot image last night that now also supports booting to the stock Android distro and SafeStrap. And enables the debug UART as needed and sets default root password based on the SoC die ID.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants