4

I have a beagle bone black board and I want to make the card read-only so no modifications go to the microSD card. How can I achieve that?

I have searched over internet for this. SD card have a switch to do this, however microSD does not.

I am thinking that there must be a pin through which the info is written to the card. Is it possbile to make the card read-only by blocking that pin, or is there another, better, way to make the card read-only?

Edit: I want a non software way of blocking. I am trying to install a small os on it, and want that someone who could hack into, not to be able to add anything on that microSD card.

codiac
  • 167
  • 1
  • 1
  • 6
  • What have you tried? What did your searches show up? Why weren't they good enough or what problem you had with them in particular? – Shahbaz Jan 28 '14 at 16:59
  • 2
    Sorry CPJ, but as it stands this question does not appear to be in any way related to Robotics. – Mark Booth Jan 28 '14 at 21:03
  • @MarkBooth: Don't jump to conclusions. There are electronics involved in robotics. Or isn't there? –  Jan 30 '14 at 12:46
  • @CPJ I agree with you, I would put your question on hold because of showing no research effort, you just asked how to, not described what you have tried, and the problems you have. Also this question is so specific to one platform, questions related to electronics in robots have any relation in the question. – Diego C Nascimento Jan 30 '14 at 18:35
  • @CPJ - Yes, Robotics includes a raft of other disciplines, electronics included, but your question doesn't even mention a robotic application, it is a pure beagle-bone question. Have a read of the meta thread How do we address questions about related subject areas? and Where does Robotics end and Electrical Engineering begin?. Also, remember that if you edit your question to bring it on topic, and flag it for moderator attention, we will happily reopen it. – Mark Booth Jan 30 '14 at 20:36
  • 3
    According to this superuser.com post, that switch on the side of the card is not electrical, card readers that support write-protect can sense the position of that switch through a mechanical/optical sensor (which some drivers/sofware may ignore). There's some mention of a card level write-protect in the SDCard spec, but there aren't many details and it appears to be rare. – Johnny Jan 31 '14 at 01:35
  • There is no hardware write protect on sd cards. There apparently is a rarely used config bit of the card which most clients would not know to reset however, but reseting it is a software operation on the interface. – Chris Stratton Jan 31 '14 at 04:26
  • 1
    Probably it's too late, but for who pass by: http://www.bertold.org/sdtool/ – Kobayashison Mar 26 '17 at 12:56
  • @ChrisStratton next to the resettable bit is a non-resettable bit, for permanently making the card read-only. (And I do think that your average hacker isn't going to think of checking the CSD when the card seems read-only) – JamesTheAwesomeDude Mar 05 '20 at 21:13

2 Answers2

3

@Johnny above is 100% correct. The switch is not a switch at all, it functions in the same way as the tab on a floppy disk. With SD however there's only optional enforcement whereas with the floppy disk, the standard hardware enforced the write protect mechanism.

SD Card wiring

A circuit in front of me wires the "SD Card Protected" line from the card cage (in this case, full size) to a GPIO port and the driver detects that. The picture above is to emphasis that the "card present" and "card protected" mechanisms are seperate from the MMCSD data transfer bus.

In your case the microSD card has no switch and no mechanism on the card slot to detect anything. Without looking at the BeagleBone schematic, I'd say there's no Protect line. But, that doesn't prevent you from

  • Creating your own card protect line using a spare GPIO line and using a jumper to select protected/not-protected. Then changing the SD device driver to use that GPIO line.
  • pretending a line does exist by altering the SD device driver
  • Not bothering and asking the kernel to mount the image read only

So I'm afraid the question reverts to a linux OS question.

carveone
  • 2,578
  • 1
  • 16
  • 23
2

You can software lock SD cards it seems, here's a link to get you started:

http://hackaday.com/2014/01/18/the-tiniest-sd-card-locker/

John U
  • 7,139
  • 2
  • 22
  • 37
  • The file that shows how to lock/unlock is https://github.com/Nephiel/sdlocker-tiny/blob/master/sdlocker-tiny.cpp – markrages Jan 31 '14 at 19:33