-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcmdline
More file actions
45 lines (34 loc) · 1.19 KB
/
cmdline
File metadata and controls
45 lines (34 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# modify cmdline.txt
# @example
# add processor.max_cstate=1
# remove isolcpus=2,3
# RPI_CMDLINE_ADD=( "processor.max_cstate=1" )
# RPI_CMDLINE_REMOVE=( "isolcpus=2,3" )
# load dependencies
plugin_load run || return 1
to_array RPI_CMDLINE_ADD
to_array RPI_CMDLINE_REMOVE
function rpi_cmdline_prerun() {
[[ -n "${RPI_CMDLINE_ADD}" ]] || [[ -n "${RPI_CMDLINE_REMOVE}" ]] || error "RPI_CMDLINE_ADD and RPI_CMDLINE_REMOVE unset"
}
function rpi_cmdline_run() {
for c in "${RPI_CMDLINE_ADD[@]}" ; do
log "setting ${c} ..."
rpi_append_to_file "${c}" "${RPI_BOOT}/cmdline.txt" || error "adding ${c}"
done
for c in "${RPI_CMDLINE_REMOVE[@]}" ; do
log "removing ${c} ..."
rpi_remove_pattern_from_file "${c}" "${RPI_BOOT}/cmdline.txt" || error "removing ${c}"
done
# remove newlines from cmdline.txt
tr '\n' ' ' < "${RPI_BOOT}/cmdline.txt" > "${RPI_BOOT}/cmdline.new"
mv "${RPI_BOOT}/cmdline.new" "${RPI_BOOT}/cmdline.txt"
}
function rpi_cmdline_description() {
echo "modify cmdline.txt"
}
function rpi_cmdline_help_params() {
help_param "RPI_CMDLINE_ADD" "arguments to add"
help_param "RPI_CMDLINE_REMOVE" "arguments to remove"
}