Re: ${arch} setting

"Miller, Shao" <[email protected]>
Newsgroups gmane.network.etherboot.user
Message-ID <[email protected]>
If gPXE returned struct cpuinfo_x86 as some hex bytes, would you be
willing to process the bytes server-side in order to determine features,
etc.?  - Shao

________________________________

From: Jason Robertson [mailto:[email protected]] 
Sent: Thursday, July 09, 2009 00:49
To: Miller, Shao
Subject: Re: [Etherboot-discuss] ${arch} setting

 

Hi,

Yes - we are trying to dynamically generate a chained gpxe script using
the architecture as an input into the generator.  So for example the
initial gpxe script will be downloaded from a URL including
http://....?arch=${arch <http://....?arch=$%7Barch> }.  This script then
generates a kernel and initrd loading script based on the architecture
and other properties which we then chain to.

 

________________________________

From: "Miller, Shao" <[email protected]>
To: Jason Robertson <[email protected]>
Cc: [email protected]
Sent: Tuesday, June 30, 2009 11:03:32 AM
Subject: Re: [Etherboot-discuss] ${arch} setting

Could you please describe your use case in a little more detail?  Are
you trying to tell a webserver about the client's architecture, by any
chance?  Are you trying to TFTP a file whose name includes the
architecture?  Sorry about the delay.  - Shao

________________________________

From: Jason Robertson [mailto:[email protected]] 
Sent: Tuesday, June 02, 2009 18:21
To: [email protected]
Subject: [Etherboot-discuss] ${arch} setting

 

Hi,

Is there a setting to easily obtain the architecture of the CPU in gpxe
(e.g. x86_64, x86 or ia32/ia32e) - something like that?  I looked
through the smbios stuff but the processor bits aren't really useful for
automation (it's a bitfield) and it seems older SMBios versions don't
include it.

I've been having to apply the below patch to each version, can we get
this added in a more "proper" way (I just hack it into settings.c)

/**
 * Parse and store value of arch setting
 *
 * @v settings      Settings block
 * @v setting       Setting to store
 * @v value     Formatted setting data
 * @ret rc      Return status code
 */
static int storef_arch ( struct settings *settings __unused,
             struct setting *setting __unused,
             const char *value __unused ) {
    return -ENOTSUP;
}

/**
 * Fetch and format value of arch setting
 *
 * @v settings      Settings block, or NULL to search all blocks
 * @v setting       Setting to fetch
 * @v buf       Buffer to contain formatted value
 * @v len       Length of buffer
 * @ret len     Length of formatted value, or negative error
 */
static int fetchf_arch ( struct settings *settings __unused,
                         struct setting *setting __unused, char *buf,
                         size_t len ) {
    struct cpuinfo_x86 cpuinfo;
    cpuinfo.amd_features = 0;
    cpuinfo.features = 0;
    get_cpuinfo(&cpuinfo);
    if (cpuinfo.amd_features & (1<<(X86_FEATURE_LM & 31))) {
        return snprintf(buf, len, "ia32e");
    }
    else {
        return snprintf(buf, len, "ia32");
    }
}

/** Arch setting type */
struct setting_type setting_type_arch __setting_type = {
    .name = "arch",
    .storef = storef_arch,
    .fetchf = fetchf_arch,
};

/** CPU arch (probably doesn't belong in this file) */
struct setting arch_setting __setting = {
    .name = "arch",
    .description = "CPU Architecture",
    .tag = 1,
    .type = &setting_type_arch,
};

------------------------------------------------------------------------------

_______________________________________________
Etherboot-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/etherboot-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.