[yocto] [meta-raspberrypi][PATCH] sdcard_image-rpi.bbclass: deploy vfat partition

Matthew McClintock msm-oss at mcclintock.net
Sun Jun 18 11:51:39 PDT 2017


On Sat, Jun 17, 2017 at 11:41 AM, Khem Raj <raj.khem at gmail.com> wrote:
> On Sat, Jun 17, 2017 at 8:20 AM, Tom Rini <trini at konsulko.com> wrote:
>> On Fri, Jun 16, 2017 at 06:05:07PM -0700, Khem Raj wrote:
>>> On Fri, Jun 16, 2017 at 12:12 PM, Matthew McClintock
>>> <msm-oss at mcclintock.net> wrote:
>>> > This is useful to update the bootloader/vfat partition from u-boot when
>>> > you don't want to update everything:
>>> >
>>> > U-Boot> tftpboot 0x1000000 tmp/0VXje
>>> > Waiting for Ethernet connection... done.
>>> > Using sms0 device
>>> > TFTP from server 192.168.0.1; our IP address is 192.168.0.26
>>> > Filename 'image.vfat'.
>>> > Load address: 0x1000000
>>> > Loading: ##################################################  40 MiB
>>> >          2.1 MiB/s
>>> > done
>>> > Bytes transferred = 41943040 (2800000 hex)
>>> > U-Boot> mmc part
>>> >
>>> > Partition Map for MMC device 0  --   Partition Type: DOS
>>> >
>>> > Part    Start Sector    Num Sectors     UUID            Type
>>> >   1     8192            81920           a63a4fbc-01     0c Boot
>>> >   2     90112           163840          a63a4fbc-02     83
>>> > U-Boot> mmc erase 0x2000 0x14000
>>> >
>>> > MMC erase: dev # 0, block # 8192, count 81920 ... 81920 blocks erased:
>>> > OK
>>> > U-Boot> mmc write 0x1000000 0x2000 0x14000
>>> >
>>> > MMC write: dev # 0, block # 8192, count 81920 ... 81920 blocks written:
>>> > OK
>>> > U-Boot>
>>> >
>>> > Signed-off-by: Matthew McClintock <msm-oss at mcclintock.net>
>>> > ---
>>> >  classes/sdcard_image-rpi.bbclass | 8 ++++++++
>>> >  1 file changed, 8 insertions(+)
>>> >
>>> > diff --git a/classes/sdcard_image-rpi.bbclass b/classes/sdcard_image-rpi.bbclass
>>> > index af3e807..27a0dfc 100644
>>> > --- a/classes/sdcard_image-rpi.bbclass
>>> > +++ b/classes/sdcard_image-rpi.bbclass
>>> > @@ -72,6 +72,10 @@ SDIMG = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.rpi-sdimg"
>>> >  # Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS.
>>> >  FATPAYLOAD ?= ""
>>> >
>>> > +# SD card vfat partition image name
>>> > +SDIMG_VFAT = "${IMGDEPLOYDIR}/${IMAGE_NAME}.vfat"
>>> > +SDIMG_LINK_VFAT = "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.vfat"
>>> > +
>>> >  IMAGE_CMD_rpi-sdimg () {
>>> >
>>> >         # Align partitions
>>> > @@ -145,6 +149,10 @@ IMAGE_CMD_rpi-sdimg () {
>>> >         echo "${IMAGE_NAME}" > ${WORKDIR}/image-version-info
>>> >         mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}/image-version-info ::
>>> >
>>> > +        # Deploy vfat partition
>>> > +        cp ${WORKDIR}/boot.img ${SDIMG_VFAT}
>>> > +        ln -sf ${SDIMG_VFAT} ${SDIMG_LINK_VFAT}
>>> > +
>>>
>>> it is of use if I am not using u-boot ? is there any penalty ?

Other than just having another thing copied into tmp there is no
effect, even if you're not using u-boot.

>>
>> The stock firmware also uses a vfat partition, so this could just as
>> easily hold those contents.
>
> yes it does, can it do the same operations like u-boot ?

Didn't see anything that lets you use networking and upgrade
partitions, etc like u-boot does.

FWIW using this to completely automate loading new images without the
need for a display or a local user.

The only remaining thing to sort out is the device tree, I'm having to
use the one passed for the first stage bootloader at the moment for
the board to come up right, I assume if I put a bad one there the
board might be bricked, once I sort out using a separate device tree
for just booting Linux I can update Linux and the device tree and
generally never need to worry about bricking a board.

-M



More information about the yocto mailing list