Paul D. DeRocco
2015-Sep-24 01:29 UTC
[syslinux] Trying to create bootable USB flash drive WITHOUT persistence
I've got an embedded x86 system built with Yocto, which boots from a USB flash drive. It uses a loop mount to give access to an ext3 root file system contained within a FAT16 file, which means it has persistent storage. What I want is something that boots from the flash drive, but copies everything into a large RAM disk, and runs from there, so that it doesn't touch the flash drive once it's booted, and has no persistence, so that it's always a clean boot. My system has a gig of RAM, and the file system is about a third of that, so there should be plenty of room. The Yocto build also creates an .iso file, which I believe works that way, although I haven't tried it. So I'm wondering if running isohybrid on this .iso image will give me what I want. If it does, I have a second question. My USB drive actually has two partitions, the first of which is a small FAT partition that contains persistent data, and is visible if the drive is ever plugged into a Windows system; and a second partition which is the boot partition containing the live image produced by the Yocto build. If I use isohybrid, it will overwrite everything. Once I've done this, would it be possible to manually extract the boot partition with dd, then repartition the device the way I need it, and write the boot partition data back to the second partition, and have it still work? If so, a third question: If I do a new build, can I replace the ROOTFS.IMG file in that second partition with the xxx.rootfs.ext3 file created by the build, without having to go through all the repartitioning rigamarole? -- Ciao, Paul D. DeRocco Paul mailto:pderocco at ix.netcom.com
Gene Cumm
2015-Sep-24 02:17 UTC
[syslinux] Trying to create bootable USB flash drive WITHOUT persistence
On Wed, Sep 23, 2015 at 9:29 PM, Paul D. DeRocco via Syslinux <syslinux at zytor.com> wrote:> I've got an embedded x86 system built with Yocto, which boots from a USB > flash drive. It uses a loop mount to give access to an ext3 root file > system contained within a FAT16 file, which means it has persistent > storage. What I want is something that boots from the flash drive, but > copies everything into a large RAM disk, and runs from there, so that it > doesn't touch the flash drive once it's booted, and has no persistence, so > that it's always a clean boot. My system has a gig of RAM, and the file > system is about a third of that, so there should be plenty of room. The > Yocto build also creates an .iso file, which I believe works that way, > although I haven't tried it. So I'm wondering if running isohybrid on this > .iso image will give me what I want.If the ISO is built that way AND the kernel/initrd know how to find the ISO. Just because it's there doesn't imply that the kernel/initrd have the logic to perform your goals. On the otherhand, also look at TinyCore Linux ( http://www.tinycorelinux.net ).> If it does, I have a second question. My USB drive actually has two > partitions, the first of which is a small FAT partition that contains > persistent data, and is visible if the drive is ever plugged into a > Windows system; and a second partition which is the boot partition > containing the live image produced by the Yocto build. If I use isohybrid, > it will overwrite everything. Once I've done this, would it be possible to > manually extract the boot partition with dd, then repartition the device > the way I need it, and write the boot partition data back to the second > partition, and have it still work?isohybrid only affects the image. There are two basic styles, as a whole disk image with partition table or as a partition image. If you use partition-style and set the MBR accordingly, it should boot the partition.> If so, a third question: If I do a new build, can I replace the ROOTFS.IMG > file in that second partition with the xxx.rootfs.ext3 file created by the > build, without having to go through all the repartitioning rigamarole?With isohybrid in partition-style, the entire partition is an ISO9660 file system. You'll typically need to recompose the ISO to edit anything inside the ISO. If your partitions leave space, you won't need to repartition when applying a new image to the partition. -- -Gene
Paul D. DeRocco
2015-Sep-24 20:08 UTC
[syslinux] Trying to create bootable USB flash drive WITHOUT persistence
> From: Gene Cumm [mailto:gene.cumm at gmail.com] > > isohybrid only affects the image. There are two basic styles, as a > whole disk image with partition table or as a partition image. If you > use partition-style and set the MBR accordingly, it should boot the > partition. > > With isohybrid in partition-style, the entire partition is an ISO9660 > file system. You'll typically need to recompose the ISO to edit > anything inside the ISO. If your partitions leave space, you won't > need to repartition when applying a new image to the partition.Thanks, that seems to work, with --partok. The result looks just like it did before, except that I have a read-only root file system. However, I'm not sure how this is implemented. My / is loop mounted readonly on top of /media/sda2/rootfs.img, but if the latter were on a CD, I would think everything would be snail slow as the system tried to randomly access files. Does something read the entire image into RAM to speed it up, or does it rely upon normal drive caching? -- Ciao, Paul D. DeRocco Paul mailto:pderocco at ix.netcom.com