Skip to content

Commit 1abc8ea

Browse files
committed
profiles: decouple "board_name" and "profile" from "platform" variable
Just separate the, now a bit overloaded, variable "device.platform" which represents: the board_name(dts compatible) and profile into two explicit variables trying to make clearer the profile identification process during ASU sysupgrades. The old "sanitized" device.platform now would be "device.profile" while the raw board_name is kept in "device.board_name". In the mapping case code, rename "real_platform" to "platform_profile" and "alias" to "board_name" in order to make clearer the translation/mapping being done: board_name -> profile Rename standalone "profile" to a more representative "platform_profile" since it represents a tuple from the platform dictionary (profiles.json). Adapted some log outputs and show the two variables when printing the previous single "device.platform". No change in the logic, nothing should be different after this change.
1 parent 670907a commit 1abc8ea

1 file changed

Lines changed: 27 additions & 21 deletions

File tree

files/owut

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,8 @@ function collect_device_info()
12651265
}
12661266

12671267
let target = sysb.release.target;
1268-
let platform = replace(sysb.board_name, /,/, "_");
1268+
let board_name = sysb.board_name;
1269+
let profile = replace(board_name, /,/, "_");
12691270
let ver_from = sysb.release.version;
12701271
let sutype; // Sysupgrade type: combined, combined-efi, sdcard or sysupgrade (or trx or lxl or ???)
12711272

@@ -1297,11 +1298,12 @@ function collect_device_info()
12971298
}
12981299
12991300
device = {
1300-
arch: null, // "x86_64" or "mipsel_24kc" or "aarch64_cortex-a53", contained in platform_json
1301-
target: target, // "x86/64" or "ath79/generic" or "mediatek/mt7622", from system board
1302-
platform: platform, // "generic" (for x86) or "tplink,archer-c7-v4" or "linksys,e8450-ubi"
1303-
fstype: sysb.rootfs_type, // "ext4" or "squashfs", what is actually present now
1304-
sutype: sutype, // Sysupgrade type, combined, combined-efi or sysupgrade or sdcard
1301+
arch: null, // "x86_64" or "mipsel_24kc" or "aarch64_cortex-a53", contained in platform_json
1302+
target: target, // "x86/64" or "ath79/generic" or "mediatek/mt7622", from system board
1303+
board_name: board_name, // "generic" (for x86) or "tplink,archer-c7-v4" or "linksys,e8450-ubi"
1304+
profile: profile, // "generic", "tplink_archer-c7-v4" or "linksys_e8450-ubi", used to match profiles in profiles.json
1305+
fstype: sysb.rootfs_type, // "ext4" or "squashfs", what is actually present now
1306+
sutype: sutype, // Sysupgrade type, combined, combined-efi or sysupgrade or sdcard
13051307
};
13061308
13071309
build = {
@@ -1388,7 +1390,7 @@ function complete_build_info(profile, board)
13881390
device.sutype = valid_sutypes[0];
13891391
else
13901392
L.bug("%s:%s Sysupgrade type '%s' should be one of %s\n",
1391-
device.target, device.platform, device.sutype, valid_sutypes);
1393+
device.target, device.profile, device.sutype, valid_sutypes);
13921394
}
13931395
13941396
for (let img in images) {
@@ -1485,34 +1487,37 @@ function collect_platform()
14851487
L.die("Unsupported target '%s'\n", device.target);
14861488
}
14871489
1488-
if (! (device.platform in keys(platform.profiles))) {
1490+
if (! (device.profile in keys(platform.profiles))) {
1491+
// *Although in most cases the board_name (sysinfo:acpi name, dts compatible, custom name) is the
1492+
// "same" as the profile, and the "sanitization" would be enough to get the proper profile name.
1493+
// The common/general case is that devices sent any string from the SUPPORTED_DEVICES list and we
1494+
// need to translate to a proper profile name used by ImageBuilders.
14891495
// This is a mapped profile, e.g.: raspberrypi,model-b-plus -> rpi
14901496
let found = false;
1491-
for (let real_platform, data in platform.profiles) {
1492-
for (let alias in data.supported_devices) {
1493-
alias = replace(alias, ",", "_");
1494-
if (device.platform == alias) {
1497+
for (let platform_profile, data in platform.profiles) {
1498+
for (let board_name in data.supported_devices) {
1499+
if (device.board_name == board_name) {
14951500
found = true;
1496-
L.log(2, "Mapping platform %s to %s\n", device.platform, real_platform);
1497-
device.platform = real_platform;
1501+
L.log(2, "Mapping platform, board_name to profile: %s to %s\n", device.board_name, platform_profile);
1502+
device.profile = platform_profile;
14981503
break;
14991504
}
15001505
}
15011506
if (found) break;
15021507
}
15031508
if (! found) {
15041509
if ("generic" in keys(platform.profiles))
1505-
device.platform = "generic";
1510+
device.profile = "generic";
15061511
else
1507-
L.die("Unsupported profile: %s\n Valid profiles are %s\n", device.platform, keys(platform.profiles));
1512+
L.die("Unsupported profile: %s\n Valid profiles are %s\n", device.profile, keys(platform.profiles));
15081513
}
15091514
}
15101515
1511-
let profile = platform.profiles[device.platform];
1516+
let platform_profile = platform.profiles[device.profile];
15121517
device.arch = platform.arch_packages;
15131518
1514-
complete_build_info(profile, platform);
1515-
collect_defaults(platform.default_packages, profile.device_packages);
1519+
complete_build_info(platform_profile, platform);
1520+
collect_defaults(platform.default_packages, platform_profile.device_packages);
15161521
15171522
if ("linux_kernel" in platform) {
15181523
build.to.kernel = platform.linux_kernel.version;
@@ -1616,7 +1621,8 @@ function show_config()
16161621
`ASU-Server ${url.sysupgrade_root}\n`
16171622
`Upstream ${url.upstream}\n`
16181623
`Target ${device.target}\n`
1619-
`Profile ${device.platform}\n`
1624+
`Profile ${device.profile}\n`
1625+
`Board ${device.board_name}\n`
16201626
`Package-arch ${device.arch}\n`
16211627
);
16221628
L.log(1,
@@ -1922,7 +1928,7 @@ function blob(report)
19221928
let blob = {
19231929
client: PROG,
19241930
target: device.target,
1925-
profile: device.platform, // sanitized board name
1931+
profile: device.profile, // sanitized board name
19261932

19271933
version: build.to.version,
19281934
version_code: rc,

0 commit comments

Comments
 (0)