qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v2 12/12] pc: skip firmware


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC PATCH v2 12/12] pc: skip firmware
Date: Mon, 29 Aug 2016 19:08:14 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0


On 25/08/2016 12:15, Chao Peng wrote:
> -static void load_linux(PCMachineState *pcms,
> -                       FWCfgState *fw_cfg)
> +static void load_linux_efi(PCMachineState *pcms)

ELF, not EFI.

Paolo

> +{
> +    unsigned char class;
> +    MachineState *machine = MACHINE(pcms);
> +    FILE *file = fopen(machine->kernel_filename, "rb");
> +
> +    if (!file) {
> +        goto err;
> +    }
> +
> +    if (fseek(file, EI_CLASS, 0) || fread(&class, 1, 1, file) != 1) {
> +        fclose(file);
> +        goto err;
> +    }
> +    fclose(file);
> +
> +    if (load_elf(machine->kernel_filename, NULL, NULL, &boot_info.entry,
> +                   NULL, NULL, 0, EM_X86_64, 0, 0) < 0) {
> +        goto err;
> +    }
> +
> +    if (class == ELFCLASS64) {
> +        boot_info.long_mode = true;
> +    } else if (class != ELFCLASS32) {
> +        goto err;
> +    }
> +
> +    boot_info.protected_mode = true;
> +    return;
> +
> +err:
> +    fprintf(stderr, "qemu: could not load kernel '%s'\n",
> +                    machine->kernel_filename);
> +    exit(1);
> +}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]