10

To overwrite itself, your operating system must run fully in RAM and neither read nor write from SD card after booting. piCore/TinyCore is probably one of the few Linux OS which can do that.


6

As pointed out elsewhere, dd-ing over a running OS is never a good idea. An alternative (and the usual way you'd develop embedded systems) is to have your OS image served from a network drive and the target board perform a network boot. This speeds up the initial development and you only need to write out the SD cards as you get closer to completion and need ...


3

Use with caution This works for me because I am using a read-only root filesystem with a custom Buildroot OS. This script hasn't been tested on Raspbian yet, but will probably work. #!/bin/bash set -e echo "Copying image to RPi..." sshpass -p PASSWORD scp /PATH/TO/SDCARD.img USER@RPI:/tmp/sdcard.img echo "Flashing image to /dev/mmvblk0 on RPi..." sshpass -...


3

GPIO Zero provides a mock pin interface, meaning you can run the same code on your PC and emulate the pins. See examples of how it's used in the test suite.


3

I made this little library, fedeb95/pin that proved useful for me. Lacks some features, but if it suits you... it worked for me. Edit: pin is a RPi.GPIO wrapper. Instead of calling method x of RPi.GPIO you call method x of pin. You can specify in a configuration file if your program is running in test mode (wyere you read random values from pins, or values ...


2

Your code snippet is not as simple as you may think. Environment variables are set separately for each process (possibly with inheritance), so if you set MY_ENV_VAR in a shell and test for it from the same shell (with Python code or otherwise) it will be set. If you run Python from a different shell, it won't be. Even in the same shell, you may lose ...


2

Use an SD card large enough to hold multiple partitions The SD card should hold a boot partition (0) and three OS partitions (1-3). The boot loader on the boot partition would examine the partition labels to determine what to load. Suppose the labels are: 0: BOOT 1: OS-0004! 2: OS-0002 3: OS-0003 The loader knows to load the OS from partition ...


2

The closest thing I've ever heard of like this would be Midnight Commander. GNU Midnight Commander is a visual file manager[...]. It's a feature rich full-screen text mode application that allows you to copy, move and delete files and whole directory trees, search for files and run commands in the subshell. Internal viewer and editor are included. ...


1

All your requirements are already available in my Nard SDK distro. It runs from RAM and there are ready made scripts for remote image upgrades. http://www.nard.se/


1

Here a rough approach: Replace /sbin/init with upgrade tool. Tell init to re-exec itself. Kill all other remaining processes (for example with kill -9 -1) Use pivot_root and chroot to replace the root filesystem. If necessary exec the next stage to drop references the old root. Recursively unmount the old root. Write the new image. Reboot.


1

You could ssh over usb. https://desertbot.io/blog/ssh-into-pi-zero-over-usb Or you can configure the pi to connect to your phone, and do the same with the laptop for wireless ssh. If you are not using the GPIO or any other pi specific hardware, then really you could just write/test your code in a vm (there is even a x86 version of raspian if you want!) ...


1

If you want to develop C/C++, you can use Eclipse CDT, once installed and with the right toolchain you will be able to code on your PC, then compile on your PC, send the binary file and remote debug. All from your PC without touching the raspberry. Needed : Eclipse CDT Raspberry Linux toolchain (if you can work on Windows there is SYSGCC toolchain) ...


1

I'd approach this by trying to craft a Makefile recipe to carry out the steps you want, including passing the binary to be tested as a command to ssh. Something along the lines of (note that this is totally untested and probably overly complicated): SCP_CMD=scp SSH_CMP=ssh HOST_URI=pi@raspberrypi.local HOST_PATH=/home/pi/bin/ LOCAL_PATH=./ OUTPUT=...


1

i found this link which explains the process i think but i haven't tried it for myself (yet). you need to add the mono repository using the commands shown (see link) and then you can just do sudo apt-get install monodevelop https://www.monodevelop.com/download/#fndtn-download-lin-raspbian hope this helps.


Only top voted, non community-wiki answers of a minimum length are eligible