Motorola Droid 4 - Debian
In the last post I rooted the Droid 4 and installed LineageOS with SafeStrap as bootloader. Today I took care of getting the mainline kernel running and preparing a rootfs.
After some communication with Tony I got the kexec stuff running (at the end the problem was my compiler generating binaries not suitable for Android). Instead of getting a compiler toolchain for Android I decided to rewrite the binary into a shellscript, so that no compiler is required. The C-code was mostly calling binaries anyways. The result can be seen in the following commit:
Use shell-script for kexec-wrap
With that change the ddroid Makefile generates images, which can be booted on my phone. Next step: Get a rootfs to keep the kernel happy.
[PC] $ apt install cdebootstrap [PC] $ mkdir ./debian-rootfs [PC] $ sudo cdebootstrap --foreign --include=firmware-ti-connectivity,wpasupplicant,tmux,vim,zsh,htop,openssh-server,openssh-client --arch=armhf testing ./debian-rootfs ... [PC] $ sudo tar -C debian-rootfs -czf debian-rootfs.tgz . [PC] $ sudo rm -rf ./debian-rootfs
With the rootfs tarball ready, lets install it on the device. For that task I booted LineageOS, enabled the adb stuff and connected from PC:
[PC] $ mkpasswd -m sha-512 "<password>" -S "<salt>" [PC] $ mkpasswd -m sha-512 "" -S "00000000" $6$00000000$xhcjnloTbvLFvT.Gbn2bPqS5EDW2Wn7x6jEt.dEihnw/ocXZRu/R732RzeA1x52U50VecumRYc/HbIPWIHTZD. [PC] $ adb push debian-rootfs.tgz /sdcard/ [PC] $ adb shell [D4] $ su [D4] # mke2fs -t ext4 /dev/block/mmcblk1p23 [D4] # mkdir /mnt/debian [D4] # mount /dev/block/mmcblk1p23 /mnt/debian [D4] # tar -C /mnt/debian -xzf /sdcard/debian-rootfs.tgz [D4] # sed -i 's~root:\*:~root:$6$00000000$xhcjnloTbvLFvT.Gbn2bPqS5EDW2Wn7x6jEt.dEihnw/ocXZRu/R732RzeA1x52U50VecumRYc/HbIPWIHTZD.:~g' /mnt/debian/etc/shadow [D4] # rm /sdcard/debian-rootfs.tgz [D4] # umount /mnt/debian [D4] # rmdir /mnt/debian [D4] # ^D [D4] $ ^D [PC] $ sudo rm debian-rootfs.tgz
DONE. Now we can adb reboot
,
switch to our mainline entry in SafeStrap, attach
the UART adapter and see Debian booting.
If the kernel is built CONFIG_WLCORE_SDIO=y and no initramfs with wireless firmare is supplied, the wlan interface is not functional. This can be fixed by executing the following two lines after rootfs with FW is available.
echo “mmc2:0001:2” > /sys/bus/sdio/drivers/wl1271_sdio/unbind echo “mmc2:0001:2” > /sys/bus/sdio/drivers_probe