Thanks Robert! I issued a pull request with a couple minor changes to add a 
variable where you explained:
https://github.com/RobertCNelson/boot-scripts/pull/124

Here's the text of the pull request that describes how it could be used to 
make a smaller image size than the size of your microSD card:

Setting the conf_rootfs_partition_size variable allows for better control 
over the size of the microSD card necessary to house the resulting image 
when running the beaglebone-black-make-microSD-flasher-from-eMMC.sh script. 
For example, you might be working with a 32GB microSD card image, but want 
to generate an image that would also fit on a 4GB microSD card, so you 
could do the following:
sudo conf_rootfs_partition_size=7462912 
/opt/scripts/tools/eMMC/beaglebone-black-make-microSD-flasher-from-eMMC.sh

Which would specify the size as 7462912 sectors, which is the size of the 
eMMC rootfs partition (at least on the one I was testing on). After making 
the flasher you could then use dd to get the image off the microSD card for 
flashing onto other microSD cards:

sudo dd if=<path to microSD card device> of=<path to image file> bs=512 
count=7471104

7471104 can be determined by the output from fdisk -l (one more than the 
End sector, or 8192 more than the size of the rootfs partition):
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 8192 7471103 7462912 3.6G 83 Linux

You may be able to speed up the dd command by using a bigger blocksize and 
adjusting the count accordingly (using a 4MB block size):
sudo dd if=<path to microSD card device> of=<path to image file> bs=419430 
count=912

On Thursday, April 22, 2021 at 7:58:42 AM UTC-6 RobertCNelson wrote:

> On Thu, Apr 22, 2021 at 8:26 AM John Allwine <[email protected]> wrote:
> >
> > How about changing the partition size in the make flasher script? Could 
> there be an option to make it the same size as the eMMC? Where is the 
> partition size determined?
>
>
> https://github.com/RobertCNelson/boot-scripts/blob/master/tools/eMMC/functions.sh#L1311-L1318
>
> LC_ALL=C sfdisk ${sfdisk_options} "${destination}" <<-__EOF__
> ${sfdisk_boot_startmb},,${sfdisk_fstype},*
>
> Change to:
> ${sfdisk_boot_startmb},${some new var for size},${sfdisk_fstype},*
>
> Regards,
>
> -- 
> Robert Nelson
> https://rcn-ee.com/
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/50005372-feee-4683-b772-0cedc21c9be6n%40googlegroups.com.

Reply via email to