Amin Hassani | c7febef | 2021-05-04 11:26:22 -0700 | [diff] [blame^] | 1 | # Copyright 2021 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | """A script to generate MiniOS kernel images. |
| 6 | |
| 7 | And inserting them into the Chromium OS images. |
| 8 | """ |
| 9 | |
| 10 | import tempfile |
| 11 | |
| 12 | from chromite.lib import commandline |
| 13 | from chromite.lib import minios |
| 14 | |
| 15 | |
| 16 | def GetParser(): |
| 17 | """Creates an argument parser and returns it.""" |
| 18 | parser = commandline.ArgumentParser(description=__doc__) |
| 19 | parser.add_argument('--board', '-b', '--build-target', required=True, |
| 20 | help='The board name.') |
| 21 | parser.add_argument('--image', type='path', |
| 22 | help='The path to the chromium os image.') |
| 23 | return parser |
| 24 | |
| 25 | |
| 26 | def main(argv): |
| 27 | parser = GetParser() |
| 28 | opts = parser.parse_args(argv) |
| 29 | opts.Freeze() |
| 30 | |
| 31 | with tempfile.TemporaryDirectory() as work_dir: |
| 32 | kernel = minios.CreateMiniOsKernelImage(opts.board, work_dir) |
| 33 | minios.InsertMiniOsKernelImage(opts.image, kernel) |