diff options
| author | Paul Barker <pbarker@konsulko.com> | 2020-11-25 14:58:59 +0000 |
|---|---|---|
| committer | Andrei Gherzan <andrei@gherzan.ro> | 2020-11-27 14:29:55 +0000 |
| commit | 8827040d9c218f68ae3ee6a5814929888ed61581 (patch) | |
| tree | 78e999c3da833e601073c807075c427ff43ee2d5 | |
| parent | ba6a809a55514a10717bf7b371a63dae440f2cd9 (diff) | |
| download | meta-raspberrypi-8827040d9c218f68ae3ee6a5814929888ed61581.tar.gz | |
rpi-cmdline: Move cmdline.txt generation to a separate recipe
Instead of generating cmdline.txt in the kernel recipe, it is generated
in a standalone recipe and pulled in as a dependency of the bootfiles
recipe. This simplifies the process of using a linux-yocto,
linux-mainline or similiar kernel recipe instead of linux-raspberrypi.
In the rpi-cmdline recipe the command line is built from fragments which
can all be easily overridden. The variables `SERIAL` and `CMA` are
renamed to `CMDLINE_SERIAL` and `CMDLINE_CMA` for consistency. The
cmdline.txt file is created in the do_compile step to allow further
customisation via do_compile_append if needed.
Signed-off-by: Paul Barker <pbarker@konsulko.com>
| -rw-r--r-- | recipes-bsp/bootfiles/bootfiles.bb | 4 | ||||
| -rw-r--r-- | recipes-bsp/bootfiles/rpi-cmdline.bb | 49 | ||||
| -rw-r--r-- | recipes-kernel/linux/linux-raspberrypi.inc | 28 |
3 files changed, 51 insertions, 30 deletions
diff --git a/recipes-bsp/bootfiles/bootfiles.bb b/recipes-bsp/bootfiles/bootfiles.bb index 80e226d..d081806 100644 --- a/recipes-bsp/bootfiles/bootfiles.bb +++ b/recipes-bsp/bootfiles/bootfiles.bb | |||
| @@ -9,7 +9,7 @@ include recipes-bsp/common/raspberrypi-firmware.inc | |||
| 9 | 9 | ||
| 10 | INHIBIT_DEFAULT_DEPS = "1" | 10 | INHIBIT_DEFAULT_DEPS = "1" |
| 11 | 11 | ||
| 12 | DEPENDS = "rpi-config" | 12 | DEPENDS = "rpi-config rpi-cmdline" |
| 13 | 13 | ||
| 14 | COMPATIBLE_MACHINE = "^rpi$" | 14 | COMPATIBLE_MACHINE = "^rpi$" |
| 15 | 15 | ||
| @@ -34,7 +34,7 @@ do_deploy() { | |||
| 34 | touch ${DEPLOYDIR}/${PN}/${PN}-${PV}.stamp | 34 | touch ${DEPLOYDIR}/${PN}/${PN}-${PV}.stamp |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | do_deploy[depends] += "rpi-config:do_deploy" | 37 | do_deploy[depends] += "rpi-config:do_deploy rpi-cmdline:do_deploy" |
| 38 | 38 | ||
| 39 | addtask deploy before do_build after do_install | 39 | addtask deploy before do_build after do_install |
| 40 | do_deploy[dirs] += "${DEPLOYDIR}/${PN}" | 40 | do_deploy[dirs] += "${DEPLOYDIR}/${PN}" |
diff --git a/recipes-bsp/bootfiles/rpi-cmdline.bb b/recipes-bsp/bootfiles/rpi-cmdline.bb new file mode 100644 index 0000000..97db4e3 --- /dev/null +++ b/recipes-bsp/bootfiles/rpi-cmdline.bb | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | SUMMARY = "cmdline.txt file used to boot the kernel on a Raspberry Pi device" | ||
| 2 | LICENSE = "MIT" | ||
| 3 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
| 4 | |||
| 5 | COMPATIBLE_MACHINE = "^rpi$" | ||
| 6 | INHIBIT_DEFAULT_DEPS = "1" | ||
| 7 | inherit deploy nopackages | ||
| 8 | |||
| 9 | CMDLINE_DWC_OTG ?= "dwc_otg.lpm_enable=0" | ||
| 10 | CMDLINE_ROOTFS ?= "root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" | ||
| 11 | |||
| 12 | CMDLINE_SERIAL ?= "${@oe.utils.conditional("ENABLE_UART", "1", "console=serial0,115200", "", d)}" | ||
| 13 | |||
| 14 | CMDLINE_CMA ?= "${@oe.utils.conditional("RASPBERRYPI_CAMERA_V2", "1", "cma=64M", "", d)}" | ||
| 15 | |||
| 16 | CMDLINE_PITFT ?= "${@bb.utils.contains("MACHINE_FEATURES", "pitft", "fbcon=map:10 fbcon=font:VGA8x8", "", d)}" | ||
| 17 | |||
| 18 | # Add the kernel debugger over console kernel command line option if enabled | ||
| 19 | CMDLINE_KGDB ?= '${@oe.utils.conditional("ENABLE_KGDB", "1", "kgdboc=serial0,115200", "", d)}' | ||
| 20 | |||
| 21 | # Disable rpi logo on boot | ||
| 22 | CMDLINE_LOGO ?= '${@oe.utils.conditional("DISABLE_RPI_BOOT_LOGO", "1", "logo.nologo", "", d)}' | ||
| 23 | |||
| 24 | # You can define CMDLINE_DEBUG as "debug" in your local.conf or distro.conf | ||
| 25 | # to enable kernel debugging. | ||
| 26 | CMDLINE_DEBUG ?= "" | ||
| 27 | |||
| 28 | CMDLINE = " \ | ||
| 29 | ${CMDLINE_DWC_OTG} \ | ||
| 30 | ${CMDLINE_SERIAL} \ | ||
| 31 | ${CMDLINE_ROOTFS} \ | ||
| 32 | ${CMDLINE_CMA} \ | ||
| 33 | ${CMDLINE_KGDB} \ | ||
| 34 | ${CMDLINE_LOGO} \ | ||
| 35 | ${CMDLINE_PITFT} \ | ||
| 36 | ${CMDLINE_DEBUG} \ | ||
| 37 | " | ||
| 38 | |||
| 39 | do_compile() { | ||
| 40 | echo "${CMDLINE}" > "${WORKDIR}/cmdline.txt" | ||
| 41 | } | ||
| 42 | |||
| 43 | do_deploy() { | ||
| 44 | install -d "${DEPLOYDIR}/${BOOTFILES_DIR_NAME}" | ||
| 45 | install -m 0644 "${WORKDIR}/cmdline.txt" "${DEPLOYDIR}/${BOOTFILES_DIR_NAME}" | ||
| 46 | } | ||
| 47 | |||
| 48 | addtask deploy before do_build after do_install | ||
| 49 | do_deploy[dirs] += "${DEPLOYDIR}/${BOOTFILES_DIR_NAME}" | ||
diff --git a/recipes-kernel/linux/linux-raspberrypi.inc b/recipes-kernel/linux/linux-raspberrypi.inc index fe5da69..5b151a6 100644 --- a/recipes-kernel/linux/linux-raspberrypi.inc +++ b/recipes-kernel/linux/linux-raspberrypi.inc | |||
| @@ -29,22 +29,6 @@ KBUILD_DEFCONFIG_raspberrypi4-64 ?= "bcm2711_defconfig" | |||
| 29 | 29 | ||
| 30 | LINUX_VERSION_EXTENSION ?= "" | 30 | LINUX_VERSION_EXTENSION ?= "" |
| 31 | 31 | ||
| 32 | # CMDLINE for raspberrypi | ||
| 33 | SERIAL = "${@oe.utils.conditional("ENABLE_UART", "1", "console=serial0,115200", "", d)}" | ||
| 34 | CMA ?= "${@oe.utils.conditional("RASPBERRYPI_CAMERA_V2", "1", "cma=64M", "", d)}" | ||
| 35 | CMDLINE ?= "dwc_otg.lpm_enable=0 ${SERIAL} root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ${CMA}" | ||
| 36 | |||
| 37 | # Add the kernel debugger over console kernel command line option if enabled | ||
| 38 | CMDLINE_append = ' ${@oe.utils.conditional("ENABLE_KGDB", "1", "kgdboc=serial0,115200", "", d)}' | ||
| 39 | |||
| 40 | # Disable rpi logo on boot | ||
| 41 | CMDLINE_append = ' ${@oe.utils.conditional("DISABLE_RPI_BOOT_LOGO", "1", "logo.nologo", "", d)}' | ||
| 42 | |||
| 43 | # You can define CMDLINE_DEBUG as "debug" in your local.conf or distro.conf | ||
| 44 | # to enable kernel debugging. | ||
| 45 | CMDLINE_DEBUG ?= "" | ||
| 46 | CMDLINE_append = " ${CMDLINE_DEBUG}" | ||
| 47 | |||
| 48 | KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", "stmpe-ts", "", d)}" | 32 | KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", "stmpe-ts", "", d)}" |
| 49 | 33 | ||
| 50 | # A LOADADDR is needed when building a uImage format kernel. This value is not | 34 | # A LOADADDR is needed when building a uImage format kernel. This value is not |
| @@ -58,15 +42,3 @@ do_compile_append() { | |||
| 58 | oe_runmake dtbs CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} | 42 | oe_runmake dtbs CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} |
| 59 | fi | 43 | fi |
| 60 | } | 44 | } |
| 61 | |||
| 62 | do_deploy_append() { | ||
| 63 | # Deploy cmdline.txt only for the main kernel package | ||
| 64 | if [ ${KERNEL_PACKAGE_NAME} = "kernel" ]; then | ||
| 65 | install -d ${DEPLOYDIR}/${BOOTFILES_DIR_NAME} | ||
| 66 | PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}" | ||
| 67 | if [ ${PITFT} = "1" ]; then | ||
| 68 | PITFT_PARAMS="fbcon=map:10 fbcon=font:VGA8x8" | ||
| 69 | fi | ||
| 70 | echo "${CMDLINE}${PITFT_PARAMS}" > ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/cmdline.txt | ||
| 71 | fi | ||
| 72 | } | ||
