Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nest
Puppet
Commits
2b91afb1
Commit
2b91afb1
authored
Mar 02, 2021
by
James T. Lee
Browse files
firmware: Build u-boot
parent
9c82566c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
128 additions
and
41 deletions
+128
-41
manifests/base.pp
manifests/base.pp
+2
-2
manifests/base/bootloader.pp
manifests/base/bootloader.pp
+0
-8
manifests/base/bootloader/grub.pp
manifests/base/bootloader/grub.pp
+18
-1
manifests/base/firmware/arm.pp
manifests/base/firmware/arm.pp
+8
-5
manifests/base/firmware/uboot.pp
manifests/base/firmware/uboot.pp
+70
-0
manifests/base/kernel.pp
manifests/base/kernel.pp
+25
-16
manifests/lib/kconfig.pp
manifests/lib/kconfig.pp
+5
-9
No files found.
manifests/base.pp
View file @
2b91afb1
...
@@ -27,7 +27,7 @@ class nest::base {
...
@@ -27,7 +27,7 @@ class nest::base {
contain
'::nest::base::systemd'
contain
'::nest::base::systemd'
contain
'::nest::base::timesyncd'
contain
'::nest::base::timesyncd'
if
$facts
[
'build'
]
in
[
'stage2'
,
'stage3'
]
{
if
$facts
[
'build'
]
in
[
undef
,
'stage2'
,
'stage3'
]
{
contain
'::nest::base::dracut'
contain
'::nest::base::dracut'
contain
'::nest::base::firmware'
contain
'::nest::base::firmware'
contain
'::nest::base::fstab'
contain
'::nest::base::fstab'
...
@@ -61,7 +61,7 @@ class nest::base {
...
@@ -61,7 +61,7 @@ class nest::base {
->
Class
[
'::nest::base::dracut'
]
->
Class
[
'::nest::base::dracut'
]
# Bootloaders are host-specific
# Bootloaders are host-specific
if
$facts
[
'build'
]
==
'stage3'
{
if
$facts
[
'build'
]
in
[
undef
,
'stage3'
]
{
contain
'::nest::base::bootloader'
contain
'::nest::base::bootloader'
Class
[
'::nest::base::dracut'
]
Class
[
'::nest::base::dracut'
]
...
...
manifests/base/bootloader.pp
View file @
2b91afb1
...
@@ -32,14 +32,6 @@ class nest::base::bootloader {
...
@@ -32,14 +32,6 @@ class nest::base::bootloader {
default
:
{
default
:
{
contain
'nest::base::bootloader::grub'
contain
'nest::base::bootloader::grub'
exec
{
'dracut'
:
command
=>
'version=$(ls /lib/modules | sort -V | tail -1) && dracut --force --kver $version'
,
refreshonly
=>
true
,
timeout
=>
0
,
provider
=>
shell
,
notify
=>
Class
[
'nest::base::bootloader::grub'
],
}
}
}
}
}
}
}
manifests/base/bootloader/grub.pp
View file @
2b91afb1
class
nest::base::bootloader::grub
{
class
nest::base::bootloader::grub
{
# Install stuff normally handled by kernel-install(8)
exec
{
default
:
refreshonly
=>
true
,
;
'kernel-install'
:
command
=>
'/usr/bin/make install'
,
cwd
=>
'/usr/src/linux'
,
;
'dracut'
:
command
=>
'version=$(ls /lib/modules | sort -V | tail -1) && dracut --force --kver $version'
,
provider
=>
shell
,
;
}
$font
=
"ter-x
${::nest::console_font_size}
b"
$font
=
"ter-x
${::nest::console_font_size}
b"
nest::lib::package_use
{
'sys-boot/grub'
:
nest::lib::package_use
{
'sys-boot/grub'
:
...
@@ -53,7 +70,7 @@ class nest::base::bootloader::grub {
...
@@ -53,7 +70,7 @@ class nest::base::bootloader::grub {
exec
{
'grub-mkconfig'
:
exec
{
'grub-mkconfig'
:
command
=>
'/usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg'
,
command
=>
'/usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg'
,
refreshonly
=>
true
,
refreshonly
=>
true
,
require
=>
Exec
[
'grub-mkfont'
],
require
=>
Exec
[
'grub-mkfont'
,
'kernel-install'
,
'dracut'
],
}
}
$file_line_notify
=
Exec
[
'grub-mkconfig'
]
$file_line_notify
=
Exec
[
'grub-mkconfig'
]
...
...
manifests/base/firmware/arm.pp
View file @
2b91afb1
class
nest::base::firmware::arm
{
class
nest::base::firmware::arm
{
# For nest::base::portage::makeopts
include
'::nest::base::portage'
nest::lib::toolchain
{
'arm-none-eabi'
:
nest::lib::toolchain
{
'arm-none-eabi'
:
gcc_only
=>
true
,
gcc_only
=>
true
,
}
}
...
@@ -9,15 +12,15 @@ class nest::base::firmware::arm {
...
@@ -9,15 +12,15 @@ class nest::base::firmware::arm {
source
=>
'https://gitlab.james.tl/nest/forks/arm-trusted-firmware.git'
,
source
=>
'https://gitlab.james.tl/nest/forks/arm-trusted-firmware.git'
,
revision
=>
'main'
,
revision
=>
'main'
,
}
}
~>
include
'::nest::base::portage'
exec
{
'arm-trusted-firmware-build'
:
exec
{
"/usr/bin/make
${::nest::base::portage::makeopts}
PLAT=rk3399"
:
command
=>
"/usr/bin/make
${::nest::base::portage::makeopts}
PLAT=rk3399"
,
cwd
=>
'/usr/src/arm-trusted-firmware'
,
cwd
=>
'/usr/src/arm-trusted-firmware'
,
path
=>
[
'/usr/lib/distcc/bin'
,
'/usr/bin'
,
'/bin'
],
path
=>
[
'/usr/lib/distcc/bin'
,
'/usr/bin'
,
'/bin'
],
environment
=>
'HOME=/root'
,
# for distcc
environment
=>
'HOME=/root'
,
# for distcc
timeout
=>
0
,
timeout
=>
0
,
c
re
ates
=>
'/usr/src/arm-trusted-firmware/build/rk3399/release/bl31/bl31.elf'
,
re
freshonly
=>
true
,
subscribe
=>
Vcsrepo
[
'/usr/src/arm-trusted-firmware
'
],
noop
=>
!
$facts
[
'build
'
],
require
=>
Nest
::
Lib
::
Toolchain
[
'arm-none-eabi'
],
require
=>
Nest
::
Lib
::
Toolchain
[
'arm-none-eabi'
],
}
}
}
}
manifests/base/firmware/uboot.pp
View file @
2b91afb1
class
nest::base::firmware::uboot
{
class
nest::base::firmware::uboot
{
# For nest::base::portage::makeopts
include
'::nest::base::portage'
Nest
::
Lib
::
Kconfig
{
config
=>
'/usr/src/u-boot/.config'
,
}
$uboot_branch
=
$facts
[
'profile'
][
'platform'
]
?
{
'pinebookpro'
=>
'pinebookpro'
,
default
=>
'main'
,
}
vcsrepo
{
'/usr/src/u-boot'
:
ensure
=>
latest
,
provider
=>
git
,
source
=>
'https://gitlab.james.tl/nest/forks/u-boot.git'
,
revision
=>
$uboot_branch
,
}
$defconfig
=
$facts
[
'profile'
][
'platform'
]
?
{
'pinebookpro'
=>
'pinebook-pro-rk3399_defconfig'
,
}
exec
{
'uboot-defconfig'
:
command
=>
"/usr/bin/make
${defconfig}
"
,
cwd
=>
'/usr/src/u-boot'
,
creates
=>
'/usr/src/u-boot/.config'
,
require
=>
Vcsrepo
[
'/usr/src/u-boot'
],
}
case
$facts
[
'profile'
][
'platform'
]
{
'pinebookpro'
:
{
$build_options
=
'BL31=/usr/src/arm-trusted-firmware/build/rk3399/release/bl31/bl31.elf'
nest::lib::kconfig
{
# Leave no trace...
# may want to use SPI for other things
'CONFIG_ENV_IS_NOWHERE'
:
value
=>
y
;
'CONFIG_ENV_IS_IN_SPI_FLASH'
:
value
=>
n
,
;
# Hangs system during early kernel init
'CONFIG_USB_OHCI_GENERIC'
:
value
=>
n
,
;
}
}
}
exec
{
'uboot-olddefconfig'
:
command
=>
'/usr/bin/make olddefconfig'
,
cwd
=>
'/usr/src/u-boot'
,
refreshonly
=>
true
,
}
~>
exec
{
'uboot-build'
:
command
=>
"/usr/bin/make
${::nest::base::portage::makeopts}
${build_options}
"
,
cwd
=>
'/usr/src/u-boot'
,
path
=>
[
'/usr/lib/distcc/bin'
,
'/usr/bin'
,
'/bin'
],
environment
=>
'HOME=/root'
,
# for distcc
timeout
=>
0
,
# just attempt once per config change
refreshonly
=>
true
,
noop
=>
!
$facts
[
'build'
],
}
Exec
[
'uboot-defconfig'
]
->
Nest
::
Lib
::
Kconfig
<|
config
==
'/usr/src/u-boot/.config'
|>
~>
Exec
[
'uboot-olddefconfig'
]
}
}
manifests/base/kernel.pp
View file @
2b91afb1
class
nest::base::kernel
{
class
nest::base::kernel
{
# For nest::base::portage::makeopts
include
'::nest::base::portage'
$sources_package
=
$facts
[
'profile'
][
'platform'
]
?
{
$sources_package
=
$facts
[
'profile'
][
'platform'
]
?
{
'raspberrypi'
=>
'sys-kernel/raspberrypi-sources'
,
'raspberrypi'
=>
'sys-kernel/raspberrypi-sources'
,
default
=>
'sys-kernel/gentoo-sources'
,
default
=>
'sys-kernel/gentoo-sources'
,
...
@@ -19,45 +22,51 @@ class nest::base::kernel {
...
@@ -19,45 +22,51 @@ class nest::base::kernel {
default
=>
'defconfig kvmconfig'
,
default
=>
'defconfig kvmconfig'
,
}
}
exec
{
'
make
defconfig'
:
exec
{
'
kernel-
defconfig'
:
command
=>
"/usr/bin/make
${defconfig}
"
,
command
=>
"/usr/bin/make
${defconfig}
"
,
cwd
=>
'/usr/src/linux'
,
cwd
=>
'/usr/src/linux'
,
creates
=>
'/usr/src/linux/.config'
,
creates
=>
'/usr/src/linux/.config'
,
require
=>
Package
[
$sources_package
],
require
=>
Package
[
$sources_package
],
notify
=>
Exec
[
'
make
kernel'
],
notify
=>
Exec
[
'kernel
-build
'
],
}
}
$::nest::kernel_config
.
each
|
$config
,
$value
|
{
$::nest::kernel_config
.
each
|
$config
,
$value
|
{
nest::lib::kernel_config
{
$config
:
nest::lib::kconfig
{
$config
:
value
=>
$value
,
config
=>
'/usr/src/linux/.config'
,
value
=>
$value
,
}
}
}
}
if
$::nest::bootloader
==
'systemd'
{
if
$::nest::bootloader
==
'systemd'
{
nest::lib::kernel_config
{
'CONFIG_EFI_STUB'
:
nest::lib::kconfig
{
'CONFIG_EFI_STUB'
:
value
=>
'y'
,
config
=>
'/usr/src/linux/.config'
,
value
=>
y
,
}
}
# Use kernel-install(8) instead
$install_target
=
''
}
else
{
$install_target
=
'install'
}
}
include
'::nest::base::portage'
exec
{
'kernel-olddefconfig'
:
exec
{
'make kernel'
:
command
=>
'/usr/bin/make olddefconfig'
,
command
=>
"/usr/bin/make
${::nest::base::portage::makeopts}
olddefconfig all
${install_target}
modules_install | /usr/bin/tee build.log"
,
cwd
=>
'/usr/src/linux'
,
refreshonly
=>
true
,
}
~>
exec
{
'kernel-build'
:
command
=>
"/usr/bin/make
${::nest::base::portage::makeopts}
all modules_install | /usr/bin/tee build.log"
,
cwd
=>
'/usr/src/linux'
,
cwd
=>
'/usr/src/linux'
,
path
=>
[
'/usr/lib/distcc/bin'
,
'/usr/bin'
,
'/bin'
],
path
=>
[
'/usr/lib/distcc/bin'
,
'/usr/bin'
,
'/bin'
],
environment
=>
'HOME=/root'
,
# for distcc
environment
=>
'HOME=/root'
,
# for distcc
timeout
=>
0
,
timeout
=>
0
,
refreshonly
=>
true
,
refreshonly
=>
true
,
noop
=>
!
$facts
[
'build'
],
}
}
~>
exec
{
'module-rebuild'
:
exec
{
'module-rebuild'
:
command
=>
"/usr/bin/emerge --oneshot --usepkg n --jobs
${::nest::concurrency}
--load-average
${::nest::base::portage::loadlimit}
zfs-kmod"
,
command
=>
"/usr/bin/emerge --oneshot --usepkg n --jobs
${::nest::concurrency}
--load-average
${::nest::base::portage::loadlimit}
zfs-kmod"
,
timeout
=>
0
,
timeout
=>
0
,
refreshonly
=>
true
,
refreshonly
=>
true
,
subscribe
=>
Exec
[
'make kernel'
],
}
}
Exec
[
'kernel-defconfig'
]
->
Nest
::
Lib
::
Kconfig
<|
config
==
'/usr/src/linux/.config'
|>
~>
Exec
[
'kernel-olddefconfig'
]
}
}
manifests/lib/k
ernel_
config.pp
→
manifests/lib/kconfig.pp
View file @
2b91afb1
define
nest::lib::kernel_config
(
define
nest::lib::kconfig
(
Nest
::
Kconfig
$value
,
Stdlib
::
Absolutepath
$config
,
Nest
::
Kconfig
$value
,
)
{
)
{
# Required for Exec['make defconfig'], Exec['make kernel']
include
'nest'
$line_ensure
=
$value
?
{
$line_ensure
=
$value
?
{
undef
=>
'absent'
,
undef
=>
'absent'
,
default
=>
'present'
,
default
=>
'present'
,
...
@@ -16,13 +14,11 @@ define nest::lib::kernel_config (
...
@@ -16,13 +14,11 @@ define nest::lib::kernel_config (
default
=>
"
${name}
=
\"
${value}
\"
"
,
default
=>
"
${name}
=
\"
${value}
\"
"
,
}
}
file_line
{
"k
ernel-
config-
${name}
-
${value}
"
:
file_line
{
"kconfig-
${name}
-
${value}
"
:
ensure
=>
$line_ensure
,
ensure
=>
$line_ensure
,
path
=>
'/usr/src/linux/.
config
'
,
path
=>
$
config
,
line
=>
$line
,
line
=>
$line
,
match
=>
"(^| )
${name}
[= ]"
,
match
=>
"(^| )
${name}
[= ]"
,
match_for_absence
=>
true
,
match_for_absence
=>
true
,
require
=>
Exec
[
'make defconfig'
],
notify
=>
Exec
[
'make kernel'
],
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment