@@ -287,3 +287,51 @@ In the simple way, your recipe looks like
SWUPDATE_IMAGES_FSTYPES[<name of your image>] = <fstype to be put into SWU>
inherit swupdate-image
+
+What about grub ?
+=================
+In order to use swupdate with grub, swupdate needs to be configured to use grub. Some of
+the imporatant configurations are **CONFIG_GRUBENV_PATH="/path/to/grubenv"**,
+where **"/path/to/grubenv"** is thepath to grub environment.
+Example: "/boot/EFI/BOOT/grubenv".
+
+The grubenv file should be created using grub-editenv tool, because it is a **1024-byte file**, therefore,
+any modification using nano or vim will only corrupt the file, and grub will not be able to use it.
+
+You can create a grubenv file using these commands for instance:
+::
+ GRUBENV="/path/to/grubenv"
+ grub-editenv $GRUBENV create
+ grub-editenv $GRUBENV set rootfs=2
+ grub-editenv $GRUBENV set kernel=2
+
+grub-editenv is a tool that is integrated to yocto.
+
+When the grubenv file is created, grub should be configured to use it.
+This configuration should be in the configuration file grub.cfg.
+Here is an example of grub.cfg that loads the environment file before booting:
+::
+ # Take a kernel and a rootfs by default in case grubenv is corrupted
+ rootfs=1
+ kernel=1
+ serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
+ default=boot
+ # set timeout to zero to boot without timeout
+ timeout=0
+ # load grubenv the environment file that contains the value of rootfs and kernel variables
+ load_env -f "/path/to/grubenv"
+ # detect which memory contains 5 partitions
+ for i in 1 2 3 4 5; do if [ -d (hd${i},gpt5)/ ]; then drive=${i};fi ; done
+ # detect which rootfs should we boot with
+ if [ ${rootfs} = "1" ]; then rootfs_part=4 ; elif [ ${rootfs} = "2" ]; then rootfs_part=5 ; fi
+ # detect which kernel should we boot with
+ if [ ${kernel} = "1" ]; then kernel_part="(hd${drive},gpt2)" ; elif [ ${kernel} = "2" ]; then kernel_part="(hd${drive},gpt3)" ; fi
+
+ # The menuentry that is used to boot (more can be added if it is wanted)
+ menuentry 'boot'{
+ linux ${kernel_part}/bzImage root=/dev/mmcblk1p${rootfs_part} rw rootwait quiet console=ttyS2,115200 console=tty0 panic=5
+ }
+
+The grub.cfg above is merely an example, and can be modified as the user wants to,
+as long as it loads the environment variables,and it boots correctly using these environment
+variables.