Sorry, you need to enable JavaScript to visit this website.

SD card boot + rootfs

5 posts / 0 new
micahstevens's picture
SD card boot + rootfs

I've been attempting to get the UltraZed_IOCC_BSP to boot and run the rootfs off the SD card. I can import the fresh BSP and build it, using those images the example boots as an initramfs image fine. I can log in, etc. 
Step 1:
If I merely switch Image Packaging Configuration -> Root Filesystem Type to "SD card". Then I rebuild with petalinux-build. I then put BOOT.BIN, image.ub and system.dtb on the first fat32 partition of 1 gig on a 16 gig sd-card. I then use 'dd' to write rootfs.ext3 to the second partition. 
Kernel begins to boot, but fails some time after the logging to the serial port stops. (See #2 below).  Here is a link to the boot log: 
Pastebin Log
Step 2: 
If I go in and add the console=ttyPS0,115200 stuff to the boot args (petalinux-config -> Kernel Bootargs) I notice it's pointing the rootfs to the wrong partition, so I update the argument string. 
Original: earlycon clk_ignore_unused root=/dev/mmcblk0p2 rw rootwait
Updated: earlycon earlyprintk clk_ignore_unused root=/dev/mmcblk1p2 rw rootwait console=ttyPS0,115200
This works better as I can now see that I'm getting a kernel panic:

Bad mode in Error handler detected on CPU1, code 0xbf000000 -- SError
Pastebin Log
Step 3: 
Based on some research I discovered that as it's delivered, the BSP does not configure a write protect pin for the SD card in the device tree. (MIO 44) - however the system will look for the write protect jumper status (SD_WP_N on the carrier board). This prevents a partition from being mounted in RW mode. If you put 'disable-wp;' in the @sdhci0/1 device tree entries in system-user.dtsi, this pin (MIO 44?) will no be referenced and you can mount the filesystems on the card in RW mode.
I was able to verify this works in initramfs, but it did not fix the above kernel panic. 
Question: Do you see that I'm doing something wrong here? Has anyone run into this before? It seems like this should be a simple operation, but I've been working on various iterations of the build for several days and nothing seems to work. I would love some insight on a procedure that works (or a working BSP would be AMAZING) 
Thank you in advance for any help! 
My system-user.dtsi.
My project config.
My u-boot environment.

steven.bell's picture
Just a guess...

The lines in your log just before things fall apart are:

[    1.596896] GPIO IRQ not connected

[    1.600109] XGpio: /amba_pl@0/gpio@80000000: registered, base is 504

[    1.606638] GPIO IRQ not connected

[    1.609849] XGpio: /amba_pl@0/gpio@80010000: registered, base is 496

[    1.616214] Bad mode in Error handler detected on CPU1, code 0xbf000000 -- SError
On my system, the equivalent lines are:
[    1.337569] GPIO IRQ not connected
[    1.337583] XGpio: /amba_pl@0/gpio@80000000: registered, base is 330
[    1.337727] GPIO IRQ not connected
[    1.337740] XGpio: /amba_pl@0/gpio@80010000: registered, base is 322
[    1.337878] GPIO IRQ not connected
[    1.337890] XGpio: /amba_pl@0/gpio@80020000: registered, base is 319
So perhaps you're missing a GPIO block that it's expecting to find at 0x80020000?
We've gotten this working on the IOCC by building off of the DisplayPort reference design.  PM me and I can send you a document explaining what we've done so far.

steven.bell's picture
my boot log

I went back and looked at my design, and I've got three GPIO blocks instantiated in the fabric, so that's why those are in my boot log.  Yours is probably different.  If it helps, my boot log is here:

micahstevens's picture

Thanks for taking a look. This is a good point, I'm expecting 3, but it's not hanging when I boot into a RAM rootfs, so I wonder what the difference is there? I'll look more into it, I missed this entirely. 
I'll also try the same experiment with the DisplayPort design. I'll PM you. 

micahstevens's picture

Boot from SD Card:
I started with a project from scratch, instead of the downloaded BSP. I then added this manual kernel bootcmd:
 earlycon earlyprintk clk_ignore_unused root=/dev/mmcblk1p2 rw rootwait console=ttyPS0,115200
Then added "disable-wp;" to the system-user.dtsi file as I described in the original post, and then in u-boot used 'run sdboot' instead of letting it boot normally into RAM. This mounted the second partition as EXT3 RW, and used that as the root file system instead of using RAM. 
This leads me to believe a couple things, the petalinux-config program does not configure the kernel boot parameters correctly. This should be corrected and I'll post something over at Xilinx about it. Also it seems like it should reconfigure u-boot to boot from the SD card, but it doesn't. There's an undocumented step missing of going into u-boot and telling the default boot to be the sdboot command. 
Hope this helps someone else.