How to bind SD card to Raspberry Pi - raspberry-pi

Is there a way to make sure that SD card of Raspberry PI works only with particular device only?
I do not want anyone to use the SD card with any other Raspberry Pi device other than specified.
Is there a way out?

There is no simple way do do this. Of course you can build some trickeries based on Device Informations (fsys and udev) and crypt your disk. But, it is clearly impossible to guarantee system integrity when the storage device is physically reachable: anyone can mount it and some aware/clever guy, using enough time and effort, shall reverse engineering it.

See this guide for Arch linux: https://wiki.archlinux.org/index.php/Disk_Encryption
If you encrypt your filesystem only he have the password can decrypt the sdcard. This prevent unauthorize access for example from the Windows/Linux to the sd card files.
But if you boot from the PC you are in the same problem.
The only thing that comes to mind is to make a script that controls a device that exists only on raspberry is available and if not, automatically encrypt the system.

Related

RASPBERRY : Write to an external microSD card in SPI mode

I have already posted this question on the raspberry forum but I only got a few answers that didn't solve my problem... I have been waiting for a month so I turn to this forum hoping to be able to find a solution there...
PS : do not hesitate to check my post on RPI forum to see my progress and my research/tests carried out (https://forums.raspberrypi.com/viewtopic.php?t=335338)
So here is my problem :
I have been looking for a while how to write to an external microSD card in SPI mode...
My goal is to write data collected by a sensor an store them on various microSD cards (6) by using CS. But at this point, I'm tring to write data on one card.
I'm using a RPI Zero 2W, a simple microSD card module and an 512GB microSD card (with exFAT filesystem).
I saw that there was a "mmc_spi" driver included in a linux kernel which allows to detect an SD card connected by SPI as if it were a USB key to which we could simply access/read/write (https://ralimtek.com/posts/2016/2016-12-10-raspberry_pi_secondary_sd_card/)
the problem is that this tutorial is not working anymore... In fact, the linux Kernel used in the tuto is an old one compare to the current version and and I had confirmation that the "mmc_spi" driver used to detect the SD card had evolved but the use of this new version is not documented and obviously does not work like the old one...
So my question is : does the mmc_spi driver still allows to detect SD cards and access them and if yes, does it works with the PI zero 2W ?

Do I need an OS for a RaspberryPi Game Console?

I want to create a game console with my Raspberry Pi and create my own game with an SD Card. Do I need an OS loaded with games or can I insert various SD Cards with different games?
In order to use the Raspberry Pi as a retro gaming console you will have to set it up. Go to the RetroPie Download page and choose the appropriate download for your version of your Raspberry Pi. The go to the RetroPi first installation page and follow the directions. After you complete that you will have to move your roms to the Raspberry pi into the /RetroPie/roms folder on the SD card. I use a Raspberry Pi for classic gaming and I love it.
I think there is some confusion here.
RetroPi IS technically the OS. You then "add" games to it.
If you want to create your own games then you have plenty of options.
You can technically create your own games and export them as NES games to be read by the NES emulator. This is very difficult and requires you to use tools that might be out of scope for beginners. The advantage is that you can put them in eprom chips and play them on an actual NES.
I would instead try to create a game using something like PyGame and play them on a RaspberryPi. Yo uwon't need RetroPi for something like this. Instead you'd need an OS like Raspbian
Yes definately. A raspberry pi without an operating system will not do anything. Its like asking a human to function without a brain. You should check out the retropie project. Its an operating system for the raspberry pi that lets you install roms and play the. You can even use controllers such as a ps3 controller.
Retropie
Head to RetroPie to download the image to your computer. Then, flash it on to the MicroSD with either Win32DiskImager on Windows or RPI-sd card builder on a Mac.
Have any other questions I can help with?

Is it possible to transfer a file to USB device using libusb?

I am trying to transfer the file via libusb to the USB device (pendrive). I have seen submit_bulk_transfer function in libusb-1.0.6 package. If there is a way to transfer the file then can you please suggest me. I want to transfer the file not as raw data.
It is possible, but you will need to implement Mass Storage, SCSI, and the file system that is used on the device in order to do so, which is a lot of work, and it is already done by the USB and FS drivers of all desktop (and many other) OSs.
See libusb FAQ.
BTW submit_bulk_transfer is a very low level functionality of USB, related to many device classes, not only Mass Storage.

MicroSD Card versus USB Flash Drive for Raspberry Pi 2

Articles on this topic from 2012 for earlier RPi hardware extolling the virtues of using an external USB flash drive are now dated.
In 2015, using Raspberry Pi 2 hardware, is there still any advantage to moving the root file system and booting from an external USB flash drive instead of just using the default microSD card?
I'm not sure if the raspberry pi bootloader is even capable of booting from USB, but I could be mistaken (there might be a way to set up an SD card to act as an intermediate step in mounting the OS from USB).
Aside from that, I can't imagine you'll notice much of a speed difference between the micro sd and a USB 2 flash drive (as far as I'm aware, the rpi doesn't have usb 3 hardware). Both will have similar life span.
Other considerations: power consumption (I believe SD has an advantage here, especially since a card will have to be used anyway to boot), quality of either device (you can buy really bad SD cards and USB flash drives alike)
I would be interested in seeing some bench marks if you decide to run any tests to see if there's a difference.
My DriveSpeed benchmark measures speed of large and small file writes and reads, plus random writing and reading. RPi 2 results for SD and USB drives are here.
http://www.roylongbottom.org.uk/Raspberry%20Pi%20Benchmarks.htm#anchor21
For booting, you need to establish which performance feature is more important and it is not just large file data transfer speed. Anyway, it mainly depends on the drive hardware performance characteristics. My system SD card can be out performed by SD cards in a USB card reader.

SD card emulator

I have one project to do.
I need to transfer photos from camera to PC, i need to use SDcard interface it is SPI i hope ).
Because usb transfer is not in option, so i think that i connect some microcontroller or raspberry pi instead of sdcard and emulate sd card and from microcontroller i somehow send it (via usb or ethernet)to pc. this whole operation (wrom camera to pc) must be realy quick (1-2s) and photos are 2-4Mbyte. Do you have any tips how to do that or what microconroller chose?
scheme:
SPI as SD emulator USB/Ethernet
|camera|--------------->|microcontroller| ---------------> |PC|
thanks for advices and ideas.