Loading...
# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.

"""Create Ubuntu test disk images"""

from img.common import setup_extlinux_image


def setup_ubuntu_image(config, log, devnum, basename, version='24.04.1 LTS'):
    """Create a 20MB Ubuntu disk image with a single FAT partition

    Args:
        config (ArbitraryAttributeContainer): Configuration
        log (multiplexed_log.Logfile): Log to write to
        devnum (int): Device number to use, e.g. 1
        basename (str): Base name to use in the filename, e.g. 'mmc'
    """
    vmlinux = 'vmlinuz-6.8.0-53-generic'
    initrd = 'initrd.img-6.8.0-53-generic'
    dtbdir = None
    script = '''## /boot/extlinux/extlinux.conf
##
## IMPORTANT WARNING
##
## The configuration of this file is generated automatically.
## Do not edit this file manually, use: u-boot-update

default l0
menu title U-Boot menu
prompt 1
timeout 50


label l0
	menu label Ubuntu %s 6.8.0-53-generic
	linux /boot/%s
	initrd /boot/%s

	append root=/dev/disk/by-uuid/bcfdda4a-8249-4f40-9f0f-7c1a76b6cbe8 ro earlycon

label l0r
	menu label Ubuntu %s 6.8.0-53-generic (rescue target)
	linux /boot/%s
	initrd /boot/%s
''' % ((version, vmlinux, initrd) * 2)
    setup_extlinux_image(config, log, devnum, basename, vmlinux, initrd, dtbdir,
                         script)