libdebian-installer
Functions
Subarchitecture detection
System

Functions

const char * di_system_subarch_analyze (void)
 
const char * di_system_subarch_analyze_guess (void)
 

Detailed Description

Function Documentation

const char* di_system_subarch_analyze ( void  )

Returns a string describing the current subarchitecture, e.g. "powermac_newworld".

Referenced by di_system_subarch_analyze_guess().

{
char entry[256];
int i;
int ret;
entry[0] = '\0';
ret = read_dt_model(entry, sizeof(entry));
if (ret)
ret = read_cpuinfo(entry, sizeof(entry));
if (ret)
return "unknown";
for (i = 0; map_hardware[i].entry; i++)
{
if (!strncasecmp(map_hardware[i].entry, entry,
strlen(map_hardware[i].entry)))
{
return( map_hardware[i].ret );
}
}
return "unknown";
}
const char* di_system_subarch_analyze_guess ( void  )

Return a string with a best-guess of the current subarchitecture

Only present on armel currently, and is a stub on all other architectures

References di_system_subarch_analyze().

{
struct utsname sysinfo;
size_t uname_release_len, i;
/* Attempt to determine subarch based on kernel release version */
uname(&sysinfo);
uname_release_len = strlen(sysinfo.release);
for (i = 0; supported_generic_subarches[i] != NULL; i++)
{
size_t subarch_len = strlen (supported_generic_subarches[i]);
if (!strncmp(sysinfo.release+uname_release_len-subarch_len,
supported_generic_subarches[i],
subarch_len))
{
return supported_generic_subarches[i];
}
}
/* If we get here, try falling back on the normal detection method */
}