...from an image file that contains a simple plain-text file tree...
This is gobbledygook. You are confused. That is not what an operating system image file is. It is a binary, block-for-block duplication of either a single filesystem, or (as with the ones used for the Raspberry Pi), a block device containing multiple partitions and a boot sector.
This is why all you have to do with the Raspbian image to create a usable SD card is copy it to the card with dd
.
e.g., as discussed here
What is discussed there is not anything to do with "a simple plain-text file tree". If you want a better understanding of what that script is for, here is an explanation of the exact same process.
using VirtualBox,it's very convenient to do operations, such as installs of large packages, that would be slow on a Raspberry Pi
VirtualBox is a hypervisor for x86(-64).1 It does not emulate foreign architectures such as ARM (the category the Pi falls into), therefore it is impossible to run an operating system in it that has been compiled for the Pi.
While Raspbian is available for PC hardware, you cannot use it to do what you want to do since these two versions are not binary compatible.
how to easily export the resulting o/s instance
In fact you can create an image file of the sort described above ("a binary, block-for-block duplication of a filesystem") from a VirtualBox using VBoxManage clonemedium --format RAW
.
as a Raspbian image
You could, but this would not be an image that could be run on an actual Raspberry Pi.
You might have a look into QEMU, although note that the combination of hardware emulation and the less performance oriented ARM ISA will probably mean it is noticeably slower than VirtualBox. However, I believe you can run unadulterated Raspbian in it.
1. X86(-64) is by far the most widespread instruction set architecture (ISA) for contemporary PCs (desktops, laptops, inc.
Apple machines). ISA's are used in hardware implementation, meaning they are carved in metal for specific physical systems. Software is compiled to machine code which corresponds with this. Software compiled for one ISA is unlikely to be compatible with another.
VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product
- so, besides the fact that I have no idea what the first sentence is even saying, I can tell you that virtualbox is not a solution to "do operations that would be slow on a Raspberry Pi" – Jaromanda X Mar 12 '18 at 04:48.img
file from a VirtualBox instance. – christopherbalz Mar 12 '18 at 06:26