Skip to content

Commit 7ccc284

Browse files
committed
bak
1 parent b0cc652 commit 7ccc284

28 files changed

+250
-7
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
291291
1. [Xen](xen.md)
292292
1. [Vagrant](vagrang/)
293293
1. [Intel SDE](intel-sde.md)
294+
1. [gem5](gem5.md)
294295
1. [Configuration automation](config-automation.md)
295296
1. [chef](chef/)
296297
1. [puppet](puppet.md)

chat.sh

+2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
#go to tty3
5656
#your message is there!
5757

58+
# SSH sessions also see those messages.
59+
5860
## talk
5961

6062
# Commandline chat program.

cloc.md

+23
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,26 @@ Sample output for GDB:
5151
-------------------------------------------------------------------------------
5252

5353
In 2015 takes around 30 minutes on the Linux kernel: <http://www.quora.com/How-many-lines-of-code-are-in-the-Linux-kernel>
54+
55+
## Per top-level directory breakdown
56+
57+
E.g. for C and C++ only:
58+
59+
for d in $(git ls-tree HEAD . | awk -F '[[:space:]]' '$2=="tree" {print $4}'); do
60+
echo "## $d"
61+
cloc --list-file=<(git ls-files "$d" | grep -Fxvf <(git submodule status | cut -d' ' -f3))
62+
echo
63+
done |& tee /tmp/a
64+
cat /tmp/a | awk -F' ' '/^##/{ printf("%-16s %d\n", name, sum); name = $2; sum = 0} /^(C |C\+\+ )/{ sum += $5 }' | tail -n+2 | sort -nrk 2,2
65+
66+
## For each file
67+
68+
cloc --by-file .
69+
70+
You can then do your own processing.
71+
72+
## gitignore
73+
74+
<https://github.com/AlDanial/cloc/issues/49>
75+
76+
--vcs=git

dmesg.md

+57-3
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,72 @@ TODO what kernel function puts messages there?
1010

1111
The messages that appear on the screen at startup are shown there as well. But there are messages which only `dmsg` shows. TODO what is the difference?
1212

13+
Also clear the ring buffer:
14+
15+
sudo dmesg -c
16+
17+
Good option, so that next time you run:
18+
19+
sudo dmesg -c
20+
21+
you know that all messages are new.
22+
1323
## /var/log/dmesg
1424

25+
<http://unix.stackexchange.com/questions/191560/difference-between-output-of-dmesg-and-content-of-var-log-dmesg>
26+
27+
When the kernel finishes booting, it dumps the ring buffer to this file.
28+
1529
The messages are found in `/var/log/dmesg` and rotated log files `dmesg.N.gz`.
1630

17-
TODO: rotated log files contain similar content to the `dmesg`. Where is the content od `dmesg` coming from?
31+
After boot, further messages are written to the ring buffer, and `dmesg` will see them, but they are not written to `/var/log/dmesg`.
32+
33+
At that point, there seem to be
34+
35+
### /var/log/dmesg.0
36+
37+
`dmesg` from last boot.
1838

1939
## /proc/kmsg
2040

2141
## kmsg
2242

23-
TODO when I: `sudo cat /proc/kmsg` it is empty and hangs. Why?
43+
Looks like a live ring-buffer.
44+
45+
Try:
46+
47+
sudo cat /proc/kmsg
48+
49+
and then connect and disconnect something like a USB cable.
2450

2551
## /var/log/boot.log
2652

27-
TODO what kernel function puts messages there?
53+
TODO what kernel function puts messages there? Looks like service startup / teardown, so possibly upstart?
54+
55+
## /var/log/kern.log
56+
57+
Large log of multiple previous ring buffers.
58+
59+
Set under `/etc/rsyslog.d/50-default.conf`.
60+
61+
## /var/log/messages
62+
63+
Not present in Ubuntu 16.04.
64+
65+
<http://unix.stackexchange.com/questions/35851/whats-the-difference-of-dmesg-output-and-var-log-messages>
66+
67+
## klogd
68+
69+
TODO. Daemon that polls the kernel log: <http://unix.stackexchange.com/a/35853/32558> ?
70+
71+
## syslogd
72+
73+
## /var/log/sysloc
74+
75+
TODO. Daemon that polls the kernel log: <http://unix.stackexchange.com/a/35853/32558> ?
76+
77+
<http://askubuntu.com/questions/26237/difference-between-var-log-messages-var-log-syslog-and-var-log-kern-log>
78+
79+
## rsyslog
80+
81+
<http://www.rsyslog.com/>

gem5.md

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# gem5
2+
3+
BSD license.
4+
5+
Almost all 2016 commits by ARM and AMD employees.
6+
7+
Started in 2003 by <http://umich.edu/>.
8+
9+
ARM commits start 2009.
10+
11+
AMD commits start 2008.
12+
13+
## Getting started
14+
15+
Build:
16+
17+
sudo apt-get install mercurial
18+
git clone
19+
hg clone http://repo.gem5.org/gem5
20+
cd gem5
21+
hg co stable_2015_09_03
22+
scons -j$(nproc) build/ARM/gem5.opt
23+
24+
Run Syscall Emulation (SE) mode:
25+
26+
build/ARM/gem5.opt configs/example/se.py -c tests/test-progs/hello/bin/arm/linux/hello
27+
28+
Run Full System (FS) mode:
29+
30+
export M5_PATH='/dist/m5/system'
31+
sudo mkdir -p "$PATH"
32+
sudo chmod -R 777 "$PATH"
33+
cd "$PATH"
34+
wget http://www.gem5.org/dist/current/arm/aarch-system-2014-10.tar.xz
35+
unxz aarch-system-2014-10.tar.xz
36+
tar xvf aarch-system-2014-10.tar
37+
38+
cd "$GEM_DIR"
39+
build/ARM/gem5.opt -d /tmp/output configs/example/fs.py
40+
41+
# Another terminal.
42+
telnet localhost 3456
43+
44+
TODO: which image was used? How to change the default?
45+
46+
build/ARM/gem5.opt -d /tmp/output configs/example/fs.py --disk-image /dist/m5/system/disks/aarch64-ubuntu-trusty-headless.img
47+
48+
Fails with:
49+
50+
2777728592500: system.cpu.break_event: break event panic triggered
51+
52+
Some help at:
53+
54+
build/ARM/gem5.opt -d /tmp/output configs/example/fs.py -h
55+
56+
TODO how were those images generated?
57+
58+
TODO screen / display image?

init.md

-4
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ Set the `<start><stop>` levels of the script script:
129129

130130
The above sets start to `2` and stop to `1`.
131131

132-
## init directory
133-
134-
`/etc/init` is Upstart specific. It contains scripts that correspond to Upstart services.
135-
136132
## upstart
137133

138134
Intended as a backwards compatible replacement for System V.

minimal-distros.md

+8
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,11 @@ Seemed popular, but died in 2008?
5555
Tiny core Linux: <http://tinycorelinux.net/>, source: <http://git.tinycorelinux.net/index.cgi> Minimalistic with X.
5656

5757
Minimalistic, text based, security: <http://rlsd2.dimakrasner.com/>
58+
59+
## AEL
60+
61+
ARM Embedded Linux.
62+
63+
Linaro ARM board bring-up helper.
64+
65+
<http://www.linaro.org/blog/community-blog/is-linaro-a-distribution/>

nfs.md

+10
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,13 @@ Usage:
1313
ls /mnt/local
1414

1515
The server may restrict access to only certain paths.
16+
17+
## Server
18+
19+
Good tutorial: <https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-14-04>
20+
21+
sudo mkdir /var/nfs
22+
sudo chown nobody:nogroup /var/nfs
23+
sudo service nfs-kernel-server start
24+
echo '/shared/dir *(rw,sync,no_subtree_check)' | sudo tee /etc/exports
25+
sudo exportfs -a

scons/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.log
2+
*.o
3+
*.out

scons/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SCons
2+
3+
Tested on SCons v2.3.0.
4+
5+
1. [Hello](hello/)
6+
1. [Define](define/)
7+
1. [CLI arguments](cli_args/)
8+
1. [CFLAGS](cflags/)

scons/cflags/.sconsign.dblite

2.08 KB
Binary file not shown.

scons/cflags/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Pass compiler flags.
2+
3+
Comments on type:
4+
5+
//
6+
7+
are only legal in C99+, so C89 should fail on those.

scons/cflags/SConstruct

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
env = Environment()
2+
std = ARGUMENTS.get('std', 'c99')
3+
env.Append(CCFLAGS = '-std=' + std)
4+
env.Append(CCFLAGS = '-Werror')
5+
env.Program(target = 'main.out', source = ['main.c'])

scons/cflags/main.c

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
int main(void) {
2+
// C99
3+
return 0;
4+
}

scons/clean

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
find . \( -name '*.log' -o -name '*.o' -o -name '*.out' \) -delete

scons/cli_args/.sconsign.dblite

2.08 KB
Binary file not shown.

scons/cli_args/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Command line arguments passed to SCons.

scons/cli_args/SConstruct

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
env = Environment()
2+
x = ARGUMENTS.get('x', '0')
3+
env.Append(CPPDEFINES=['X=' + x])
4+
env.Program(target = 'main.out', source = ['main.c'])

scons/cli_args/main.c

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <stdio.h>
2+
3+
int main(void) {
4+
printf("%d\n", X);
5+
}

scons/define/.sconsign.dblite

2.08 KB
Binary file not shown.

scons/define/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Preprocessor define.

scons/define/SConstruct

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
env = Environment()
2+
env.Append(CPPDEFINES=['X=1'])
3+
env.Program(target = 'main.out', source = ['main.c'])

scons/define/main.c

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <stdio.h>
2+
3+
int main(void) {
4+
printf("%d\n", X);
5+
}

scons/hello/.sconsign.dblite

2.08 KB
Binary file not shown.

scons/hello/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello world.

scons/hello/SConstruct

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
env = Environment()
2+
env.Program(target = 'main.out', source = ['main.c'])

scons/hello/main.c

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <stdio.h>
2+
3+
int main(void) {
4+
puts("hello");
5+
}

scons/test

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
assert_fail() {
4+
echo "Test failed: ${1}"
5+
exit 1
6+
}
7+
8+
top="$(pwd)"
9+
log_path="${top}/test.log"
10+
11+
./clean
12+
13+
cd "$top"
14+
cd 'hello'
15+
scons >>"$log_path" 2>&1
16+
[ "$(./main.out)" = 'hello' ] || assert_fail 'hello'
17+
18+
cd "$top"
19+
cd 'define'
20+
scons >>"$log_path" 2>&1
21+
[ "$(./main.out)" = '1' ] || assert_fail 'define'
22+
23+
cd "$top"
24+
cd 'cli_args'
25+
scons >>"$log_path" 2>&1
26+
[ "$(./main.out)" = '0' ] || assert_fail 'cli_args 0'
27+
scons x=1 >>"$log_path" 2>&1
28+
[ "$(./main.out)" = '1' ] || assert_fail 'cli_args 1'
29+
30+
cd "$top"
31+
cd 'cflags'
32+
scons >>"$log_path" 2>&1
33+
[ scons std=c89 >>"$log_path" 2>&1 ] && assert_fail 'cflags c89'
34+
35+
echo 'All tests passed'

0 commit comments

Comments
 (0)