@@ -107,6 +107,9 @@ where options are:
107
107
data_filename:<filename>
108
108
dht_filename:<filename>
109
109
shared
110
+ create
111
+ truncate
112
+ read_only
110
113
mount:<string>
111
114
user:<string>
112
115
@@ -137,6 +140,18 @@ where options are:
137
140
target modifications to flash drive modify the memory and hash tree files.
138
141
by default, image files are not modified and changes are lost.
139
142
143
+ create (optional)
144
+ create the backing storage file, shared must also be true.
145
+
146
+ truncate (optional)
147
+ truncate the memory length to match memory lengths different from the backing storage,
148
+ in case of shared flash drive, then it also truncates the underlying backing file.
149
+ by default, when a length is present it must also match the backing storage length.
150
+
151
+ read_only (optional)
152
+ mark flash drive as read-only, disallowing write attempts from the host or the guest.
153
+ by default, flash drives are not read-only, thus writable.
154
+
140
155
mount (optional)
141
156
whether the flash drive should be mounted automatically in init.
142
157
by default, the drive is mounted if there is an image file backing it,
@@ -171,11 +186,12 @@ where options are:
171
186
172
187
--ram=<key>:<value>[,<key>:<value>[,...]...]
173
188
--dtb=<key>:<value>[,<key>:<value>[,...]...]
174
- --tlb =<key>:<value>[,<key>:<value>[,...]...]
189
+ --processor =<key>:<value>[,<key>:<value>[,...]...]
175
190
--cmio-rx-buffer=<key>:<value>[,<key>:<value>[,...]...]
176
191
--cmio-tx-buffer=<key>:<value>[,<key>:<value>[,...]...]
177
192
--pmas=<key>:<value>[,<key>:<value>[,...]...]
178
193
--uarch-ram=<key>:<value>[,<key>:<value>[,...]...]
194
+ --uarch-processor=<key>:<value>[,<key>:<value>[,...]...]
179
195
configures file storage for other memory ranges in the machine
180
196
181
197
<key>:<value> is one of
@@ -471,6 +487,31 @@ where options are:
471
487
--load=<directory>
472
488
load machine previously stored in <directory>.
473
489
490
+ --init-shared=<directory>
491
+ initialize a machine sharing snapshot created in <directory>.
492
+ writable address ranges are shared, thus runtime modifications persist in the snapshot.
493
+ writable address ranges use reflinks on copy-on-write filesystems for efficient copying.
494
+ read-only address ranges use hard links to avoid unnecessary copying.
495
+ address ranges sparsity is preserved to minimize host storage usage.
496
+
497
+ MUST BE USED WITH --no-rollback
498
+
499
+ --load-shared=<directory>
500
+ load an existing machine sharing snapshot from <directory>,
501
+ writable address ranges are shared, thus runtime modifications persists in the snapshot.
502
+ address ranges sparsity is preserved to minimize host storage usage.
503
+
504
+ MUST BE USED WITH --no-rollback
505
+
506
+ --clone-shared=<source_directory>,<destination_directory>
507
+ clones a snapshot from source directory to destination directory and load a machine sharing it.
508
+ writable address ranges are shared, thus runtime modifications persist in the snapshot.
509
+ writable address ranges use reflinks on copy-on-write filesystems for efficient copying.
510
+ read-only address ranges use hard links to avoid unnecessary copying.
511
+ address ranges sparsity is preserved to minimize host storage usage.
512
+
513
+ MUST BE USED WITH --no-rollback
514
+
474
515
--initial-hash
475
516
print initial state hash before running machine.
476
517
@@ -614,6 +655,9 @@ local flash_data_filename = { root = images_path .. "rootfs.ext2" }
614
655
local flash_dht_filename = {}
615
656
local flash_label_order = { " root" }
616
657
local flash_shared = {}
658
+ local flash_create = {}
659
+ local flash_truncate = {}
660
+ local flash_read_only = {}
617
661
local flash_mount = {}
618
662
local flash_user = {}
619
663
local flash_start = {}
@@ -1012,13 +1056,6 @@ local options = {
1012
1056
return true
1013
1057
end ,
1014
1058
},
1015
- {
1016
- " ^(%-%-tlb%=(.+))$" ,
1017
- function (all , opts )
1018
- tlb .backing_store = parse_backing_store (opts , " tlb" , all , tlb .backing_store )
1019
- return true
1020
- end ,
1021
- },
1022
1059
{
1023
1060
" ^(%-%-pmas%=(.+))$" ,
1024
1061
function (all , opts )
@@ -1146,6 +1183,9 @@ local options = {
1146
1183
data_filename = true ,
1147
1184
dht_filename = true ,
1148
1185
shared = true ,
1186
+ create = true ,
1187
+ truncate = true ,
1188
+ read_only = true ,
1149
1189
mount = true ,
1150
1190
user = true ,
1151
1191
length = true ,
@@ -1155,6 +1195,9 @@ local options = {
1155
1195
if f .data_filename == true then f .data_filename = " " end
1156
1196
if f .dht_filename == true then f .dht_filename = " " end
1157
1197
assert (not f .shared or f .shared == true , " invalid flash drive shared value in " .. all )
1198
+ assert (not f .create or f .create == true , " invalid flash drive create value in " .. all )
1199
+ assert (not f .truncate or f .truncate == true , " invalid flash drive read_only value in " .. all )
1200
+ assert (not f .read_only or f .read_only == true , " invalid flash drive truncate value in " .. all )
1158
1201
if f .mount == nil then
1159
1202
-- mount only if there is a file backing
1160
1203
if f .data_filename and f .data_filename ~= " " then
@@ -1179,8 +1222,14 @@ local options = {
1179
1222
flash_start [d ] = f .start or flash_start [d ]
1180
1223
flash_length [d ] = f .length or flash_length [d ]
1181
1224
flash_shared [d ] = f .shared or flash_shared [d ]
1225
+ flash_create [d ] = f .create or flash_create [d ]
1226
+ flash_truncate [d ] = f .truncate or flash_truncate [d ]
1227
+ flash_read_only [d ] = f .read_only or flash_read_only [d ]
1182
1228
flash_mount [d ] = f .mount or flash_mount [d ]
1183
1229
flash_user [d ] = f .user or flash_user [d ]
1230
+ if d == " root" and f .read_only then -- Mount root filesystem as read-only
1231
+ dtb .bootargs = dtb .bootargs :gsub (" rw" , " ro" )
1232
+ end
1184
1233
return true
1185
1234
end ,
1186
1235
},
@@ -1335,6 +1384,9 @@ local options = {
1335
1384
flash_start .root = nil
1336
1385
flash_length .root = nil
1337
1386
flash_shared .root = nil
1387
+ flash_create .root = nil
1388
+ flash_truncate .root = nil
1389
+ flash_read_only .root = nil
1338
1390
table.remove (flash_label_order , 1 )
1339
1391
dtb .bootargs = dtb .bootargs :gsub (" root=$" , " " )
1340
1392
return true
@@ -1846,7 +1898,10 @@ echo "
1846
1898
data_filename = flash_data_filename [label ],
1847
1899
dht_filename = flash_dht_filename [label ],
1848
1900
shared = flash_shared [label ],
1901
+ create = flash_create [label ],
1902
+ truncate = flash_truncate [label ],
1849
1903
},
1904
+ read_only = flash_read_only [label ],
1850
1905
start = flash_start [label ],
1851
1906
length = flash_length [label ] or - 1 ,
1852
1907
}
0 commit comments