How do I save a Javascript app onto the microSD card after I image Raspberry Pi OS onto it?

34 views Asked by At

I am new to this and exploring a lot of concepts. Please lmk if I have any misconceptions.

I imaged Rasberry Pi OS on my microSD card (32 GB) using the Raspberry Pi Imager via raspberrypi.com. The capacity of the microSD card becomes 267.4 MB, so I believe that partitions are created. I cannot see the other partitions using Disk Utility on Mac.

I would like to save a Javascript app I created onto the microSD card before connecting it to my Raspberry Pi Zero. Is this possible? Or do I need to boot my Raspberry Pi and download the file separately?

2

There are 2 answers

0
sativay On

You may add your JavaScript to the "rootfs" which after installing the OS with the imager application is mounted at /media/user/rootfs. This is on Linux and if it is not on Mac by default, then mount the rootfs partition and copy whatever files you require.

Note that there is another boot partition where you may do boot config manipulation by editing the file config.txt.

0
Mark Setchell On

The /boot partition is formatted as FAT, which macOS can read and write. The root and other partitions are formatted as ext3, or similar, which macOS cannot readily access.

You could try to squeeze your app into the boot partition, which will appear on your Mac at /Volumes/boot and likewise in the Finder.

You may need to compress it (as the boot partition is small) using gzip which is included in macOS. It will look like:

gzip < YOURAPP > /Volumes/boot/YOURAPP.gz

You can then boot your RasPi and unzip your app to your HOME directory with:

gunzip < /boot/YOURAPP.gz > $HOME/YOURAPP