polarfire-soc / polarfire-soc-documentation

PolarFire SoC Documentation
Other
37 stars 19 forks source link

How to boot from second partition rootfs? #64

Closed sdanfa closed 3 years ago

sdanfa commented 3 years ago

Hello, I want to boot from the 2nd partition on the mmcblk0p2 device. Chroot is not working. How can I edit uEnv.txt to boot from the 2nd partition?

Thanks.

sdanfa commented 3 years ago

I tried the following command but it's still not working: setenv bootargs "rootwait console=tty0 console=ttySIF0 root=/dev/mmcblk0p2 rw" load mmc 0:1 ${fileaddr} fitImage.fit; bootm ${fileaddr}

ConchuOD commented 3 years ago

Hi, adding offical documentation/support for this will happen soon, but in the meantime: I am assuming that you are using the aloe vera kit, since you are calling the console "ttySIF0". In that case, you will need to run an additional command to transfer the rootfs to the board:

sudo make DISK=/dev/sdX DEVKIT=mpfs format-rootfs-image

once that is loaded onto the sdcard, chroot should work correctly.

sdanfa commented 3 years ago

Hello, Thanks for your reply. I tried doing that but with a Debian rootfs and chroot is not working, I cannot access or edit any files inside the chroot.

Thanks.

ConchuOD commented 3 years ago

Interesting, I'll give a debian root fs a try and see how it goes for me and let you know.

sdanfa commented 3 years ago

Interesting, I'll give a debian root fs a try and see how it goes for me and let you know.

Thanks! Please try and give me instructions how to make it work if it works.

sdanfa commented 3 years ago

The error I'm getting is file not found when opening for a example /etc/resolv.conf in chroot with nano editor.

ConchuOD commented 3 years ago

I don't have a large enough SD card to hand to test with a debian rootfs a try yet, but I did try today with the one built via buildroot, which i transferred to the sd card with: sudo make DISK=/dev/sdX DEVKIT=mpfs format-rootfs-image

I was able to mount it & chroot into it with no problems. I will try the debian rootfs once I get a larger SD card.

sdanfa commented 3 years ago

I don't have a large enough SD card to hand to test with a debian rootfs a try yet, but I did try today with the one built via buildroot, which i transferred to the sd card with: sudo make DISK=/dev/sdX DEVKIT=mpfs format-rootfs-image

I was able to mount it & chroot into it with no problems. I will try the debian rootfs once I get a larger SD card.

Okay thank you, can you tell me how you chroot into the rootfs? You just used one command the chroot command with the rootfs folder? Or there's more commands to run to chroot correctly?

ConchuOD commented 3 years ago

i did:

mount /dev/mmcblk0p2 /mnt
chroot /mnt /bin/bash
sdanfa commented 3 years ago

Okay I tried with a different Debian rootfs and it's working fine. How can I make it boot directly to Debian rootfs instead of buildroot?

sdanfa commented 3 years ago

Running xorg server fails because its inside chroot. Can you advise how to get xorg to work with a Debian rootfs in chroot? Or is there a way to make it boot in a real environment, not chroot?

ConchuOD commented 3 years ago

Easiest way to do this is to change the uboot script. First check that the bootargs in the second line of the linux defconfig contain the correct the correct partition should be "root=/dev/mmcblk0p3" with the current release although this will change in the next release and is different for the icicle kit.

If you change the contents of conf/mpfs/uEnv_s-mode.txt to:

boot3=load mmc 0:1 ${fileaddr} fitImage.fit; bootm start 0x90000000; bootm 0x90000000 - 0x82200000

it should boot using the rootfs on the SD card not the initramfs built by buildroot

sdanfa commented 3 years ago

Thanks alot for your help. It worked. I booted to Linux directly instead of buildroot. 👍🙂