Open lehmanju opened 8 months ago
After doing grub-install, you change the values of /dev/block/sdaXY to /dev/sdaXY from the generated grub.cfg (using grub-mkconfig). It should be enough to just flash the UEFI image without Secure Boot support from the Windows guide. Just keep in mind you have to mount your "esp" in /boot/efi and {proc, sys, dev} in their respective folders inside your rootfs. You also might have to set your PATH variable accordingly.
What Windows Install Guide? Does the native Android bootloader support efi? I thought I had to flash/boot a custom boot.img to load Linux.
What Windows Install Guide? Does the native Android bootloader support efi? I thought I had to flash/boot a custom boot.img to load Linux.
Here is uefi without secure boot https://github.com/erdilS/Port-Windows-11-Xiaomi-Pad-5/releases/download/UEFI/uefi-NoSecureboot-v3.img xbl that we have on sm8150 platform is edk2 based uefi bootloader, it then starts LinuxLoader.efi app from abl, and this app can only boot android's boot.img, so we need to chainload our own uefi to boot any other efi apps like grub or bootmgfw
For booting linux you can also use boot.img with mainline kernel instead of grub, read here for more details https://xdaforums.com/t/rom-ubuntu-on-xiaomi-pad-5-nabu.4597149/
Thank you for taking the time to answer.
I have done the following now:
fastboot flash boot uefi-NoSecureboot-v3.img
. This booted a bootloader with Windows logo.Unfortunately it doesn't boot. The flash drive is connected by usb-c hub to the tablet but shows no activity. I thought that the windows bootloader supports USB.
For further development I thought about getting a cheap usb-c docking station with USB hub, ethernet and power delivery.
In this UEFI(xiaomi-nabu_NoSB_USB0Host.zip), USB should work, but only with powered USB hub.
Refind boots, then successfully loads Linux before it panics.
You need to use dtb from mainline kernel, ACPI won't work, because qcom drivers in linux have really bad ACPI support.
Thanks, that did indeed work. I copied the kernel and dtb to esp and created an entry. The kernel booted with ACPI disabled. The kernel log appeared for half a second and then the screen went black, no response.
Use 6.7 kernel from here https://github.com/map220v/ubuntu-xiaomi-nabu/actions/runs/8209541902 it uses kernel from Jan 16 2024 that doesn't have test fix for dsi suspend/resume, but dsi will work in it.
Now I am hooked! I want to get the console/crash logs for the 6.8 kernel. In sm8150.config pstore
is enabled, tried getting kernel logs through that with no success. My guess is that PSTORE_BLK
is missing.
My cmdline: root=PARTLABEL=linux dtb=dtb-.0-sm8150 rw pstore_blk.blkdev=PARTUUID=cb7fa315-59c3-4195-b47b-6a0138ab9b27 pstore_blk.kmsg_size=128 pstore_blk.pmsg_size=128 pstore_blk.console_size=128 pstore_blk.ftrace_size=128 printk.always_kmsg_dump=1
Yes, PSTORE_BLK isn't enabled. In this kernel pstore only setted up to save kernel logs in special DDR region at address 0xb0001000-0xb0201000 In android recovery you can check /sys/fs/pstore/console-ramoops* but only if pstore header didn't got corrupted.
Thanks for the hint. I managed to get a log from pmsg-ramoops-0. console-ramoops was only garbage. I also compiled the kernel with PSTORE_BLK but that didn't work. As it turns out, the kernel still doesn't find my USB thumb drive.
My USB hub is not correctly configured. That's why the drive isn't found. I am not sure which driver is missing, maybe I should wait until I receive a proper development docking station instead of using my Lenovo Notebook docking station for this :laughing:
Apparently the dtb is not loaded: Unknown kernel command line parameters "dtb=/dtb-6.8.0-sm8150", will be passed to user space.
But EFI_ARMSTUB_DTB_LOADER is enabled, it should recognize the dtb option. I also used the uncompressed image which should support efi.
Is there an alternative to the Windows efi bootloader? I would really like to switch between boot_a/b and poweroff the device via onscreen selection. Edk2-porting/edk2-msm seems to provide such interface. Does it work with nabu?
Yes Edk2 work fine, more or less.
Now it's working: -Boot android/Linux/windows option it's working -If you like to change slot, at the moment need: Press first option reboot to android, when Babu are rebooting, press up vol to access TWRP and change slot inside TWRP. -Put nabu in USB shci mode, works, but need hard reset nabu when you unmount partitons
-Secure boot Not working.
All credits to @map220v, I only compiled with latests changes.
-You can use boot.img to test if working for you. Please not flash it, only use fastboot boot boot.img
-If you like flash it, reboot to recovery and sideload installer-nabu.img. adb sideload installer-nabu.zip
Ed2k is outdated, I try update with latests changes of map220v.
You can download beta versions here: Post in thread '[ROM]Ubuntu on Xiaomi Pad 5 (nabu)' https://xdaforums.com/t/rom-ubuntu-on-xiaomi-pad-5-nabu.4597149/post-89411357
@map220v Any option to boot grub in secure mode? I like to try if it posible boot uefi secure-boot -> grub -> windows. To disable test mode drivers in windows. I try to compile simple-init.efi and attach in esp partition, when I try to load I have a bootloop issue "syncronization error" in your V2 and V3 versions. I try it secure boot V2 and V3 -> load shim.signed (with Microsoft CA certs) but not work. Your V3 secure boot sources are in https://github.com/map220v/MU-sm8150pkg?
I try to remap vol down button to change slot in uefi like mu-uefi for pipa work
Do you think el2 mode in nabu it's possible? For example with slbounce I see this: https://github.com/TravMurav/Qcom-Secure-Launch
I try your latest images and when create linux-image.debs the numbers of versions are missing. I think issue in this line cp arch/arm64/boot/Image.gz ../linux-xiaomi-nabu/boot/vmlinuz-$2.0-sm8150
Maybe like this can fix it: https://github.com/LesGaR/ubuntu-xiaomi-nabu/commit/3225221d78ca0b5240b81b3c80ccbad06ac9d9d4
U-boot can boot with el2 mode and secure-boot enabled? I have a old ed2k uefi image can boot USB directly without USB powered hub. I was used to install windows on nabu
Yes, u-boot supports efi, secure boot and can use different exception levels. All relatively new features, but u-boot has good documentation.
@map220v Any option to boot grub in secure mode? I like to try if it posible boot uefi secure-boot -> grub -> windows. To disable test mode drivers in windows. I try to compile simple-init.efi and attach in esp partition, when I try to load I have a bootloop issue "syncronization error" in your V2 and V3 versions. I try it secure boot V2 and V3 -> load shim.signed (with Microsoft CA certs) but not work. Your V3 secure boot sources are in https://github.com/map220v/MU-sm8150pkg?
I try to remap vol down button to change slot in uefi like mu-uefi for pipa work
Do you think el2 mode in nabu it's possible? For example with slbounce I see this: https://github.com/TravMurav/Qcom-Secure-Launch
I try your latest images and when create linux-image.debs the numbers of versions are missing. I think issue in this line cp arch/arm64/boot/Image.gz ../linux-xiaomi-nabu/boot/vmlinuz-$2.0-sm8150
Maybe like this can fix it: LesGaR@3225221
To boot grub with secure boot you need to sign grub and add your certificate to db.bin.p7 in UEFI sources.
EL2 is impossible without stealing private xiaomi root cert or exploiting hypervisor(or even better trustzone), slbounce just like winload.efi requires Secure Launch to be enabled in devcfg and you must have mssecapp trustzone app, both of them must be signed with xiaomi's root cert which sha384 hash is stored in qfprom in cpu.
There is activity on moving u-boot support forward btw: https://social.treehouse.systems/@cas/112248312256277895 I'll wait for the patches to land in U-Boot mainline before continuing. Especially USB console support is necessary in my opinion.
Has been a while, but I managed to port u-boot to nabu and it works quite well. especially being able to directly access ramoops dumps, efi booting, booting from usb and overall a lot of customizability. patches are on the list but not merged yet. and my goal is to have simultaneos usb console and usb mass storage. that would let me copy/paste a new kernel to efi and then boot it, read logs on crash. then mainlining is next ...
Has been a while, but I managed to port u-boot to nabu and it works quite well. especially being able to directly access ramoops dumps, efi booting, booting from usb and overall a lot of customizability. patches are on the list but not merged yet. and my goal is to have simultaneos usb console and usb mass storage. that would let me copy/paste a new kernel to efi and then boot it, read logs on crash. then mainlining is next ...
That's really nice!, do you have a repo where can i peek?
@lehmanju thank you so much!, this will be very useful for my postmarketOS uefi build :D
@Blakyrin you can join #u-boot-qcom:libera.chat or just #u-boot:libera.chat. internal filesystem patches (ufs) are not merged yet, so efi booting wouldn't work right now. my goal is then to use u-boot's fastboot capabilites to boot custom kernel builds and use fastboot oem u-boot commands to readout ramoops messages. still have to test it but eventually want to write some doc for others to use it.
@lehmanju that's great!, that would make mainlining easier, if you happen to have a matrix room for nabu or sdm860 that would be great
@Blakyrin i think #sm8150-mainline:matrix.org is the room you are looking for
I would like to help with getting proper mainline Linux support for this device but I am a bit lost to get started.
From the Readme, I understand the following:
For grub-install I could boot a recovery, connect the flash drive by usb-c hub and chroot into rootfs.
But how do I boot the system then?