This repository has been archived by the owner on Sep 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
HACKING.en
85 lines (53 loc) · 2.12 KB
/
HACKING.en
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
###############################################
Adding extra software to TCOS initramfs
###############################################
TCOS is a set of scripts that copies binaries and
libraries in a boot image file. It is posible to
add more utilities as they are needed.
Use /etc/tcos/hacking/template as a template
HOW-TO add specific applications to the generated
image:
Add display (image viewer => ImageMagick)
Create a file in /etc/tcos/hacking/ containing this:
####### /etc/tcos/hacking/display ##############
# TCOS script for display command
cpifexists /usr/bin/display /usr/bin
##############################################
Helpers that can be used:
* cpifexits [BINARY] [PATH_DESTINATION]
Ayudantes que podemos usar:
* cpifexits [BINARY] [PATH_DESTINATION]
It copies a BINARY designated by its full path
in PATH_DESTINATION inside the initramfs
This function also copies any dependent library.
Example:
cpifexists /sbin/fdisk /sbin/
Internally it runs:
$ ldd /sbin/fdisk
linux-gate.so.1 => (0xffffe000)
libc.so.6 => /lib/tls/libc.so.6 (0xb7e3e000)
/lib/ld-linux.so.2 (0xb7f8f000)
And the linked libraries are copied.
NOTE: It will try NOT copying any library related to /lib/tls/
Regular files can be copied too:
cpifexists /etc/hosts.allow /etc/
* copydir [DIR] [PATH_DESTINATION]
It copies a whole directory in the initramfs file,
being equivalent to run cp -ra DIR $INITRAMFS/$DESTINATION
Example:
copydir /etc/dropbear/ /etc/
* stat_before
It calculates the initramfs file's size for state_after
function
* stat_after "TEXT"
It calculates the difference between the current initramfs
file's size and the one state_before calculated and prints
that difference on screen.
Full example:
stat_before
cpifexists /usr/bin/display /usr/bin/
stat_after "ImageMagick display"
This copies the BINARY (and linked libraries) in the
initramfs and calculates the added size, printing on
screen:
=> Package ImageMagick display got XXX Kb.