Kernel: Check only for the first equal sign in the kernel command line

... key-value decomposition

The RaspberryPi firmware will give us a value for the 'video' key that
contains multiple equal signs:
```
video=HDMI-A-1:1920x1080M@30D,margin_left=48,margin_right=48,[...]
```
Instead of asserting that this only has one equal sign, let's just split
it by the first one.
This commit is contained in:
Hediadyoin1 2023-05-16 14:29:59 +02:00 committed by Andrew Kaster
parent fcbb8d63c0
commit 60cddb4179
Notes: sideshowbarker 2024-07-18 05:01:22 +09:00

View File

@ -58,15 +58,13 @@ UNMAP_AFTER_INIT void CommandLine::add_arguments(Vector<StringView> const& args)
if (str == ""sv) {
continue;
}
auto pair = str.split_view('=');
VERIFY(pair.size() == 2 || pair.size() == 1);
if (pair.size() == 1) {
m_params.set(pair[0], ""sv);
} else {
m_params.set(pair[0], pair[1]);
}
// Some boot loaders may include complex key-value pairs where the value is a composite entry,
// we handle this by only checking for the first equals sign in each command line parameter.
auto key = str.find_first_split_view('=');
if (key.length() == str.length())
m_params.set(key, ""sv);
else
m_params.set(key, str.substring_view(key.length() + 1));
}
}