Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Serial configuration
  2. serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
  3.  
  4. # Boot configuration
  5. default=0
  6. timeout = 10
  7.  
  8. set CMDLINE="console=ttyS0,115200 console=tty0 quit"
  9.  
  10. # Rauc scrupt stuff
  11. set ORDER="A B"
  12. set A_OK=0
  13. set B_OK=0
  14. set A_TRY=0
  15. set B_TRY=0
  16. load_env --file /boot/EFI/BOOT/grubenv
  17.  
  18. # select bootable slot
  19. for SLOT in $ORDER; do
  20.     if [ "$SLOT" == "A" ]; then
  21.         INDEX=0
  22.         OK=$A_OK
  23.         TRY=$A_TRY
  24.         A_TRY=1
  25.     fi
  26.     if [ "$SLOT" == "B" ]; then
  27.         INDEX=1
  28.         OK=$B_OK
  29.         TRY=$B_TRY
  30.         B_TRY=1
  31.     fi
  32.     if [ "$OK" -eq 1 -a "$TRY" -eq 0 ]; then
  33.         default=$INDEX
  34.         break
  35.     fi
  36. done
  37.  
  38. # reset booted flags
  39. if [ "$default" -eq 0 ]; then
  40.     if [ "$A_OK" -eq 1 -a "$A_TRY" -eq 1 ]; then
  41.         A_TRY=0
  42.     fi
  43.     if [ "$B_OK" -eq 1 -a "$B_TRY" -eq 1 ]; then
  44.         B_TRY=0
  45.     fi
  46. fi
  47.  
  48. save_env --file /boot/EFI/BOOT/grubenv A_TRY B_TRY
  49.  
  50.  
  51. # Entries
  52. menuentry "Slot A (OK=$A_OK TRY=$A_TRY)" {
  53.   linux /bzImage root=/dev/mmcblk1p2 rootwait rootwait rootfstype=ext4 $CMDLINE rauc.slot=A
  54. }
  55.  
  56. menuentry "Slot B (OK=$B_OK TRY=$B_TRY)" {
  57.   linux /bzImage root=/dev/mmcblk1p3 rootwait rootwait rootfstype=ext4 $CMDLINE rauc.slot=B
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement