Modify sensor_common.c

Hello Nvidia team,

I am currently working on porting our V4L2 camera driver to Jetpack 6. I attempted to modify an error message in sensor_common.c. After building sensor_common.o, building the kernel, and flashing it to the AGX Orin module, I used insmod to insert the sensor module.

However, I am unable to see the modified error message. Could you please provide me with some advice on how to resolve this issue?

static int extract_pixel_format(
	const char *pixel_t, u32 *format)
{
	size_t size = strnlen(pixel_t, OF_MAX_STR_LEN);

	if (strncmp(pixel_t, "yuv_uyvy8", size) == 0)
		*format = V4L2_PIX_FMT_UYVY;
	else if (strncmp(pixel_t, "bayer_bggr10", size) == 0)
		*format = V4L2_PIX_FMT_SBGGR10;
	else if (strncmp(pixel_t, "bayer_rggb10", size) == 0)
		*format = V4L2_PIX_FMT_SRGGB10;
	else if (strncmp(pixel_t, "bayer_grbg10", size) == 0)
		*format = V4L2_PIX_FMT_SGRBG10;
	else if (strncmp(pixel_t, "bayer_gbrg10", size) == 0)
		*format = V4L2_PIX_FMT_SGBRG10;
	else if (strncmp(pixel_t, "bayer_bggr12", size) == 0)
		*format = V4L2_PIX_FMT_SBGGR12;
	else if (strncmp(pixel_t, "bayer_rggb12", size) == 0)
		*format = V4L2_PIX_FMT_SRGGB12;
	else if (strncmp(pixel_t, "bayer_gbrg12", size) == 0)
		*format = V4L2_PIX_FMT_SGBRG12;
	else if (strncmp(pixel_t, "bayer_grbg12", size) == 0)
		*format = V4L2_PIX_FMT_SGRBG12;
	else if (strncmp(pixel_t, "rgb_rgb88824", size) == 0)
		*format = V4L2_PIX_FMT_RGB24;
	else if (strncmp(pixel_t, "bayer_wdr_pwl_rggb12", size) == 0)
		*format = V4L2_PIX_FMT_SRGGB12;
	else if (strncmp(pixel_t, "bayer_wdr_pwl_gbrg12", size) == 0)
		*format = V4L2_PIX_FMT_SGBRG12;
	else if (strncmp(pixel_t, "bayer_wdr_pwl_grbg12", size) == 0)
		*format = V4L2_PIX_FMT_SGRBG12;
	else if (strncmp(pixel_t, "bayer_wdr_dol_rggb10", size) == 0)
		*format = V4L2_PIX_FMT_SRGGB10;
#if 0 /* disable for Canonical kenrel */
	else if (strncmp(pixel_t, "bayer_xbggr10p", size) == 0)
		*format = V4L2_PIX_FMT_XBGGR10P;
	else if (strncmp(pixel_t, "bayer_xrggb10p", size) == 0)
		*format = V4L2_PIX_FMT_XRGGB10P;
#endif
	else if (strncmp(pixel_t, "yuv_yuyv16", size) == 0)
		*format = V4L2_PIX_FMT_YUYV;
	else if (strncmp(pixel_t, "yuv_yvyu16", size) == 0)
		*format = V4L2_PIX_FMT_YVYU;
	else if (strncmp(pixel_t, "yuv_uyvy16", size) == 0)
		*format = V4L2_PIX_FMT_UYVY;
	else if (strncmp(pixel_t, "yuv_vyuy16", size) == 0)
		*format = V4L2_PIX_FMT_VYUY;
	else {
		pr_err("%s: Need to extend format %s Potest\n", __func__, pixel_t);
		return -EINVAL;
	}

	return 0;
}

build kernel

KERNEL_SOURCES=$L4T/sources
cd $KERNEL_SOURCES
export CROSS_COMPILE=/usr/src/l4t-gcc-113/aarch64--glibc--stable-2022.08-1/bin/aarch64-buildroot-linux-gnu-

make -C kernel ARCH=arm64 -j$(nproc)

build oot

export CROSS_COMPILE=/usr/src/l4t-gcc-113/aarch64--glibc--stable-2022.08-1/bin/aarch64-buildroot-linux-gnu-
export IGNORE_CC_MISMATCH=1
export KERNEL_HEADERS=$PWD/kernel/kernel-jammy-src

make modules ARCH=arm64 -j$(nproc)

Confirm the kernel Image by uname -a
If it’s not your build you may need to copy the Image to /boot/Image and checking the /boot/extlinux/extlinux.conf to confirm the FDT to apply the correct kernel Image.

Hi SaneCCC

I changed /boot/Image to my rebuilt kernel Image and rebooted, but the kernel build date is not as expected.

Flowing is my /boot/extlinux/extlinux.conf
Should I modify anything?

TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} root=PARTUUID=642b9212-eb2a-4c80-9ce9-f2a256234de3 rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb video=efifb:off console=tty0 nr_cpus=8 mem=32G

# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
#      sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot

# LABEL backup
#    MENU LABEL backup kernel
#    LINUX /boot/Image.backup
#    INITRD /boot/initrd
#    APPEND ${cbootargs}

That’s weird. Do you enable the signed kernel Image ?
Maybe rename the Image and modify the extlinux.conf to try.

Check below for signed kernel.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.