blob: 8e0d89226ed9f6d0ba7bf1e01ac282db4372dc53 [file] [log] [blame]
Amin Hassanic7febef2021-05-04 11:26:22 -07001# 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
7And inserting them into the Chromium OS images.
8"""
9
10import tempfile
11
12from chromite.lib import commandline
13from chromite.lib import minios
14
15
16def 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
26def 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)