Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit beaec392 authored by Romain Hunault's avatar Romain Hunault 💻
Browse files

Merge branch '4-add-fp3-scripts' into 'master'

Resolve "Add FP3 scripts"

Closes #4

See merge request !11
parents 4eb1e836 e7e26415
Loading
Loading
Loading
Loading
+55 −0
Original line number Diff line number Diff line
#!/bin/bash

# Copyright (C) 2020 ECORP SAS - Author: Romain Hunault
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Parameter
# $1: DEVICE_ID device id
# $2: ARCHIVE_PATH path to archive

# Exit status
# - 0 : device flashed
# - 1 : generic error
# - 101 : DEVICE_ID missing
# - 102 : ARCHIVE_PATH missing

DEVICE_ID=$1
ARCHIVE_PATH=$2

if [ -z $DEVICE_ID ]
then
  exit 101
fi

if [ -z $ARCHIVE_PATH ]
then
  exit 102
fi

fastboot -s $DEVICE_ID -w
sleep 1

fastboot -s $DEVICE_ID flash system $ARCHIVE_PATH/system.img
sleep 1
fastboot -s $DEVICE_ID flash boot $ARCHIVE_PATH/boot.img
sleep 1
fastboot -s $DEVICE_ID flash vendor $ARCHIVE_PATH/vendor.img
sleep 1
fastboot -s $DEVICE_ID flash dtbo $ARCHIVE_PATH/dtbo.img
sleep 1
fastboot -s $DEVICE_ID flash product $ARCHIVE_PATH/product.img
sleep 1
fastboot -s $DEVICE_ID flash vbmeta $ARCHIVE_PATH/vbmeta.img
sleep 1

lock-bootloader.sh

0 → 100755
+32 −0
Original line number Diff line number Diff line
#!/bin/bash

# Copyright (C) 2020 ECORP SAS - Author: Romain Hunault
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Parameter
# $1: DEVICE_ID device id

# Exit status
# - 0 : bootloader locked
# - 1 : generic error

DEVICE_ID=$1

if [ -z $DEVICE_ID ]
then
  exit 101
fi

fastboot -s $DEVICE_ID flashing lock
+5 −5
Original line number Diff line number Diff line
#!/bin/bash

# Copyright (C) 2019 ECORP SAS - Author: Romain Hunault
# Copyright (C) 2019-2020 ECORP SAS - Author: Romain Hunault
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,16 +16,16 @@
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Parameter
# $1: DEVICE_LOCKED_PATH cable lock file (typically ${DEVICES_LOCKED_PATH}/${DEVICE})
# $1: DEVICE_LOCKED_PATH device lock file (typically ${DEVICES_LOCKED_PATH}/${DEVICE})

# Exit status
# - 0 : device unlocked (lock file deleted)
# - 1 : Lock file does not exist
# - 0 : device unlocked
# - 1 : generic error
# - 101 : DEVICE_LOCKED_PATH missing

DEVICE_LOCKED_PATH=$1

if [ -z $DEVICE_LOCKED_PATH ]
if [ -z "$DEVICE_LOCKED_PATH" ]
then
  exit 101
fi

unlock-fp3.sh

0 → 100755
+44 −0
Original line number Diff line number Diff line
#!/bin/bash

# Copyright (C) 2020 ECORP SAS - Author: Romain Hunault
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Parameter
# $1: path to archive folder
# $2: device id

# Exit status
# - 0 : bootloader locked
# - 1 : generic error
# - 101 : $DEVICE_ID missing
# - 102 : $ARCHIVE_PATH missing

ARCHIVE_PATH=$1
DEVICE_ID=$2

if [ -z $ARCHIVE_PATH ]
then
  exit 102
fi


if [ -z $DEVICE_ID ]
then
  exit 101
fi

fastboot -s $DEVICE_ID flash devinfo $ARCHIVE_PATH/devinfo-unlocked.gpx
sleep 1
fastboot -s $DEVICE_ID reboot bootloader

wait-fastboot.sh

0 → 100755
+74 −0
Original line number Diff line number Diff line
#!/bin/bash

# Copyright (C) 2020 ECORP SAS - Author: Romain Hunault
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Parameter
# $1: DEVICE_LOCKED_PATH device lock file (typically ${DEVICES_LOCKED_PATH}/${DEVICE})
# $2: DEVICE_ID id of the device

# Exit status
# - 0 : device unlocked (lock file deleted)
# - 1 : generic error
# - 101 : DEVICES_LOCKED_PATH missing
# - 102 : DEVICE_ID missing

DEVICES_LOCKED_PATH=$1
DEVICE_ID=$2

if [ -z $DEVICES_LOCKED_PATH ]
then
  exit 10
fi

if [ ! -z $DEVICE_ID ]
then
  while true
  do
    fastboot devices | grep --perl-regex "${DEVICE_ID}\tfastboot"
    if [ $? == 0 ]
    then

      exit 0
    fi
  done
fi

function newDevice
{
  for device in $(fastboot devices | grep fastboot | sed 's/\(.*\)\s*fastboot/\1/')
  do
    if [ ! -f ${DEVICES_LOCKED_PATH}/${device} ]
    then
      echo ${device}
    fi
  done
}

new_device=false

while ! $new_device
do
  DEVICE_ID=$(newDevice)

  if [ ! -z $DEVICE_ID ]
  then
    new_device=true
  fi

  sleep 1
done

echo ${DEVICE_ID}
Loading