Booting the Beaglebone Black from internal flash
Otacílio
otacilio.neto at bsd.com.br
Sun May 22 20:39:24 UTC 2016
Em 22/05/2016 15:53, William Waites escreveu:
> I've gotten my BBB to boot and run off of its internal flash. It wasn't
> terribly difficult and maybe this is old news, but I had a lot of
> trouble finding instructions for how to do it. Here's what I did, in
> case it's useful.
>
> 1. Start from an image written to SD card. At the time of writing
> there seems to be a problem with the 11 images, but 10.3 works
> fine.
>
> 2. Delete any existing partitions from the internal flash, as well as
> the partition table so that we can start from scratch:
>
> gpart delete -i 2 mmcsd1
> gpart delete -i 1 mmcsd1
> gpart destroy mmcsd1
>
> 3. Create partitions similarly to the SD card:
>
> gpart create -s GPT mmcsd1
> gpart add -t \!12 -b 63 -s 2M mmcsd1
> gpart set -a active -i 1 mmcsd1
> gpart add -t freebsd mmcsd1
> gpart add -t freebsd-ufs mmcsd1s2
>
> It is unclear if it is necessary or why to use a traditional
> disklabel here instead of just putting the freebsd-ufs directly in
> slice 2.
>
> 4. Create filesystems:
>
> newfs_msdos -F 12 /dev/mmcsd1s1
> newfs -U -t /dev/mmcsd1s2a
>
> These filesystems do not (yet) have labels so they won't be
> magically found by the boot process. It does not appear to be
> possible to label them while there are other filesystems mounted
> with those labels.
>
> 5. Mount the filesystems:
>
> mount /dev/mmcsd1s2a /mnt
> mkdir -p /mnt/boot/msdos
> mount -t msdosfs /dev/mmcsd1s1 /mnt/boot/msdos
>
> 6. Copy the running system onto the internal flash:
>
> cd /boot/msdos; tar -cf - ./ | (cd /mnt/boot/msdos; tar -xpvf -)
> cd /; tar --one-file-system -cf - ./ | (cd /mnt; tar -xpvf -)
>
> This could alternatively be done by building from source, and
> installing with DESTDIR=/mnt or potentially using the distribution
> sets. Except perhaps for the early bootloader stages which come
> from the sysutils/u-boot-beaglebone port I believe.
>
> 7. Make sure that booting will proceed from the internal flash,
> because the default in u-boot is to use mmc 0 (the external SD
> card).
>
> echo 'fatdev=mmc 1' > /mnt/boot/msdos/uenv.txt
>
> 8. Halt the system, remove the SD card, boot into single user mode to
> label the disks. The kernel will not be able to find the root
> partition, and it needs to be specified as ufs:/dev/mmcsd0s2a when
> asked.
>
> glabel label MSDOSBOOT mmcsd0s1
> glabel label rootfs mmcsd0s2a
>
> Notice that now the device is mmcsd0 and not mmcsd1. This is
> because of the way the numbering works which is slightly
> inconvenient.
>
> 9. Reboot and done.
>
> 9a. Not really, for me the kernel was still unable to find the
> filesystem with rootfs label, and I resorted to building a kernel
> with
>
> options ROOTDEVNAME=\"ufs:mmcsd0s2a\"
>
> The default in the BEAGLEBONE config is ufs:mmcsd0s2 which would
> probably have worked if not using BSD disklabels and putting the
> filesystem directly there (see #3).
>
> Is it a good idea to write this down in the wiki?
>
> Best wishes,
> -w
>
I think that this is a great improvement to the wiki, but this is not my
decision. About the support of FreeBSD to the internal flash memory, is
it robust sufficiently to be used without panics?
[]'s
-Otacílio
More information about the freebsd-arm
mailing list