Skip to content

Commit

Permalink
KERNEL: Optimize source code to build the kernel
Browse files Browse the repository at this point in the history
Signed-off-by: ut003460 <[email protected]>

Omitted the requirement for multiprocessing. CPU_ Call count() and use None as the default value for njobs.
We will check if njobs is a positive number, and if so, link the '- j' option with its value and add it to
make_ Args list. Then, based on the binary_ Determine whether to add 'deb pkg' to make based on the conditions of
package and distribution name_ Args list. Finally, we use spaces to make_ Connect the strings in the args list and
call the build. make() function to perform the build operation
  • Loading branch information
ut003460 committed Aug 9, 2023
1 parent bd72146 commit 9eb36d5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions avocado/utils/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,12 @@ def build(self, binary_package=False, njobs=multiprocessing.cpu_count()):
make_args = []
LOG.info("Starting build the kernel")

if njobs is None:
make_args.append("-j")
elif njobs > 0:
make_args.extend(["-j", str(njobs)])
if njobs is not None and njobs > 0:
make_args.append("-j" + str(njobs))
make_args.extend(["-C", self._build_dir])

if binary_package is True:
if self.distro.name == "Ubuntu":
make_args.append("deb-pkg")
if binary_package and self.distro.name == "Ubuntu":
make_args.append("deb-pkg")

build.make(self._build_dir, extra_args=" ".join(make_args))

Expand Down

0 comments on commit 9eb36d5

Please sign in to comment.