12/28/2020

Android SDK Tools

1. UBOOT의 fastboot 명령 

  • Uboot의 fastboot 명령어 
=> fastboot --help
fastboot - run as a fastboot usb or udp device

Usage:
fastboot [-l addr] [-s size] usb <controller> | udp
        addr - address of buffer used during data transfers (0x98000000)
        size - size of buffer used during data transfers (0x19000000)

  • Uboot Fastboot Mode 설정 
fastboot usb 0을 설정 후 Window에서 USB Host에서 Board USB Gadget Download 생성됨 
=> fastboot 0
or 
=> fastboot usb 0


1.1 Android UBOOT CONFIG 관련설정 

Android Board에서 Uboot로 Booting 후 fastboot로 Android의 각 Partition을 Wrtie를 진행하면, 제대로 동작되지 않는데, 아래와 같이 Uboot 의 config를 수정  

CONFIG_FSL_FASTBOOT=y
CONFIG_FASTBOOT_LOCK=y  ## 이 부분제거해야 FAST_BOOT_LOCK이 되지 않는다.

UBOOT 관련내용 

Android Lock 관련내용 

A/B slot 문제


2.  Android SDK Tools 설치 및 실행 

Android SDK Tool은 아래 사이트에서 각 OS에 맞게 Download가 가능하다 

Android Studio가 설치가 되어있다면, SDK Manager에서 설치가능 


2.1 Window Android SDK Tools 


Uboot에서 Fastboot Mode 진입하면 아래와 같이 USB를 인식하여 Fastboot로 진행이 안됨

  • USB Download gadget
 


  • Android Studio->SDK Manager->SDK Tools 
  1. Android SDK Platform-Tools
  2. Google USB Driver 


상위와 같이 설치 했음에도 불구하구 Window 10에서 미인식됨 
하지만 이것을 Virtual Box에 Ubuntu 설치하여 이 USB Device를 Virtual Box로 넘기면, Virtual Box의 Ubuntu에서는 동작이 제대로 됨 

결론적으로 Window용 USB Driver를 별도 설치를 해야하며, WinUSB를 수정해야하는 것으로 파악된다. 
추후 이부분은 더 자세히 알아보도록하자. 



2.2 Linux Android SDK Tools 설치 및 실행 

Window에서 fastboot가 잘되지 않아 Virtual Box에 Linux 설치 후 테스트 진행했더니, 동작이 잘되어 아래와 같이 적어논다.





  • adb와 fastboot 설치 
$ sudo apt-get install android-tools-adb android-tools-fastboot 

  • 기본적인 fastboot 사용법 
$ fastboot --help
usage: fastboot [ <option> ] <command>

commands:
  update <filename>                        Reflash device from update.zip.
                                           Sets the flashed slot as active.
  flashall                                 Flash boot, system, vendor, and --
                                           if found -- recovery. If the device
                                           supports slots, the slot that has
                                           been flashed to is set as active.
                                           Secondary images may be flashed to
                                           an inactive slot.
  flash <partition> [ <filename> ]         Write a file to a flash partition.
  flashing lock                            Locks the device. Prevents flashing.
  flashing unlock                          Unlocks the device. Allows flashing
                                           any partition except
                                           bootloader-related partitions.
  flashing lock_critical                   Prevents flashing bootloader-related
                                           partitions.
  flashing unlock_critical                 Enables flashing bootloader-related
                                           partitions.
  flashing get_unlock_ability              Queries bootloader to see if the
                                           device is unlocked.
  flashing get_unlock_bootloader_nonce     Queries the bootloader to get the
                                           unlock nonce.
  flashing unlock_bootloader <request>     Issue unlock bootloader using request.
  flashing lock_bootloader                 Locks the bootloader to prevent
                                           bootloader version rollback.
  erase <partition>                        Erase a flash partition.
  format[:[<fs type="">][:[<size>]] <partition>
                                           Format a flash partition. Can
                                           override the fs type and/or size
                                           the bootloader reports.
  getvar <variable>                        Display a bootloader variable.
  set_active <slot>                        Sets the active slot. If slots are
                                           not supported, this does nothing.
  boot <kernel> [ <ramdisk> [ <second> ] ] Download and boot kernel.
  flash:raw <bootable-partition> <kernel> [ <ramdisk> [ <second> ] ]
                                           Create bootimage and flash it.
  devices [-l]                             List all connected devices [with
                                           device paths].
  continue                                 Continue with autoboot.
  reboot [bootloader|emergency]            Reboot device [into bootloader or emergency mode].
  reboot-bootloader                        Reboot device into bootloader.
  oem <parameter1> ... <parametern>        Executes oem specific command.
  stage <infile>                           Sends contents of <infile> to stage for
                                           the next command. Supported only on
                                           Android Things devices.
  get_staged <outfile>                     Receives data to <outfile> staged by the
                                           last command. Supported only on Android
                                           Things devices.
  help                                     Show this help message.

options:
  -w                                       Erase userdata and cache (and format
                                           if supported by partition type).
  -u                                       Do not erase partition before
                                           formatting.
  -s <specific device="">                     Specify a device. For USB, provide either
                                           a serial number or path to device port.
                                           For ethernet, provide an address in the
                                           form <protocol>:<hostname>[:port] where
                                           <protocol> is either tcp or udp.
  -c <cmdline>                             Override kernel commandline.
  -i <vendor id="">                           Specify a custom USB vendor id.
  -b, --base <base_addr>                   Specify a custom kernel base
                                           address (default: 0x10000000).
  --kernel-offset                          Specify a custom kernel offset.
                                           (default: 0x00008000)
  --ramdisk-offset                         Specify a custom ramdisk offset.
                                           (default: 0x01000000)
  --tags-offset                            Specify a custom tags offset.
                                           (default: 0x00000100)
  -n, --page-size <page size="">              Specify the nand page size
                                           (default: 2048).
  -S <size>[K|M|G]                         Automatically sparse files greater
                                           than 'size'. 0 to disable.
  --slot <slot>                            Specify slot name to be used if the
                                           device supports slots. All operations
                                           on partitions that support slots will
                                           be done on the slot specified.
                                           'all' can be given to refer to all slots.
                                           'other' can be given to refer to a
                                           non-current slot. If this flag is not
                                           used, slotted partitions will default
                                           to the current active slot.
  -a, --set-active[=<slot>]                Sets the active slot. If no slot is
                                           provided, this will default to the value
                                           given by --slot. If slots are not
                                           supported, this does nothing. This will
                                           run after all non-reboot commands.
  --skip-secondary                         Will not flash secondary slots when
                                           performing a flashall or update. This
                                           will preserve data on other slots.
  --skip-reboot                            Will not reboot the device when
                                           performing commands that normally
                                           trigger a reboot.
  --disable-verity                         Set the disable-verity flag in the
                                           the vbmeta image being flashed.
  --disable-verification                   Set the disable-verification flag in the vbmeta image being flashed.
  --wipe-and-use-fbe                       On devices which support it,
                                           erase userdata and cache, and
                                           enable file-based encryption
  --unbuffered                             Do not buffer input or output.
  --version                                Display version.
  -h, --help                               show this message.

2.1 Fastboot 실행 및 확인 

  • fastboot 준비사항 
우선 상위 Board의 Uboot에서 Fastboot Mode로 설정 후 Host에서 fastboot 명령어로 제어를 진행한다. 

  • fastboot device 정보 확인 
Board 의 Uboot에서 Fastboot 모드 일 경우 아래와 같이 Board 정보 확인가능 
$ sudo fastboot devices
051a700e828e4289	fastboot


  • fastboot flash unlock 진행 
나의 경우는 아래와 같이 fastboot flashing unlock 만 했더니 lock이 되었는데, 현재 각각의 차이점들은 알아가야 할 것 같다. 
$ sudo fastboot oem unlock

$ sudo fastboot flashing unlock

$ sudo fastboot flashing unlock_critical 


  • fastboot로 각 Partition write 진행 
각 Partition의 이름을 알아야 하면, 현재 a/b slot으로 구성되어있으므로, 각각의 Image를 write 후 reboot 진행 
$ sudo fastboot flash dtbo_a dtbo-imx8qxp-mipi.img

$ sudo fastboot flash boot_a boot.img

$ sudo fastboot reboot

관련내용참조 
  https://m.blog.naver.com/PostView.nhn?blogId=searphiel9&logNo=221367977833&proxyReferer=https:%2F%2Fwww.google.com%2F

댓글 없음 :