New issue
Advanced search Search tips

Issue 738360 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug

Blocked on:
issue 733918



Sign in to add a comment

factory: Replace shell scripts by python.

Project Member Reported by hungte@chromium.org, Jun 30 2017

Issue description

Currently we have a 'setup' folder containing sh scripts to help deploying various images for factory flow.
The setup will be directly packed into factory.zip from buildbot, and also appear in factory bundle.

However, it seems not easy to use python scripts in setup/ due to dependency - for example factory_common and cros.factory.utils. This is the reason why you won't see factory_finalize there, which "should" be inside factory bundle.

Per offline discussion, we think:

1. setup may be a good place as "what's released in the bundle to access directly", so we should move setup-related docs (for example BUNDLE.md) there, instead of having them in top level or doc/ folder.

2. The long term goal is to change scripts in setup/ into Python, and make them integrated as a PAR so it's easier for partner to execute.

3. To make sure the PAR will be always executable, we want to create a new py/setup folder so scripts targeting to live in platform/factory/setup/ must use symlinks to py/setup, and deps.conf will make sure py/setup/* can only use known dependencies like cros.factory.utils.
 

Comment 1 by hungte@chromium.org, Jul 14 2017

Cc: -youcheng@chromium.org -petershih@chromium.org -yhong@chromium.org -phoenixshen@chromium.org -pihsun@chromium.org -yllin@chromium.org -stimim@chromium.org chromeos-factory-eng@google.com

Comment 2 by hungte@chromium.org, Sep 26 2017

Owner: chenghan@chromium.org
Status: Assigned (was: Untriaged)
Assign to noogler. This is low priority.

Comment 3 by hungte@chromium.org, Sep 27 2017

Blockedon: 733918
Summary: factory: Replace shell scripts by python. (was: factory: refactor 'setup' folder)
I think it's time to start converting all sh scripts to python.

There is only one reason to do sh - if we have a script that need to run on "release images".

The test image always have python.

Factory installer and netboot installer does not have python (yet), but I believe we can fix that by introducing tools like py2exe (see issue 733918).

So let's try this:

1. Convert all scripts in setup/ to be python, since setup is supposed to run on servers or desktop that python is not a problem.

2. Convert sh/* to python (if it does not need to be executed by factory installer), since test images all have python.

3. Solve issue 733918, to make factory installer able to run an packaged python

4. Convert all scripts left in factory repository to use packaged python

6. Convert all scripts left in factory_install to use packaged python.

Comment 4 by hungte@chromium.org, Mar 31 2018

Owner: hungte@chromium.org
Status: Started (was: Assigned)
Project Member

Comment 5 by bugdroid1@chromium.org, Apr 3 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/fc035fb0943dbd0185a385788ba8eb2481edef2a

commit fc035fb0943dbd0185a385788ba8eb2481edef2a
Author: Hung-Te Lin <hungte@chromium.org>
Date: Tue Apr 03 12:56:54 2018

tools: Add new 'image_tool' for various setup/deploy utilities.

The scripts in setup/ were written in simple bash/dash in order for
partners to execute them without much dependency. However, the shell
scripts are bloated and very hard to maintain recently.

Since most partners setting up factory servers are using Ubuntu today
and all running Python 2.6, it should be fine to assume Python is
available and stop using shell scripts.

This change adds a new 'image_tool' command with dummy implementation
that will replace all scripts dealing with image creation or processing
in future, for example:

     mount_partition => image_tool mount IMAGE PART MOUNTPOINT

BUG= chromium:738360 
TEST=make test;

Change-Id: Ia3fc3ffb8be8a58f6e34d54955fff0aeaf97d141
Reviewed-on: https://chromium-review.googlesource.com/987673
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>

[add] https://crrev.com/fc035fb0943dbd0185a385788ba8eb2481edef2a/py/tools/image_tool.py
[add] https://crrev.com/fc035fb0943dbd0185a385788ba8eb2481edef2a/setup/image_tool
[add] https://crrev.com/fc035fb0943dbd0185a385788ba8eb2481edef2a/setup/lib/deprecated.sh

Project Member

Comment 6 by bugdroid1@chromium.org, Apr 9 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/b1a31db725333186a84cf584e7e12a40c08e9455

commit b1a31db725333186a84cf584e7e12a40c08e9455
Author: Hung-Te Lin <hungte@chromium.org>
Date: Mon Apr 09 19:42:27 2018

tools: image_tool: Support mapping sub commands to known symlinks.

To make it easier accessing image_tool and to support legacy commands
better, we want to allow invoking sub commands by using symlink names,
just like PAR.

BUG= chromium:738360 
TEST=make test; (after mount command is implemented)
      ln -s ./image_tool.py mount_partition; ./mount_partition IMAGE 3 /media

Change-Id: Ie66f3f21f9910ccb872aa39661507ea3b525a3e8
Reviewed-on: https://chromium-review.googlesource.com/1001157
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>

[modify] https://crrev.com/b1a31db725333186a84cf584e7e12a40c08e9455/py/tools/image_tool.py

Project Member

Comment 7 by bugdroid1@chromium.org, Apr 9 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/40e0c1016ed71a1732aff03a2b84338ba037abff

commit 40e0c1016ed71a1732aff03a2b84338ba037abff
Author: Hung-Te Lin <hungte@chromium.org>
Date: Mon Apr 09 19:42:23 2018

tools: Add new 'tiny_par' for releasing setup tools easier.

The 'make_par' will always pack whole Chromium OS factory code,
which is bloated and may cause extra dependency issue when deployed to
partners (with limited Python environment).

As a result, we do want to have a way to execute bundled Python programs
in a very lightweight way. The tiny_par includes only explicitly
specified programs in compiled form and is very tiny and speedy for
execution.

For example, a single 'pygpt' bundle by tiny_par is 25516 bytes in size,
while the factory-mini.par from make_par is 1084560 bytes, and
the factory.par from make_par is 4883203 bytes.

BUG= chromium:738360 
TEST=make test;
    ./cros/factory/tools/tiny_par \
      --pkg ~/trunk/src/platform/factory/py_pkg \
      -o pygpt -m cros.factory.utils.pygpt; ./pygpt -h

Change-Id: Iffc1bfa39b303fc4da8cb6fc2717f646f005bf39
Reviewed-on: https://chromium-review.googlesource.com/989459
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>

[add] https://crrev.com/40e0c1016ed71a1732aff03a2b84338ba037abff/bin/tiny_par
[add] https://crrev.com/40e0c1016ed71a1732aff03a2b84338ba037abff/py/tools/tiny_par_unittest.py
[add] https://crrev.com/40e0c1016ed71a1732aff03a2b84338ba037abff/py/tools/testdata/par_test.py
[add] https://crrev.com/40e0c1016ed71a1732aff03a2b84338ba037abff/py/tools/testdata/__init__.py
[add] https://crrev.com/40e0c1016ed71a1732aff03a2b84338ba037abff/py/tools/tiny_par.py

Project Member

Comment 8 by bugdroid1@chromium.org, Apr 9 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/3dd76201689774d85bd5ebef84791da3ffff12a0

commit 3dd76201689774d85bd5ebef84791da3ffff12a0
Author: Hung-Te Lin <hungte@chromium.org>
Date: Mon Apr 09 19:42:24 2018

mk: Revise deploy script to prepare setup folder properly.

The old factory server (and shopfloor) have been deprecated for a while
so invoking 'factory.par factory_server' or
'factory.par shopfloor[_server]' actually won't work.

As a result, we are revising the bundle creation for the new single tool
'image_tool' by the help of 'tiny_par'. No need to have the huge
factory.par in setup/ folder.

BUG= chromium:738360 
TEST=make test; make bundle

Change-Id: Idb57336990f6e4e42b272793e0349e07b9ff7fef
Reviewed-on: https://chromium-review.googlesource.com/989460
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>

[add] https://crrev.com/3dd76201689774d85bd5ebef84791da3ffff12a0/bin/image_tool
[add] https://crrev.com/3dd76201689774d85bd5ebef84791da3ffff12a0/devtools/mk/setup_tools_modules.lst
[modify] https://crrev.com/3dd76201689774d85bd5ebef84791da3ffff12a0/devtools/mk/bundle.sh
[modify] https://crrev.com/3dd76201689774d85bd5ebef84791da3ffff12a0/Makefile
[modify] https://crrev.com/3dd76201689774d85bd5ebef84791da3ffff12a0/setup/BUNDLE.md

Project Member

Comment 9 by bugdroid1@chromium.org, Apr 9 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/3e5930298da140514e71ff2f51a0745d2cd115b5

commit 3e5930298da140514e71ff2f51a0745d2cd115b5
Author: Hung-Te Lin <hungte@chromium.org>
Date: Mon Apr 09 19:42:25 2018

setup: Move setup/netboot_firmware_settings to tools.

The netboot_firmware_settings needs to find fmap, which makes it pretty
difficult to deploy related files properly while maintaining the correct
import list for both factory environment (full toolkit) and server setup
(bare Ubuntu) environment.

The new tiny_par provides a good solution by packaging all needed
modules into the PAR file, which helped us to eliminate the `fmap.py` in
setup folder.

BUG= chromium:738360 
TEST=make test; make bundle

Change-Id: I47d387c20012ba17183efebb1c5c201abe7da783
Reviewed-on: https://chromium-review.googlesource.com/989461
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>

[modify] https://crrev.com/3e5930298da140514e71ff2f51a0745d2cd115b5/py/tools/finalize_bundle.py
[rename] https://crrev.com/3e5930298da140514e71ff2f51a0745d2cd115b5/py/tools/netboot_firmware_settings.py
[delete] https://crrev.com/3dd76201689774d85bd5ebef84791da3ffff12a0/setup/fmap.py
[modify] https://crrev.com/3e5930298da140514e71ff2f51a0745d2cd115b5/devtools/mk/setup_tools_modules.lst
[modify] https://crrev.com/3e5930298da140514e71ff2f51a0745d2cd115b5/devtools/mk/bundle.sh
[modify] https://crrev.com/3e5930298da140514e71ff2f51a0745d2cd115b5/setup/BUNDLE.md
[add] https://crrev.com/3e5930298da140514e71ff2f51a0745d2cd115b5/setup/netboot_firmware_settings

Cc: marcochen@chromium.org
Project Member

Comment 11 by bugdroid1@chromium.org, Apr 11 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/e5f5efc3655b87ae3b27d37368242a63aeedcb46

commit e5f5efc3655b87ae3b27d37368242a63aeedcb46
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed Apr 11 02:12:38 2018

tools: image_tool: Implement 'netboot' command.

Include the "netboot_firmware_settings" as 'image_tool netboot'.  Usage:

 ./image_tool netboot -i NETBOOT.bin .....

Example:

 ./image_tool netboot -i image.net.bin

BUG= chromium:738360 
TEST=make test; ./image_tool netboot -i image.net.bin

Change-Id: I013c001c6205af522362b3518b6c1c5ab48e6816
Reviewed-on: https://chromium-review.googlesource.com/1000996
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>

[modify] https://crrev.com/e5f5efc3655b87ae3b27d37368242a63aeedcb46/py/tools/finalize_bundle.py
[modify] https://crrev.com/e5f5efc3655b87ae3b27d37368242a63aeedcb46/py/tools/netboot_firmware_settings.py
[modify] https://crrev.com/e5f5efc3655b87ae3b27d37368242a63aeedcb46/py/tools/image_tool.py
[modify] https://crrev.com/e5f5efc3655b87ae3b27d37368242a63aeedcb46/devtools/mk/bundle.sh
[modify] https://crrev.com/e5f5efc3655b87ae3b27d37368242a63aeedcb46/setup/BUNDLE.md
[modify] https://crrev.com/e5f5efc3655b87ae3b27d37368242a63aeedcb46/setup/lib/deprecated.sh
[modify] https://crrev.com/e5f5efc3655b87ae3b27d37368242a63aeedcb46/setup/netboot_firmware_settings

Project Member

Comment 12 by bugdroid1@chromium.org, Apr 11 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/5f2e843793a7396f6c17c8ef0795a529598c239f

commit 5f2e843793a7396f6c17c8ef0795a529598c239f
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed Apr 11 02:12:37 2018

tools: image_tool: Implement 'mount' command.

Implement the mount_partition script as 'image_tool mount'. Usage:

 ./image_tool mount IMAGE PARTNO MOUNTPOINT

Example:

 ./image_tool mount chromiumos_test_image.bin 3 /media

Current implementation is based on pygpt.

BUG= chromium:738360 
TEST=make test; ./image_tool mount IMAGE 3 /media

Change-Id: I784585d8787f86a9a39d734ab5a693cc27c3a0f1
Reviewed-on: https://chromium-review.googlesource.com/989532
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>

[delete] https://crrev.com/f101bebb09958b0654a26818f6c36d337bb8d1eb/py/tools/mount_partition.py
[modify] https://crrev.com/5f2e843793a7396f6c17c8ef0795a529598c239f/bin/mount_partition
[modify] https://crrev.com/5f2e843793a7396f6c17c8ef0795a529598c239f/py/tools/image_tool.py
[modify] https://crrev.com/5f2e843793a7396f6c17c8ef0795a529598c239f/setup/BUNDLE.md
[modify] https://crrev.com/5f2e843793a7396f6c17c8ef0795a529598c239f/setup/lib/deprecated.sh
[rewrite] https://crrev.com/5f2e843793a7396f6c17c8ef0795a529598c239f/setup/mount_partition.sh

Project Member

Comment 13 by bugdroid1@chromium.org, Apr 11 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/a24fc2b5343911c50aec2bb6944425b4b820d0e5

commit a24fc2b5343911c50aec2bb6944425b4b820d0e5
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed Apr 11 02:12:38 2018

tools: image_tool: Implement 'get_firmware' command.

Implement the extract_firmware_updater script as 'image_tool get_firmware'.
Usage:

 ./image_tool get_firmware -i IMAGE [-o OUTPUT]

Example:

 ./image_tool get_firmware -i chromiumos_test_image.bin -o test

BUG= chromium:738360 
TEST=make test; ./image_tool get_firmware -i IMAGE

Change-Id: I833b2849d8b1c3903809800aee3f3798f6a57fd0
Reviewed-on: https://chromium-review.googlesource.com/989533
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>

[rewrite] https://crrev.com/a24fc2b5343911c50aec2bb6944425b4b820d0e5/setup/extract_firmware_updater.sh
[modify] https://crrev.com/a24fc2b5343911c50aec2bb6944425b4b820d0e5/setup/make_factory_package.sh
[modify] https://crrev.com/a24fc2b5343911c50aec2bb6944425b4b820d0e5/py/tools/image_tool.py
[modify] https://crrev.com/a24fc2b5343911c50aec2bb6944425b4b820d0e5/setup/BUNDLE.md
[modify] https://crrev.com/a24fc2b5343911c50aec2bb6944425b4b820d0e5/setup/lib/deprecated.sh
[modify] https://crrev.com/a24fc2b5343911c50aec2bb6944425b4b820d0e5/README.md

Project Member

Comment 14 by bugdroid1@chromium.org, Apr 11 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/19871e31a672862867c53e6fee2e3d6dec64f790

commit 19871e31a672862867c53e6fee2e3d6dec64f790
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed Apr 11 11:39:05 2018

tools: image_tool: Implement 'resize' command.

Implement the resize_image_fs script as 'image_tool resize'.  Usage:

 ./image_tool resize -i IMAGE [-p PARTNO] [-s SIZE] [-a|--no-append]

Example:

 ./image_tool resize -i chromiumos_test_image.bin -s 1024

BUG= chromium:738360 
TEST=make test; ./image_tool resize IMAGE -s 1 -p 3

Change-Id: I7a842e0c07a16ff9cebc0f8f936fe125708c3469
Reviewed-on: https://chromium-review.googlesource.com/989534
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>

[modify] https://crrev.com/19871e31a672862867c53e6fee2e3d6dec64f790/setup/make_factory_package.sh
[modify] https://crrev.com/19871e31a672862867c53e6fee2e3d6dec64f790/py/tools/image_tool.py
[modify] https://crrev.com/19871e31a672862867c53e6fee2e3d6dec64f790/setup/BUNDLE.md
[rewrite] https://crrev.com/19871e31a672862867c53e6fee2e3d6dec64f790/setup/resize_image_fs.sh
[modify] https://crrev.com/19871e31a672862867c53e6fee2e3d6dec64f790/setup/lib/deprecated.sh

Project Member

Comment 15 by bugdroid1@chromium.org, Apr 11 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/7da415f145934e4128499dcbb31a294ab021275c

commit 7da415f145934e4128499dcbb31a294ab021275c
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed Apr 11 15:05:08 2018

tools: image_tool: Implement 'docker' command.

Implement the "make_docker_image" as 'image_tool docker'.  Usage:

 ./image_tool docker -i IMAGE

Example:

 ./image_tool docker -i chromiumos_test_image.bin

BUG= chromium:738360 
TEST=make test; ./image_tool docker -i IMAGE

Change-Id: Ie8bf98d5341a7329eabc4259cff15e3c82c3fe3a
Reviewed-on: https://chromium-review.googlesource.com/1001079
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>

[modify] https://crrev.com/7da415f145934e4128499dcbb31a294ab021275c/py/tools/image_tool.py
[rewrite] https://crrev.com/7da415f145934e4128499dcbb31a294ab021275c/setup/make_docker_image.sh
[modify] https://crrev.com/7da415f145934e4128499dcbb31a294ab021275c/setup/cros_docker.sh
[modify] https://crrev.com/7da415f145934e4128499dcbb31a294ab021275c/setup/lib/deprecated.sh

Project Member

Comment 16 by bugdroid1@chromium.org, Apr 11 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/7f123144317aa6293f7ca26597528d90d62ad128

commit 7f123144317aa6293f7ca26597528d90d62ad128
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed Apr 11 15:05:06 2018

tools: image_tool: Implement 'preflash' command.

Implement the "make_factory_package --diskimg" as 'image_tool preflash'.  Usage:

 ./image_tool preflash -o OUTPUT [-s sectors]

Example:

 ./image_tool preflash -o disk_16g.bin

One advantage over legacy make_factory_package is now we support loading
resources automatically following factory bundle structure, so you don't
need to specify input files one by one. Just put them into:

  ./release_image/recovery_image.bin
  ./test_image/chromiumos_test_image.bin
  ./toolkit/install_factory_toolkit.run
  ./hwid/hwid_bundle_XXX.sh

And run in same folder with only [-o], then image_tool will find and use
the files magically.

BUG= chromium:738360 
TEST=make test; ./image_tool preflash -o IMAGE

Change-Id: Ife037e735061c6eb1199f32a98ea03cb40d97f1c
Reviewed-on: https://chromium-review.googlesource.com/989632
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/7f123144317aa6293f7ca26597528d90d62ad128/setup/make_factory_package.sh
[modify] https://crrev.com/7f123144317aa6293f7ca26597528d90d62ad128/py/tools/image_tool.py
[modify] https://crrev.com/7f123144317aa6293f7ca26597528d90d62ad128/README.md
[modify] https://crrev.com/7f123144317aa6293f7ca26597528d90d62ad128/setup/lib/deprecated.sh

Project Member

Comment 17 by bugdroid1@chromium.org, Apr 11 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/75daa2de5912685548a4b92fc576ba6418431c2b

commit 75daa2de5912685548a4b92fc576ba6418431c2b
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed Apr 11 15:05:07 2018

tools: image_tool: Implement 'rma' command.

Implement the "make_factory_package --usbimg" as 'image_tool rma'.  Usage:

 ./image_tool rma -o OUTPUT [bundle parameters...]

Example:

 ./image_tool rma -o rma.bin

Same as 'image_tool preflash', if we run the command inside factory
bundle then all needed resources will be loaded automatically.

Removed make-factory-package presubmit check because that should be
done by unittest of image_tool in future.

Also removed pygpt symlink because this was the only place calling pygpt
from command line, and it's now replaced by directly using Python
module.

BUG= chromium:738360 
TEST=make test; ./image_tool rma -o IMAGE

Change-Id: I878cc93f3478f882ac4941e99fffd517590b6134
Reviewed-on: https://chromium-review.googlesource.com/989636
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>

[modify] https://crrev.com/75daa2de5912685548a4b92fc576ba6418431c2b/devtools/mk/presubmit-test.py
[delete] https://crrev.com/7f123144317aa6293f7ca26597528d90d62ad128/setup/pygpt
[modify] https://crrev.com/75daa2de5912685548a4b92fc576ba6418431c2b/Makefile
[rewrite] https://crrev.com/75daa2de5912685548a4b92fc576ba6418431c2b/setup/make_factory_package.sh
[modify] https://crrev.com/75daa2de5912685548a4b92fc576ba6418431c2b/py/tools/image_tool.py
[modify] https://crrev.com/75daa2de5912685548a4b92fc576ba6418431c2b/devtools/mk/bundle.sh
[modify] https://crrev.com/75daa2de5912685548a4b92fc576ba6418431c2b/setup/BUNDLE.md
[modify] https://crrev.com/75daa2de5912685548a4b92fc576ba6418431c2b/setup/lib/deprecated.sh
[modify] https://crrev.com/75daa2de5912685548a4b92fc576ba6418431c2b/README.md
[delete] https://crrev.com/7f123144317aa6293f7ca26597528d90d62ad128/py/tools/test_make_factory_package.py

Project Member

Comment 18 by bugdroid1@chromium.org, Apr 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/db0fef5c24b19db932d32ea6565231ca936f0ce0

commit db0fef5c24b19db932d32ea6565231ca936f0ce0
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri Apr 13 03:34:52 2018

tools: image_tool: Implement 'merge_rma' command.

Implement the "merge_factory_usbimg" as 'image_tool merge_rma'.  Usage:

 ./image_tool merge_rma -o OUTPUT -i RMA1 RMA2 ...

Example:

 ./image_tool merge_rma -o output.bin -i rma1.bin rma2.bin

BUG= chromium:738360 
TEST=make test;
     ./image_tool rma -o rma1.bin -b board1;
     ./image_tool rma -o rma2.bin -b board2;
     ./image_tool merge_rma -o output.bin -i rma1.bin rma2.bin

Change-Id: I2c44b2041b6f6c592933b5b1adb60612213b0493
Reviewed-on: https://chromium-review.googlesource.com/1002349
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Youcheng Syu <youcheng@chromium.org>

[modify] https://crrev.com/db0fef5c24b19db932d32ea6565231ca936f0ce0/py/tools/image_tool.py
[rewrite] https://crrev.com/db0fef5c24b19db932d32ea6565231ca936f0ce0/setup/merge_factory_usbimg.sh
[modify] https://crrev.com/db0fef5c24b19db932d32ea6565231ca936f0ce0/setup/BUNDLE.md
[modify] https://crrev.com/db0fef5c24b19db932d32ea6565231ca936f0ce0/setup/lib/deprecated.sh

Project Member

Comment 19 by bugdroid1@chromium.org, Apr 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/5f69dbd452bbea140deaffb2628be5a3d9018e0a

commit 5f69dbd452bbea140deaffb2628be5a3d9018e0a
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri Apr 13 03:34:53 2018

tools: image_tool: Implement 'edit_lsb' command.

Implement the "edit_lsb_factory" as 'image_tool edit_lsb'.  Usage:

 ./image_tool edit_lsb -i FACTORY_INSTALL_IMAGE

Example:

 ./image_tool edit_lsb -i factory_shim/factory_install.bin

Also removed factory_common.sh and lib/cros_image_common.sh since there
are no more scripts using them.

BUG= chromium:738360 
TEST=make test; ./image_tool edit_lsb -i rma.bin

Change-Id: Id0b39a75418db1c9059da4f685dae6f98b492a89
Reviewed-on: https://chromium-review.googlesource.com/1002436
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>

[rewrite] https://crrev.com/5f69dbd452bbea140deaffb2628be5a3d9018e0a/setup/edit_lsb_factory.sh
[delete] https://crrev.com/db0fef5c24b19db932d32ea6565231ca936f0ce0/setup/factory_common.sh
[delete] https://crrev.com/db0fef5c24b19db932d32ea6565231ca936f0ce0/setup/lib/cros_image_common.sh
[modify] https://crrev.com/5f69dbd452bbea140deaffb2628be5a3d9018e0a/py/tools/image_tool.py
[modify] https://crrev.com/5f69dbd452bbea140deaffb2628be5a3d9018e0a/setup/BUNDLE.md
[modify] https://crrev.com/5f69dbd452bbea140deaffb2628be5a3d9018e0a/setup/lib/deprecated.sh
[modify] https://crrev.com/5f69dbd452bbea140deaffb2628be5a3d9018e0a/sh/cutoff/README.md
[modify] https://crrev.com/5f69dbd452bbea140deaffb2628be5a3d9018e0a/README.md

Project Member

Comment 20 by bugdroid1@chromium.org, Apr 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/3de26373f417869bfc5eca403108f772ccd33c2c

commit 3de26373f417869bfc5eca403108f772ccd33c2c
Author: Hung-Te Lin <hungte@chromium.org>
Date: Fri Apr 13 03:34:55 2018

mk: Check if setup_tools.par and image_tool is working properly.

If some dependency was added to image_tool (or its dependent modules)
without including them in devtools/mk/setup_tools_modules.lst, the
invocation of setup_tools.par will fail.

Same as factory.par, we should do a minimal check when building
setup_tools.par.

BUG= chromium:738360 
TEST=make par

Change-Id: I8fa6781f7af030546129f4b9fda0fed574bd05fc
Reviewed-on: https://chromium-review.googlesource.com/1009244
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>

[modify] https://crrev.com/3de26373f417869bfc5eca403108f772ccd33c2c/Makefile

Status: Fixed (was: Started)
The major work is done. We've left few - create_hwid_bundle and cros_docker script not changed.

Not sure if we'll change cros_docker in future, since it has a totally different scope. 

Changing create_hwid_bundle is not urgent.

For now, I think we've covered most topics here. There may be future integration, but this issue can be considered as fixed.
Project Member

Comment 22 by bugdroid1@chromium.org, Apr 16 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/aa077d48c23fb58a8cab203b143a75ea01835d1e

commit aa077d48c23fb58a8cab203b143a75ea01835d1e
Author: Hung-Te Lin <hungte@chromium.org>
Date: Mon Apr 16 08:45:15 2018

setup: Remove deprecated scripts.

All the tool scripts have been merged by image_tool and it's fine to
remove the migration warning scripts now.

BUG= chromium:738360 
TEST=make test

Change-Id: I42446136b742ffe289b89a3c85527fa4b7d45cd9
Reviewed-on: https://chromium-review.googlesource.com/1006458
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>

[delete] https://crrev.com/385d35ea28c43374bacd14ab3fc781186a2423da/setup/edit_lsb_factory.sh
[delete] https://crrev.com/385d35ea28c43374bacd14ab3fc781186a2423da/setup/extract_firmware_updater.sh
[delete] https://crrev.com/385d35ea28c43374bacd14ab3fc781186a2423da/setup/make_factory_package.sh
[delete] https://crrev.com/385d35ea28c43374bacd14ab3fc781186a2423da/setup/netboot_firmware_settings
[delete] https://crrev.com/385d35ea28c43374bacd14ab3fc781186a2423da/setup/resize_image_fs.sh
[delete] https://crrev.com/385d35ea28c43374bacd14ab3fc781186a2423da/setup/lib/deprecated.sh
[delete] https://crrev.com/385d35ea28c43374bacd14ab3fc781186a2423da/setup/mount_partition.sh
[delete] https://crrev.com/385d35ea28c43374bacd14ab3fc781186a2423da/setup/make_docker_image.sh
[delete] https://crrev.com/385d35ea28c43374bacd14ab3fc781186a2423da/setup/merge_factory_usbimg.sh

Project Member

Comment 23 by bugdroid1@chromium.org, Apr 17 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/6c7afaaa140e5cc2c3eb98f0ef6a4470ea6cd6d7

commit 6c7afaaa140e5cc2c3eb98f0ef6a4470ea6cd6d7
Author: Hung-Te Lin <hungte@chromium.org>
Date: Tue Apr 17 11:02:28 2018

tools: image_tool: Add 'bundle' command.

Add a new command 'bundle' to create factory bundle. This is similar to
finalize_bundle, except it can take resources from command line directly
or scan from current folder, which makes it even easier to create a
bundle by extracting a factory zip file. Usage:

 ./image_tool bundle -p PHASE -n NOTES --server_url URL

Example:

 ./image_tool bundle -p evt -n "First release" \
   --server_url http://192.168.30.11:8080

Note "--firmware none" is also replaced by "--no-firmware" to prevent
confusion.

BUG= chromium:738360 
TEST=make test; ./image_tool bundle -v

Change-Id: I3293ffc67961e853b5d82e92c06021bd36194991
Reviewed-on: https://chromium-review.googlesource.com/1007463
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Youcheng Syu <youcheng@chromium.org>

[modify] https://crrev.com/6c7afaaa140e5cc2c3eb98f0ef6a4470ea6cd6d7/py/tools/image_tool.py
[modify] https://crrev.com/6c7afaaa140e5cc2c3eb98f0ef6a4470ea6cd6d7/setup/BUNDLE.md

Project Member

Comment 24 by bugdroid1@chromium.org, Apr 18 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/63c38286d43892dabc236ca4bbf6a1040435996f

commit 63c38286d43892dabc236ca4bbf6a1040435996f
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed Apr 18 14:08:01 2018

devtools: Add all needed ELF libraries for bundle/setup.

The binary ELF programs in setup (cgpt and futility) were dynamically
linked in chroot. To deploy them properly, we need the underlying
libraries. The lddtree tool from chromite allows scanning and copying
ELF binary and libraries, with wrapper scripts generated and is the best
solution for deployment.

The folder name to contain ELF binaries is called "libx64" because
currently our chroot only contains x86_64 binaries.

BUG= chromium:738360 
TEST=make test; make bundle; build/bundle/setup/cgpt

Change-Id: I164da0da776c4fdbbcb6831d001f09b46ff93f67
Reviewed-on: https://chromium-review.googlesource.com/1004073
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Youcheng Syu <youcheng@chromium.org>

[modify] https://crrev.com/63c38286d43892dabc236ca4bbf6a1040435996f/devtools/mk/bundle.sh

Project Member

Comment 25 by bugdroid1@chromium.org, Apr 25 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/9f6165fc94fc8f9fa63e851c74ec234d99095c5f

commit 9f6165fc94fc8f9fa63e851c74ec234d99095c5f
Author: Hung-Te Lin <hungte@chromium.org>
Date: Wed Apr 25 21:40:38 2018

tools: image_tool: Replace cgpt by pygpt.

Invoke pygpt as python module or as standalone utility. This helps
preventing dependency on `cgpt` utility and is more flexible.

BUG= chromium:738360 , chromium:834237 
TEST=make test; bundle/setup/image_tool preflash -o disk.bin

Change-Id: Ie49d7dbce16e6821d17dfd3c16a1d8aadfa97c7e
Reviewed-on: https://chromium-review.googlesource.com/1013437
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Youcheng Syu <youcheng@chromium.org>

[modify] https://crrev.com/9f6165fc94fc8f9fa63e851c74ec234d99095c5f/py/tools/image_tool.py

Project Member

Comment 26 by bugdroid1@chromium.org, May 3 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/a34f890e47126b68e4a2546351017cda7b76a0d9

commit a34f890e47126b68e4a2546351017cda7b76a0d9
Author: Hung-Te Lin <hungte@chromium.org>
Date: Thu May 03 05:20:32 2018

tools: image_tool: Revise 'merge_rma' command for simpler process.

The GPT* functions are not really related to Partition objects.
As a result, merge_rma should use the pygpt objects directly
and build images in an easier and faster way.

BUG= chromium:738360 
TEST=make test

Change-Id: I32a0b60bdfa98a44dc32032d781e170fb15aa3ef
Reviewed-on: https://chromium-review.googlesource.com/1016740
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Youcheng Syu <youcheng@chromium.org>

[modify] https://crrev.com/a34f890e47126b68e4a2546351017cda7b76a0d9/py/tools/image_tool.py

Project Member

Comment 27 by bugdroid1@chromium.org, May 8 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/92072cbaebe877ee278c53d8003d6be936b55e6d

commit 92072cbaebe877ee278c53d8003d6be936b55e6d
Author: Hung-Te Lin <hungte@chromium.org>
Date: Tue May 08 08:22:02 2018

Makefile: Fix build break in emerge-$BOARD factory.

CL:1004073 switched to use `lddtree` to copy the required
binary files /usr/bin/cgpt and /usr/bin/futility into the factory
bundle directory.  It works fine when we type `make bundle` in the
factory repository.  However, running `emerge factory` will fail
because the environment variable `ROOT=/build/<board_name>/` causes
`lddtree` to search files in the board root directory and will
fail. As a result we want to stick with ROOT=/.

BUG= chromium:738360 
TEST=emerge-<board_name> factory

Change-Id: Id3ec6f69ed45748f0c42adb7213fc6959c5f152a
Reviewed-on: https://chromium-review.googlesource.com/1047005
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yong Hong <yhong@google.com>

[modify] https://crrev.com/92072cbaebe877ee278c53d8003d6be936b55e6d/devtools/mk/bundle.sh
[modify] https://crrev.com/92072cbaebe877ee278c53d8003d6be936b55e6d/Makefile

Project Member

Comment 28 by bugdroid1@chromium.org, May 8 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/cb450b084982c2f78adf32e1aeead229e1c821c3

commit cb450b084982c2f78adf32e1aeead229e1c821c3
Author: Hung-Te Lin <hungte@chromium.org>
Date: Tue May 08 20:17:16 2018

Makefile: Revise setup-binary related comments and bundle code.

Address comments from CL:1047005 to provide more details of why we choose '/'
for SETUP_BIN and make bundle shell script more bash-style.

BUG= chromium:738360 
TEST=emerge-<board_name> factory

Change-Id: I7712489bb19b4536cc9b8db17a0b35e5f9eedd6c
Reviewed-on: https://chromium-review.googlesource.com/1049353
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/cb450b084982c2f78adf32e1aeead229e1c821c3/devtools/mk/bundle.sh
[modify] https://crrev.com/cb450b084982c2f78adf32e1aeead229e1c821c3/Makefile

Sign in to add a comment