1
00:00:00,000 --> 00:00:01,008
- [Instructor] Let's talk a little bit

2
00:00:01,008 --> 00:00:08,009
about the sys file system, which is mounted on /sys.

3
00:00:08,009 --> 00:00:11,008
So this should happen automatically at boot time,

4
00:00:11,008 --> 00:00:14,004
so you could change directory at /sys,

5
00:00:14,004 --> 00:00:16,008
you should see lots of stuff.

6
00:00:16,008 --> 00:00:21,008
Originally, sysfs was for showing

7
00:00:21,008 --> 00:00:25,007
how hardware is connected on your system,

8
00:00:25,007 --> 00:00:30,007
hardware with buses and connections is a tree structure,

9
00:00:30,007 --> 00:00:32,001
just like a directory,

10
00:00:32,001 --> 00:00:34,009
so you could walk the directory structure

11
00:00:34,009 --> 00:00:37,008
and walk the hardware information.

12
00:00:37,008 --> 00:00:41,002
It still has that and lots more.

13
00:00:41,002 --> 00:00:44,004
In fact, underneath sys you should probably find

14
00:00:44,004 --> 00:00:49,003
tens of thousands of files and directories.

15
00:00:49,003 --> 00:00:51,007
We're not going to talk about all of them.

16
00:00:51,007 --> 00:00:55,000
In fact, it's difficult to talk

17
00:00:55,000 --> 00:00:59,006
in any kind of breadth about the sys file system,

18
00:00:59,006 --> 00:01:02,008
but we're going to hit some high points for you.

19
00:01:02,008 --> 00:01:06,001
A couple of my favorite things underneath sys actually

20
00:01:06,001 --> 00:01:11,002
are the debug file system and the tracing information.

21
00:01:11,002 --> 00:01:14,007
When I'm working on a device driver or something like that,

22
00:01:14,007 --> 00:01:19,003
it's really nice to find out what's going on in the kernel,

23
00:01:19,003 --> 00:01:22,005
for example, tracing all the functions being called

24
00:01:22,005 --> 00:01:25,001
can be helpful.

25
00:01:25,001 --> 00:01:28,005
Another place in sys that I find valuable

26
00:01:28,005 --> 00:01:32,001
is information about loadable kernel modules.

27
00:01:32,001 --> 00:01:34,009
If you go into sys module, you'll see a subdirectory

28
00:01:34,009 --> 00:01:39,002
for every dynamic loadable kernel module.

29
00:01:39,002 --> 00:01:42,008
It's actually whether they were dynamically loaded,

30
00:01:42,008 --> 00:01:45,006
or they were linked in their kernel image,

31
00:01:45,006 --> 00:01:46,006
they're all there.

32
00:01:46,006 --> 00:01:48,009
So that's more comprehensive

33
00:01:48,009 --> 00:01:53,003
than listing just dynamically loaded modules.

34
00:01:53,003 --> 00:01:55,002
As I mentioned, there's lots of hardware information,

35
00:01:55,002 --> 00:01:59,001
there's lots of device information underneath sys.

36
00:01:59,001 --> 00:02:02,005
There's a subdirectory /sys/dev that shows you information

37
00:02:02,005 --> 00:02:05,005
about all the block and character device files

38
00:02:05,005 --> 00:02:10,000
and block device information underneath /sys/block.

39
00:02:10,000 --> 00:02:13,005
Underneath the /sys/class are classes

40
00:02:13,005 --> 00:02:17,001
or types of devices, like /sys/class/net

41
00:02:17,001 --> 00:02:20,007
to find out about your network devices, lots of stuff.

42
00:02:20,007 --> 00:02:22,008
You can spend quite a bit of time

43
00:02:22,008 --> 00:02:25,002
just looking around at stuff.

44
00:02:25,002 --> 00:02:28,001
It can be interesting. Yeah, have a look.

45
00:02:28,001 --> 00:02:30,000
Plus, we'll do a challenge.

