csstudent
csstudent

Reputation: 165

How to load kernel from fat partition in u-boot under qemu ( arm versatile pb )

I have added to u-boot versatile pb config file located in include/configs/versatile.h this lines:

#define CONFIG_CMD_FAT
#define CONFIG_DOS_PARTITION           1

to add fatload command to u-boot. So I have fatload command suported. And I'm starting u-boot this way:

qemu-system-arm -M versatilepb -m 128M -nographic -kernel u-boot

Now question is how to pass to qemu file that contains fat filesystem with kernel ( im interested in booting FreeBSD kernel, but i think example with loading Linux could help me too ) and then load kernel and boot it under u-boot.

Upvotes: 1

Views: 1513

Answers (1)

Tom Rini
Tom Rini

Reputation: 2173

So, the problem here is that the versatilepb does not support SD/MMC cards in U-Boot, so you can't really. If however you wanted to do this on another device that does support SD/MMC (like the vexpress-a9) you would do:

$ dd if=/dev/zero of=sd.bin bs=1k count=$((64  * 1024))
$ fdisk ./sd.bin
... create a partition

Then read loopback mounting individual partitions from within a file that contains a partition table on linux for how to to use losetup to make that partition available, format it and then mount and copy data like it was a real SD card. Then:

$ qemu-system-arm -M vexpress-a9 -kernel vexpress_ca9x4/u-boot  -nographic -sd sd.bin

And now the 'mmc' command will work with that sd.bin file.

Upvotes: 3

Related Questions