summarylogtreecommitdiffstats
path: root/bpir-uboot-git.install
blob: c219be24bf110629e4bddd21b16a1b95e8f68f06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
post_upgrade() {
  _partlabelroot=$(lsblk -plno partlabel $rootdev | grep -G '\-root$' )
  [ -z "$_partlabelroot" ] && return
  _target=$(echo $_partlabelroot | cut -d'-' -f1)
  cp -vf /boot/u-boot-${_target}.bin /boot/u-boot.bin # This is the file that boots
}

post_install() {
  _partlabelroot=$(lsblk -plno partlabel $rootdev | grep -G '\-root$' )
  [ -z "$_partlabelroot" ] && return
  mkdir -p /boot/extlinux
  cat <<EOT | tee /boot/extlinux/extlinux.conf
DEFAULT linux-bpir64-git
  MENU title U-Boot menu
  PROMPT 0
  TIMEOUT 50
LABEL linux-bpir64-git
  MENU LABEL Archlinux AUR package BananaPi Routers
  LINUX $(cat  /boot/bootcfg/linux   2>/dev/null | cut -c6-)
  INITRD $(cat /boot/bootcfg/initrd  2>/dev/null | cut -c6-)
  FDT $(cat    /boot/bootcfg/atfdtb  2>/dev/null | cut -c6-)
  APPEND root=PARTLABEL=${_partlabelroot} $(cat /boot/bootcfg/cmdline 2>/dev/null)
EOT
  post_upgrade
}

post_remove() {
 rm -vf  /boot/u-boot.bin
 rm -vrf /boot/extlinux
}