Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions web/protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,18 @@ const FW_DIRECT_BASE =
'https://github.com/OpenIPC/firmware/releases/download/latest';

// Asset name → chip, e.g. u-boot-gk7205v300-universal.bin → gk7205v300.
// The u-boot-xmedia SoCs, and hi3516cv300/hi3516ev100 from OpenIPC/u-boot,
// publish per flash type instead (-nor.bin, -nand.bin); a recovery loads
// U-Boot into RAM and needs no flash layout, so it takes the -nor one, as
// `defib burn` does without --nand. The -universal image still published for
// cv300/ev100 is U-Boot 2010.06, which cannot boot their split NOR layout.
// The u-boot-xmedia SoCs, and the gk7205v200 family and hi3516cv300/hi3516ev100
// from OpenIPC/u-boot, publish per flash type instead (-nor.bin, -nand.bin); a
// recovery loads U-Boot into RAM and needs no flash layout, so it takes the
// -nor one, as `defib burn` does without --nand. The -universal images still
// published for them are older builds (2016.11 on Goke, 2010.06 on cv300/ev100)
// that do not scan the flash: once their environment is wiped they fall back to
// the 8 MB slots, and they cannot boot the split NOR layout.
const FW_ASSET_RE = /^u-boot-(.+)-(universal|nor)\.bin$/;
const XMEDIA_SOCS = new Set([
'hi3516ev200', 'hi3516ev300', 'hi3518ev300', 'hi3516dv200',
'gk7205v500', 'gk7205v510', 'gk7205v530',
'gk7202v300', 'gk7205v200', 'gk7205v300', 'gk7605v100',
'hi3516cv300', 'hi3516ev100',
]);

Expand Down
16 changes: 9 additions & 7 deletions web/protocol.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,14 @@ describe('SoC Lists', () => {
// U-Boot asset resolution (issue #113)
// ================================================================

// Trimmed shape of api.github.com .../releases/tags/latest, with the real
// digest and size of u-boot-gk7205v300-universal.bin.
// Trimmed shape of api.github.com .../releases/tags/latest. The gk7205v300
// entry carries a real asset's digest and size (taken from its former
// -universal image); gk7205v300 now loads its -nor build.
const RELEASE_FIXTURE = {
tag_name: 'latest',
assets: [
{
name: 'u-boot-gk7205v300-universal.bin',
name: 'u-boot-gk7205v300-nor.bin',
size: 256459,
digest: 'sha256:0160bbcb7b8e40a13abbc96d34bc26575534e0ea0d6cc4a5b947ce0bd55ce3dc',
},
Expand All @@ -403,7 +404,7 @@ const RELEASE_FIXTURE = {
};

describe('parseReleaseAssets', () => {
it('keeps only u-boot-*-universal.bin assets', () => {
it('keeps only each chip\'s own U-Boot asset', () => {
const m = parseReleaseAssets(RELEASE_FIXTURE);
assert.deepEqual([...m.keys()].sort(), ['gk7205v300', 'hi3520dv200']);
});
Expand All @@ -412,7 +413,7 @@ describe('parseReleaseAssets', () => {
const a = parseReleaseAssets(RELEASE_FIXTURE).get('gk7205v300');
assert.equal(a.size, 256459);
assert.equal(a.sha256, '0160bbcb7b8e40a13abbc96d34bc26575534e0ea0d6cc4a5b947ce0bd55ce3dc');
assert.equal(a.url, `${FW_DIRECT_BASE}/u-boot-gk7205v300-universal.bin`);
assert.equal(a.url, `${FW_DIRECT_BASE}/u-boot-gk7205v300-nor.bin`);
});

it('tolerates a missing digest', () => {
Expand Down Expand Up @@ -625,7 +626,8 @@ describe('fwAssetName', () => {
it('names the -nor build for u-boot-xmedia SoCs, -universal otherwise', () => {
assert.equal(fwAssetName('hi3516ev300'), 'u-boot-hi3516ev300-nor.bin');
assert.equal(fwAssetName('gk7205v510'), 'u-boot-gk7205v510-nor.bin');
assert.equal(fwAssetName('gk7205v300'), 'u-boot-gk7205v300-universal.bin');
assert.equal(fwAssetName('gk7205v300'), 'u-boot-gk7205v300-nor.bin');
assert.equal(fwAssetName('hi3516cv200'), 'u-boot-hi3516cv200-universal.bin');
assert.equal(fwAssetName('hi3516cv300'), 'u-boot-hi3516cv300-nor.bin');
assert.equal(fwAssetName('hi3516ev100'), 'u-boot-hi3516ev100-nor.bin');
});
Expand All @@ -650,7 +652,7 @@ describe('fwAssetName', () => {
{ name: 'u-boot-gk7205v300-nor.bin', size: 5, digest: null },
] });
assert.equal(idx.get('hi3516ev300').name, 'u-boot-hi3516ev300-nor.bin');
assert.equal(idx.get('gk7205v300').name, 'u-boot-gk7205v300-universal.bin');
assert.equal(idx.get('gk7205v300').name, 'u-boot-gk7205v300-nor.bin');
assert.equal(idx.size, 2);
});
});
Loading