Unsure how to Making a SD Card Device Driver for FreeBSD without block device

I want to make a sd card reader for FreeBSD on a RPI3 for a project like a SD card kernal module. I know how SD card works as with Block Device but block device is gone. So, I would like any suggestion on how to build a sd card driver in freebsd for ARM architecture. Thanks! Is there a library already for a FreeBSD SD card driver?


Thanks!
 
No, sorry, I haven't booted from USB as this is a permanent change and I've had trouble in the past with Raspberry Pi 3B. Booting it via USB isn't an option as yet for me (namely if you use an extension cable, FreeBSD takes a very, very long time to sense it) .

I may have steered you in the wrong direction, too. I thought the USB bus controlled all but it doesn't the SD card.

This can be verified with:

camcontrol identify 0:0

It will only show the first attached USB device, not the SD, eg:
Code:
pass0: <SanDisk SSD U100 64GB KM.10.00> ACS-2 ATA SATA 3.x device
pass0: 40.000MB/s transfers

protocol              ACS-2 ATA SATA 3.x
device model          SanDisk SSD U100 64GB
firmware revision     KM.10.00
serial number         0b588f96a
WWN                   5001b40088b56af9
additional product id
cylinders             16383
heads                 16
sectors/track         63
sector size           logical 512, physical 512, offset 0
LBA supported         125045424 sectors
LBA48 supported       125045424 sectors
PIO supported         PIO4
DMA supported         WDMA2 UDMA6
media RPM             non-rotating
Zoned-Device Commands no

Well, I guess to see the card you could use many commands. Perhaps geom disk list?

Under FreeBSD12.1R0, it shows up as:
Code:
sdhci_bcm0: <Broadcom 2708 SDHCI controller> mem 0x7e300000-0x7e3000ff irq 50 on simplebus0
mmc0: <MMC/SD bus> on sdhci_bcm0

simplebus is just the driver for the flattened device tree: fdt(4)
Some links:

(note in the source some of the tuneables available to debug it)

 
No, sorry, I haven't booted from USB as this is a permanent change and I've had trouble in the past with Raspberry Pi 3B. Booting it via USB isn't an option as yet for me (namely if you use an extension cable, FreeBSD takes a very, very long time to sense it) .

I may have steered you in the wrong direction, too. I thought the USB bus controlled all but it doesn't the SD card.

This can be verified with:

camcontrol identify 0:0

It will only show the first attached USB device, not the SD, eg:
Code:
pass0: <SanDisk SSD U100 64GB KM.10.00> ACS-2 ATA SATA 3.x device
pass0: 40.000MB/s transfers

protocol              ACS-2 ATA SATA 3.x
device model          SanDisk SSD U100 64GB
firmware revision     KM.10.00
serial number         0b588f96a
WWN                   5001b40088b56af9
additional product id
cylinders             16383
heads                 16
sectors/track         63
sector size           logical 512, physical 512, offset 0
LBA supported         125045424 sectors
LBA48 supported       125045424 sectors
PIO supported         PIO4
DMA supported         WDMA2 UDMA6
media RPM             non-rotating
Zoned-Device Commands no

Well, I guess to see the card you could use many commands. Perhaps geom disk list?

Under FreeBSD12.1R0, it shows up as:
Code:
sdhci_bcm0: <Broadcom 2708 SDHCI controller> mem 0x7e300000-0x7e3000ff irq 50 on simplebus0
mmc0: <MMC/SD bus> on sdhci_bcm0

simplebus is just the driver for the flattened device tree: fdt(4)
Some links:

(note in the source some of the tuneables available to debug it)


That was helpful. Last question, so my SD CARD does show up . The file PATH is /dev/msdosfs/CANAKIT. I have a folder inside the SD CARD. Is there a way to access that. Because the CANAKIT shows up as not a directory. I am bad at this. Thank you so much.

Name is mmcsd0 when i do geom disk list


I actually figure how mount the SD card with mount -t msdosfs -o rw /dev/mmcsd0s1 /mnt/
and see the files.
Thanks for all the help.

Now I guess i need to have the ethernet or internet set up on the FreeBSD in PI. Any suggestions on that?
 
What raspberry Pi are you using?
It occurred to me that last I read, FreeBSD can boot from the USB via UEFI on Raspberry Pi 4. Previous versions are impossible to boot that way unless you modify it permanently:

Internet setup? What image are you using? It should do it for you - even if you build the image yourself using crochet.
 
Back
Top