hansemro / kc1-linux

Documentation of mainline Linux on First Generation Kindle Fire
GNU General Public License v2.0
4 stars 0 forks source link

Add postmarketOS port and documentation #39

Open hansemro opened 3 years ago

hansemro commented 3 years ago

postmarketOS merge request: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/2202 postmarketOS device wiki page: https://wiki.postmarketos.org/wiki/Amazon_Kindle_Fire_(amazon-otter)

Tasks/Status:

hansemro commented 3 years ago

I am going to take a page out of the port for Nokia N900 and use a u-boot script to handle booting.

Nokia N900 pmaport Relevant u-boot commit: https://github.com/hansemro/kf_u-boot/commit/71d35315074f7a27e02bed5dbcc316a7ba54aacc

So we can have a bootscript (uboot-script.cmd) like this:

setenv mmcnum 1
setenv mmcpart 9
setenv mmctype ext4
setenv dtbootargs init=/init.sh rw console=tty0 console=tty02 PMOS_NO_OUTPUT_REDIRECT PMOS_FORCE_PARTITION_RESIZE
echo Loading initramfs
load mmc ${mmcnum}:${mmcpart} 0x81000000 /boot/initramfs-amazon-otter
echo Loading kernel
load mmc ${mmcnum}:${mmcpart} 0x80008000 /boot/zImage-amazon-otter
echo Loading fdt
load mmc ${mmcnum}:${mmcpart} 0x82000000 /boot/omap4-kc1.dtb
echo Booting kernel
bootz 0x80008000 0x81000000 0x82000000

and generate boot.scr with the following command:

mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n postmarketos -d "$srcdir"/uboot-script.cmd "$srcdir"/boot.scr

However, I will need to make some adjustments to support split-off boot partition from root since postmarketOS insists on it to support full disk encryption.

Since I am not using an initramfs, I am using a version of the boot script without loading initramfs. So far, it works pretty well.

hansemro commented 3 years ago

With this and upcoming changes to linux/device package scripts, I can load the pmbootstrap-built kernel and initramfs.

uboot-script.cmd

setenv dtbootargs init=/init.sh rw root=/dev/mmcblk0p9 console=tty0 console=tty02 PMOS_NO_OUTPUT_REDIRECT PMOS_FORCE_PARTITION_RESIZE
echo Loading initramfs
load mmc 1:9 0x82000000 /boot/uInitrd-amazon-otter
echo Loading kernel
load mmc 1:9 0x80008000 /boot/vmlinuz-5.12.0
echo Loading fdt
load mmc 1:9 0x84000000 /boot/omap4-kc1.dtb
echo Booting kernel
bootz 0x80008000 0x82000000 0x84000000
#!/usr/bin/env sh
mkimage -n 'Ramdisk Image'  -A arm -O linux -T ramdisk -C gzip -d /boot/initramfs-amazon-otter /boot/uInitrd-amazon-otter
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n postmarketos -d /boot/uboot-script.cmd /boot/boot.scr

Initramfs does get stuck because I am not following postmarketOS partitioning guidelines. I will edit the initramfs and try again later.

image

image

hansemro commented 3 years ago

I made some progress with postmarketOS and created a pmaports merge request (https://gitlab.com/postmarketOS/pmaports/-/merge_requests/2202).