Skip to content

Commit c6152d5

Browse files
committed
staging
1 parent 4af8284 commit c6152d5

File tree

4 files changed

+118
-3
lines changed

4 files changed

+118
-3
lines changed

doc/booting.puml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@startuml
2+
participant init
3+
participant Service
4+
participant "Service Started" as C
5+
participant "Command" as D
6+
7+
init -> Service: +ueventd
8+
Service -> C: ueventd started
9+
10+
init -> Service: +apexd-bootstrap
11+
Service -> C: apexd-bootstrap started
12+
13+
init -> D !!: 'mkdir /acct/uid'
14+
init -> D: update_linker_config
15+
@enduml

lazybox/src/main/kotlin/cfig/lazybox/App.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,8 @@ fun main(args: Array<String>) {
7979
if (args[0] == "mount") {
8080
MountAnalyzer().run()
8181
}
82+
if (args[0] == "booting") {
83+
//BootingParser.run()
84+
BootingParser.run2()
85+
}
8286
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
package cfig.lazybox
2+
3+
import org.slf4j.LoggerFactory
4+
import java.io.File
5+
import java.util.regex.Pattern
6+
7+
class BootingParser {
8+
companion object {
9+
private val log = LoggerFactory.getLogger(BootingParser::class.java)
10+
fun run() {
11+
val logLines = File("booting.log").readLines()
12+
val regex = Pattern.compile("""\[([^]]+)] \[\s*([0-9.]+)]\[\s*(T\d+)] init: starting service '([^']+)'.*""")
13+
for (line in logLines) {
14+
val matcher = regex.matcher(line)
15+
if (matcher.find()) {
16+
val timestamp = matcher.group(1)
17+
val kernelTime = matcher.group(2)
18+
val tLevel = matcher.group(3)
19+
val serviceName = matcher.group(4)
20+
21+
println("Timestamp: $timestamp, Kernel Time: $kernelTime, T-Level: $tLevel, Service Name: $serviceName")
22+
}
23+
}
24+
}
25+
26+
fun run2() {
27+
val logLines = File("booting.log2").readLines()
28+
29+
30+
val actionRegex = Pattern.compile("""\[([^]]+)] \[\s*([0-9.]+)]\[\s*(T\d+)] init: processing action \(([^)]+)\) from \(([^)]+)\).*""")
31+
val commandRegex = Pattern.compile("""\[([^]]+)] \[\s*([0-9.]+)]\[\s*(T\d+)] init: Command '([^']+)' action=([^\(]+) \(([^)]+)\) took (\d+)ms and (succeeded|failed)(.*)?""")
32+
val svcExecRegex = Pattern.compile("""\[([^]]+)] \[\s*([0-9.]+)]\[\s*(T\d+)] init: SVC_EXEC service '([^']+)' pid (\d+) \(([^)]+)\) started; waiting\.""")
33+
val serviceStartRegex = Pattern.compile("""\[([^]]+)] \[\s*([0-9.]+)]\[\s*(T\d+)] init: starting service '([^']+)'.*""")
34+
35+
for (line in logLines) {
36+
val actionMatcher = actionRegex.matcher(line)
37+
if (actionMatcher.find()) {
38+
val timestamp = actionMatcher.group(1)
39+
val kernelTime = actionMatcher.group(2)
40+
val tLevel = actionMatcher.group(3)
41+
val actionName = actionMatcher.group(4)
42+
val fromComponent = actionMatcher.group(5)
43+
44+
println("Timestamp: $timestamp, Kernel Time: $kernelTime, T-Level: $tLevel, Action Name: $actionName, From: $fromComponent")
45+
}
46+
47+
val commandMatcher = commandRegex.matcher(line)
48+
if (commandMatcher.find()) {
49+
val timestamp = commandMatcher.group(1)
50+
val kernelTime = commandMatcher.group(2)
51+
val tLevel = commandMatcher.group(3)
52+
val command = commandMatcher.group(4)
53+
val action = commandMatcher.group(5).trim()
54+
val fromComponent = commandMatcher.group(6)
55+
val duration = commandMatcher.group(7)
56+
val status = commandMatcher.group(8)
57+
val failReason = commandMatcher.group(9)?.trim()
58+
59+
println("Timestamp: $timestamp, Kernel Time: $kernelTime, T-Level: $tLevel, Command: $command, Action: $action, From: $fromComponent, Duration: ${duration}ms, Status: $status${if (failReason != null) ", Reason: $failReason" else ""}")
60+
}
61+
62+
val svcExecMatcher = svcExecRegex.matcher(line)
63+
if (svcExecMatcher.find()) {
64+
val timestamp = svcExecMatcher.group(1)
65+
val kernelTime = svcExecMatcher.group(2)
66+
val tLevel = svcExecMatcher.group(3)
67+
val serviceName = svcExecMatcher.group(4)
68+
val pid = svcExecMatcher.group(5)
69+
val context = svcExecMatcher.group(6)
70+
71+
println("Timestamp: $timestamp, Kernel Time: $kernelTime, T-Level: $tLevel, Service Name: $serviceName, PID: $pid, Context: $context")
72+
}
73+
74+
val serviceStartMatcher = serviceStartRegex.matcher(line)
75+
if (serviceStartMatcher.find()) {
76+
val timestamp = serviceStartMatcher.group(1)
77+
val kernelTime = serviceStartMatcher.group(2)
78+
val tLevel = serviceStartMatcher.group(3)
79+
val serviceName = serviceStartMatcher.group(4)
80+
81+
println("Timestamp: $timestamp, Kernel Time: $kernelTime, T-Level: $tLevel, Service Name: $serviceName")
82+
}
83+
}
84+
85+
86+
87+
88+
} // end-of-fun
89+
} // end-of-companion
90+
}

tools/local/bin/abe

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ operation=$1
1414
echo arg num: $#
1515
echo "args: $0 $1 $2"
1616

17+
source_code_dir=/home/yu/work/boot
1718
# Determine which operation to perform
19+
set -x
1820
case $operation in
1921
"unpack")
22+
cd ${source_code_dir}
23+
pwd
2024
if [[ $# -eq 2 ]]; then
2125
file=`realpath $2`
2226
dir=`realpath out`
23-
cd ${baseDir}/../../../
2427
gradle unpack --args="unpackInternal $file $dir"
2528
elif [[ $# -eq 3 ]]; then
2629
file=`realpath $2`
@@ -33,13 +36,16 @@ case $operation in
3336
fi
3437
;;
3538
"pack")
39+
pwd
3640
if [[ $# -eq 3 ]]; then
3741
dir=`realpath $2`
3842
file=`realpath $3`
39-
cd ${baseDir}/../../../
43+
#cd ${baseDir}/../../../
44+
cd ${source_code_dir}
4045
gradle pack --args="packInternal $dir $file"
4146
else
42-
cd ${baseDir}/../../../
47+
#cd ${baseDir}/../../../
48+
cd ${source_code_dir}
4349
gradle pack
4450
fi
4551
;;

0 commit comments

Comments
 (0)