aboutsummaryrefslogtreecommitdiff
path: root/readme.md
blob: 332674016679b5f1ef3e61e333d40d5c107ad604 (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# sources

(ordered chronologically by access time)

- [Kbuild object variable name rationale][kbuild-obj-var]
- [Kbuild kernel module setup guide][kbuild-module-makefile]
- [`struct file_operations`][c-struct-file-operations] documentation, also
    - write(2)
    - read(2)
- (Sadly) [the Linux kernel source][kernel] itself, especially
    - drivers/char/random.c
    - drivers/char/mem.c
- [Linux kernel labs - character device drivers][kernel-labs-chrdev]
- [Core API][core-api]
- [Driver API][driver-api]

[kbuild-obj-var]: https://docs.kernel.org/kbuild/makefiles.html#loadable-module-goals-obj-m
[kbuild-module-makefile]: https://www.kernel.org/doc/html/latest/kbuild/modules.html#creating-a-kbuild-file-for-an-external-module
[c-struct-file-operations]: https://www.kernel.org/doc/html/latest/filesystems/vfs.html#struct-file-operations
[kernel]: https://github.com/torvalds/linux
[kernel-labs-chrdev]: https://linux-kernel-labs.github.io/refs/heads/master/labs/device_drivers.html
[core-api]: https://docs.kernel.org/core-api/kernel-api.html
[driver-api]: https://www.kernel.org/doc/html/latest/driver-api/infrastructure.html

# tips

- When the kernel documentation references manpages, these actually contain
  useful information. Manpages are not only for commands, but also include
  detailed documentation for the syscall interface and other C APIs.

  Since most of the manpages referenced by the kernel are from section 2 (on
  system calls), you should append the number between brackets to the `man`
  command, i.e. to read 'write(2)' use the command `man 2 write`.
- Use `dmesg` with the `-w` or `-W` option (see man dmesg(1))
- Start writing a kernel module that targets the kernel version of the
  BeagleBone image you're planning on using.

# direct ethernet setup

You can use NetworkManager to both share your computer's existing network
connection and start a DHCP server for assigning IP addresses automatically.
This allows you to `ssh` into the BeagleBone, as well as share your internet
connection (even eduroam!) over a single direct ethernet connection.

1. Connect the BeagleBone to your computer using an ethernet cable, and make
   sure the BeagleBone is on. The ethernet port's link lights should start
   blinking.
2. Run `nmcli device` on your computer, note the name of the **connection** on
   the ethernet port:

   ```
   $ nmcli device             
   DEVICE         TYPE      STATE                                  CONNECTION
   wlan0          wifi      connected                              eduroam
   enp0s25        ethernet  connecting (getting IP configuration)  Wired connection 1
   lo             loopback  connected (externally)                 lo
   ```

   (the automatically generated name `Wired connection 1` is the ethernet
   connection to the BeagleBone)
3. Run the following command to enable sharing on this port (replace NAME with
   the connection name you found).

   ```
   $ nmcli connection modify NAME ipv4.method shared ipv4.addresses 192.168.2.2/24
   ```

   This assigns the ip address 192.168.2.2 to your computer, and gives the
   BeagleBone an address in the 192.168.2.0/24 range (edit this only if it
   conflicts with another subnet).
4. Run the following command to   to activate the connection.

   ```
   $ nmcli connection up NAME
   ```

5. (Optionally) use `nmap -sn 192.168.2.0/24` **as root** to find the IP
   address the BeagleBone got, or just connect to the BeagleBone using the
   hostname you configured before (in `/etc/hostname` on the BeagleBone).
6. Profit

When you're done doing stuff on the BeagleBone, and want to reverse all the
above changes, simply run:

```
$ nmcli connection delete NAME
```

NetworkManager will automatically re-configure the ethernet connection for
regular use the next time you plug in an ethernet cable.