This repository has been archived by the owner on Jun 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
tasks.rake
101 lines (83 loc) · 3.33 KB
/
tasks.rake
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
92
93
94
95
96
97
98
99
100
require 'tempfile'
# If specified on the command line, these tasks are run before loading the rakefile
task :default => :usage
task :usage do
puts """Usage:
rpi-build [option tasks] <release> <target>
Targets:
* fetch - Download files
* unpack - Unpack archives into workdir
* patch - Patch Linux kernel source
* config - Configure Linux kernel
* menuconfig - make menuconfig
* diffconfig - Show kernel config diff from default config
* kbuild - Build Linux kernel
* kmodules - Copy modules and device firmware to a temporary directory
* external - Build and install out-of-tree modules
* build - Build all
* readme - Create README.md
* commit - Commit kernel and firmware
* push - Push commit(s)
* archive - Archive workdir out
* transfer - Copy archive to machine (needs SSHIP)
* install - Install
* diff[against] - Create source code diff files (diffprep has to be run)
Filename: <dir>-<against>.patch in workdir
'against' can be 'unpack' or 'patch'. Default is 'unpack'.
* merge[d1,d2] - Merge 2 directories for install/commit.
Without arguments, the directory is searched for 'workdir*'
Option tasks:
* use[library] - Use library (Rakefile)
* clean - Clean workdir
* log - Redirect output to build.log
* diffprep[dirs] - Prepare source for the diff target
'dirs' is a comma separated list of source dirs,
e.g. diffprep[linux,u-boot]. Default is 'linux'
rpi-build is built on top of Rake, and has much of the same behaviour.
Targets, releases and option tasks are Rake tasks.
They are run in the order they are given on the command line,
except for option tasks which are run before any other tasks.
Some Rake options:
-h - Help
--trace - Be more verbose
Print full stack trace on exceptions
Environment variables:
RPI_BUILD_DIR - rpi-build root directory
Default: ~/rpi-build
WORKDIR - Working directory used when building
Default: ./workdir
DOWNLOAD_DIR - Directory for downloaded files
Default: $RPI_BUILD_DIR/downloads
Admin mode:
rpi-build admin <action>
Actions:
* addlib[gitrepo] - Add library with git
Short gitrepo assumes Github: addlib[notro/fbtft-build]
* update - Update git repos in RPI_BUILD_DIR
"""
end
desc "Clean workdir"
task :clean do
rm_rf Rake.application.workdir
end
desc "Set which library to use (Rakefile)"
task :use, [:library] do |t, args|
raise "missing library argument to task 'use' (e.g. use[fbtft-build])" if args.library.empty?
fn = File.join ENV["RPI_BUILD_DIR"], args.library, 'Rakefile'
raise "can't find library #{args.library} (#{fn})" unless File.exists? fn
Dir.chdir File.dirname fn
end
desc "Redirect output to build.log"
task :log do
$stderr = $stdout
logfile = Tempfile.open(['rpi-build', '.log'])
puts "Temporary logfile: #{logfile.path}"
logfile.puts "Start: #{Time.now}\n\n"
logfile.puts "Commandline arguments: #{ARGV.join ' '}\n\n"
STDOUT.reopen logfile
STDERR.reopen logfile
Rake.application.logfile = logfile
end
task :diffprep, [:dirs] do |t, args|
ENV['DIFFPREP'] = args.dirs.empty? ? 'linux' : args.dirs.join(',')
end