/
README.user-build
72 lines (43 loc) · 2.77 KB
/
README.user-build
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
It is possible to build the firmware as a normal user instead of root; this is now the default.
To make the process easier, it is also useful use copies of the FreeBSD sources tree.
For example:
1. Install various prerequisites
${SUDO} pkg install fakeroot gmake bison dialog4ports git wget subversion lzma u-boot-tools libtool
2. Create a working directory
3. Within that directory, make a copy of the freebsd sources, and freebsd-wifi-build.
For example, using github:
git clone https://github.com/freebsd/freebsd.git
git clone https://github.com/freebsd/freebsd-wifi-build.git
Or from a snapshot:
unzip freebsd-release-10.1.0.zip
git clone https://github.com/freebsd/freebsd-wifi-build.git
3. Prepare a user customisation script
Note, by default the kernel in /tftpboot will be read-only which means successive installkernel
will fail unless it is moved out of the way, or the option X_FORCE_TFTPCP=YES is used
echo 'X_FORCE_TFTPCP=YES' > ~/.freebsd-wifi-build-settings.cfg
4. Build the userland and kernel and the staging tree
cd freebsd-release-10.1.0
../freebsd-wifi-build/build/bin/build carambola2 buildworld
../freebsd-wifi-build/build/bin/build carambola2 buildkernel
../freebsd-wifi-build/build/bin/build carambola2 installworld
../freebsd-wifi-build/build/bin/build carambola2 installkernel
../freebsd-wifi-build/build/bin/build carambola2 distribution
These operations can be combined:
../freebsd-wifi-build/build/bin/build carambola2 buildworld buildkernel installworld installkernel distribution
5. Build the firmware filesystem you require.
../freebsd-wifi-build/build/bin/build carambola2 mfsroot
6. Customise the firmware further here, such as copying additional files / configuration into the mfsroot
7. Build the image applicable for your device.
Note that currently this requires /tftpboot to be user writable
../freebsd-wifi-build/build/bin/build carambola2 fsimage
../freebsd-wifi-build/build/bin/build carambola2 uboot
8. The build produces a kernel and an MFS image. For some architectures it is also possible to combine these.
For example, for the carambola2, assuming that 2MByte is allocated to the kernel:
X_FLASH=/tftpboot/kernel.CARAMBOLA2.lzma.flash
dd if=/dev/zero bs=$(( 0x200000 )) count=1 of=${X_FLASH}
dd if=/tftpboot/kernel.CARAMBOLA2.lzma.uImage of=${X_FLASH} conv=notrunc
dd if=/tftpboot/mfsroot-carambola2.img.ulzma >> ${X_FLASH}
The above is now done automatically for the carambola2.
The separate kernel and mfs image files remain if you need to do something different.
9. For building custom images it is probably going to be useful to make your own repo that scripts the above.
For an example, see https://github.com/pastcompute/carambola2-freebsd-userbuild