batocera-linux/batocera.linux

Support boot from NTFS

Closed this issue · 9 comments

Batocera build version

2024/08/01

Your architecture

x86_64

Your Graphic Processor Unit(s) (GPU)

AMD Radeon(TM) 530 discrete

Issue description

sorry,I can't open https://discord.gg/bPKRgsVzAR because of the net wall, so I just post here.

a few suggestions (NTFS、Customize directory name、uuid):

  1. I hope initrd.lz can support boot from NTFS partitions, as it currently can only be placed on FAT32 partitions. My Windows FAT32 partition is too small(100-300MB), and I don't want to expand it. I want to use the original FAT32 partition as the boot partition and place the initrd.lz and the 3.4GB Batocera image on the NTFS partition, which seems to be unsupported at present. I hope this can be improved. Most Linux systems now support booting from NTFS partitions.

  2. I hope the boot_root startup partition directory can be customized. I don't want to put it in /boot/batocera. For example, I want to put it under the /linux/batocera folder, but it fails to start.

  3. The syslinux boot parameter uses the label=BATOCERA boot parameter to start, but I don't want to force the label of the boot disk to be modified to BATOCERA. Can it start Batocera by passing the UUID of the boot partition?

For example, I want to use the following GRUB2 boot code to pass the UUID to the Linux kernel, but it seems not to work?

menuentry "BATOCERA" "/boot/linux" {
search --no-floppy --set --file $2 ; probe -u ($root) -s uuid; echo $uuid
#linux /boot/linux label=BATOCERA vt.global_cursor_default=0
linux /boot/linux uuid=$uuid vt.global_cursor_default=0
initrd /boot/initrd.gz
}
These suggestions are due to the fact that my original system is Windows, and I don't want to make major adjustments; I'd like to do an installation without damaging the original system. hope for some improvements.

Detailed reproduction steps

extrace the img to FAT32/NTFS partition

Details of any attempts to fix this yourself

No response

Details of any modifications you have made to Batocera.

no modifications
batocera.linux
https://batocera.org/download
I just download from above

Logs and data

No response

Noted but we keep this areas only for bug reports.

n2qz commented
  1. The syslinux boot parameter uses the label=BATOCERA boot parameter to start, but I don't want to force the label of the boot disk to be modified to BATOCERA. Can it start Batocera by passing the UUID of the boot partition?

For example, I want to use the following GRUB2 boot code to pass the UUID to the Linux kernel, but it seems not to work?

menuentry "BATOCERA" "/boot/linux" { search --no-floppy --set --file $2 ; probe -u ($root) -s uuid; echo $uuid #linux /boot/linux label=BATOCERA vt.global_cursor_default=0 linux /boot/linux uuid=$uuid vt.global_cursor_default=0 initrd /boot/initrd.gz } These suggestions are due to the fact that my original system is Windows, and I don't want to make major adjustments; I'd like to do an installation without damaging the original system. hope for some improvements.

I added "uuid=" in #12656 for v41, along with the ability to specify multiple devices to try sequentially.

For earlier releases, use "dev=UUID=XXXX-XXXX" instead.

Thank you very much! It works!
#grub4dos
title Batocera.linux (verbose)
find --set-root /boot/linux ;; uuid () ;; echo %?_UUID%
kernel /boot/linux dev=UUID=%?_UUID% rootfs=/boot vt.global_cursor_default=0
initrd /boot/initrd.gz

#grub2:
menuentry "BATOCERA" "/boot/linux" {
search --no-floppy --set --file $2 ; probe -u ($root) -s uuid; echo $uuid
linux /boot/linux dev=UUID=$uuid vt.global_cursor_default=0
initrd /boot/initrd.gz
}

By the way,how about question 1 and question 2?
linux kernel 6.9.10 seems support NTFS3?Why batocera can't boot from NTFS?
GPT-TEST-2024-10-20-08-38-29

n2qz commented

I don't know. It's not a supported configuration, and it never occurred to me to try it. I did add the ntfs3 driver to our x86_64 kernel over a year ago and disabled the old read-only driver.

So, I'd expect that it should work, with a suitable boot loader. Do you have the NTFS module enabled in your grub?

Yes,grub4dos/grub2 did have NTFS module as boot loader.I'm sure.
They can load initrd.gz in the NTFS partition correctly.
When system change boot loader envirnment to linux kernel OS system,they run wrong.
мount: Mounting LABEL -BATOCERA on boot_root failed: No such file or directory waiting for the root device.
just like below.(batocera squashfs in NTFS partition)
GPT-TEST-2024-10-19-18-18-47

n2qz commented

I'll reopen this for now as a feature request since you can't access Discord, I'm not going to spend a lot of time looking at this however, since it's a niche request and doesn't hold any particular interest for me. If I can figure out a quick fix, maybe this will go somewhere.

Item 2 is a non-starter, since moving the squashfs anywhere else will break too many other things (like upgrades).

@n2qz issues shouldn't be populated with requests

I have tested v40 did have NTFS3 module. press F1 enter xterm:
mkdir-p mnt/sda2
mount -t ntfs3 /dev/sda2 mnt/sda2
ls mnt/sda2
it did show files on NTFS partition.
So,maybe the init script(in initrd.gz) didn't mount the partition where the batocera squashfs is.
GPT-TEST-2024-10-20-16-48-56
GPT-TEST-2024-10-20-16-52-50