Skip to content

Commit 956adff

Browse files
committed
Make the most important dependency mandatory
1 parent 3aa1a67 commit 956adff

File tree

6 files changed

+32
-17
lines changed

6 files changed

+32
-17
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
# with a volume.
33
*
44
.*
5+
!requirements.txt
56
!setup

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# https://cirosantilli.com/linux-kernel-module-cheat#docker
22
FROM ubuntu:20.04
33
COPY setup /
4+
COPY requirements.txt /
45
RUN /setup -y
56
CMD bash

README.adoc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ Reserve 12Gb of disk and run:
9191
....
9292
git clone https://github.com/cirosantilli/linux-kernel-module-cheat
9393
cd linux-kernel-module-cheat
94+
./setup
9495
./build --download-dependencies qemu-buildroot
9596
./run
9697
....
@@ -146,6 +147,7 @@ All available modules can be found in the link:kernel_modules[] directory.
146147
It is super easy to build for different <<cpu-architecture,CPU architectures>>, just use the `--arch` option:
147148

148149
....
150+
./setup
149151
./build --arch aarch64 --download-dependencies qemu-buildroot
150152
./run --arch aarch64
151153
....
@@ -628,6 +630,7 @@ For the most part, if you just add the `--emulator gem5` option or `*-gem5` suff
628630
If you haven't built Buildroot yet for <<qemu-buildroot-setup>>, you can build from the beginning with:
629631

630632
....
633+
./setup
631634
./build --download-dependencies gem5-buildroot
632635
./run --emulator gem5
633636
....
@@ -843,6 +846,7 @@ Or to run a baremetal example instead:
843846
Be saner and use our custom built QEMU instead:
844847

845848
....
849+
./setup
846850
./build --download-dependencies qemu
847851
./run
848852
....
@@ -1099,6 +1103,7 @@ You can install those libraries with:
10991103

11001104
....
11011105
cd linux-kernel-module-cheat
1106+
./setup
11021107
./build --download-dependencies userland-host
11031108
....
11041109

@@ -1277,6 +1282,7 @@ Every `.c` file inside link:baremetal/[] and `.S` file inside `baremetal/arch/<a
12771282
For example, to run link:baremetal/arch/aarch64/dump_regs.c[] in QEMU do:
12781283

12791284
....
1285+
./setup
12801286
./build --arch aarch64 --download-dependencies qemu-baremetal
12811287
./run --arch aarch64 --baremetal baremetal/arch/aarch64/dump_regs.c
12821288
....
@@ -1360,6 +1366,7 @@ You can run all the baremetal examples in one go and check that all assertions p
13601366
To use gem5 instead of QEMU do:
13611367

13621368
....
1369+
./setup
13631370
./build --download-dependencies gem5-baremetal
13641371
./run --arch aarch64 --baremetal userland/c/hello.c --emulator gem5
13651372
....
@@ -1437,6 +1444,7 @@ For development, you will want to do a more controlled build with extra error ch
14371444
For the initial build do:
14381445

14391446
....
1447+
./setup
14401448
./build --download-dependencies docs
14411449
....
14421450

@@ -3925,7 +3933,7 @@ Then, from inside that image:
39253933
sudo apt-get install git
39263934
git clone https://github.com/cirosantilli/linux-kernel-module-cheat
39273935
cd linux-kernel-module-cheat
3928-
sudo ./setup -y
3936+
./setup -y
39293937
....
39303938

39313939
and then proceed exactly as in <<prebuilt>>.
@@ -27584,6 +27592,7 @@ For other Linux distros, everything will likely also just work if you install th
2758427592
Find out the packages that we install with:
2758527593

2758627594
....
27595+
cat ./setup
2758727596
./build --download-dependencies --dry-run <some-target> | less
2758827597
....
2758927598

build

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
#!/usr/bin/env python3
22

3-
import re
4-
import os
5-
6-
import cli_function
73
import collections
8-
import common
94
import copy
105
import itertools
116
import math
7+
import os
8+
import re
129
import subprocess
13-
import shell_helpers
14-
from shell_helpers import LF
1510

11+
import cli_function
12+
import common
1613
import lkmc
14+
import shell_helpers
15+
from shell_helpers import LF
1716

1817
class _Component:
1918
'''
@@ -498,7 +497,6 @@ Which components to build. Default: qemu-buildroot
498497
# Core requirements for this repo.
499498
'git',
500499
'moreutils', # ts
501-
'python3-pip',
502500
'rr',
503501
'squashfs-tools',
504502
'tmux',

common.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@
2828
import urllib.request
2929

3030
from shell_helpers import LF
31-
try:
32-
# Let's not make it mandatory for now.
33-
import china_dictatorship
34-
except ImportError:
35-
pass
31+
# https://cirosantilli.com/china-dictatorship/#mirrors
32+
import china_dictatorship
33+
assert "Tiananmen Square protests" in china_dictatorship.get_data()
3634
import cli_function
3735
import path_properties
3836
import shell_helpers

setup

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
#!/usr/bin/env bash
22
# Minimum requirements to run ./build --download-dependencies
3-
y=
43
if [ $# -eq 1 ]; then
54
y=-y
5+
else
6+
y=
67
fi
7-
apt-get update
8-
apt-get install $y \
8+
if [ -f /.dockerenv ]; then
9+
sudo=
10+
else
11+
sudo=sudo
12+
fi
13+
$sudo apt-get update
14+
$sudo apt-get install $y \
915
git \
1016
python3 \
17+
python3-pip \
1118
python3-distutils \
1219
;
20+
python3 -m pip install --user -r requirements.txt

0 commit comments

Comments
 (0)