Jump to content

Booting a rt preempt patched kernel


JNC

Recommended Posts

Hello,

  Thank you ahead of time!! I realize there is not an armbian disro for

the roc 3328 renegade. It does seem that you all can help with my issue though. I recently patched and compiled a kernel to run

real time with the rt preempt. The issue I'm running into is this thing doesn't use grub , so I can't choose the kernel at boot up like a x86 and it doesn't have a config file like a rspi. Is there a way around this ? I'm way out of my comfort zone here. According to what I have read, I need to copy the vmlinuzrt18 to the area where the present kernel is being called now. I admitting find the whole u boot thing confusing. 

Can anyone help me out? Thanks again

Edited by JNC
Link to comment
Share on other sites

3 hours ago, JNC said:

there is not an armbian disro for the roc 3328 renegade.

2


Officially not, but someone has added configuration and it's possible to build. It is untested but worth trying. You need to add those two parameters to the default-config:

LIB_TAG="development"
EXPERT="yes"

The rest is default: https://docs.armbian.com/Developer-Guide_Build-Preparation/

Link to comment
Share on other sites

15 minutes ago, Igor said:

It is untested but worth trying

I have tried it, there are boot problems here that I haven't yet gotten into (the list grows)

 

I have seen implementations of boot menus with u-boot, but have not done so myself.  Google may yield some examples, it appears there is a "bootmenu" command.that can be scripted.

 

Link to comment
Share on other sites

Oh, too bad then :(

 

1 minute ago, TonyMac32 said:

I have seen implementations of boot menus with u-boot, but have not done so myself. 


Boot menu for what? Choosing different kernels/OS?

Link to comment
Share on other sites

Thank you for the responses. The boot menu i was referring to was like grub. My goal is to simply use my patched real time kernel. I believe it has to be called up by uboot, and its reference is in the boot file.Im new at this and the uboot is  kinda overwhelming. I can provide more information. Let me know what you need.  

we got here by the following;

dowloaded the mainline  kernel with wget

untarred it

dowloaded the 4.14r18 preempt patch

unzipped it

ran the patch with sucess

ran menuconfig and set the kernel for fully preemptable

saved the config

ran make make_install, successfully compiled the patched kernel

 

I just need to tell the system to use the new kernel at boot up, and that is where im stuck. Anyone up for an adventure? This cant be that hard, seems like i need to edit uboot.

Link to comment
Share on other sites

13 hours ago, Igor said:

 

13 hours ago, TonyMac32 said:

I have seen implementations of boot menus with u-boot, but have not done so myself. 


Boot menu for what? Choosing different kernels/OS?

 

There was also one on mediateks/BPi R2 u-boot (removed it, I don't think it does sane things)... You can define multiple bootcommands, and during bootup of u-boot you can decide which one you want to run...  The mediatek one was highly 'static' and not really useful so I saw no reason to keep it inside... If it's there, people will think it does sane things.. IMO if this is not tested (for armbian) it might mess up things, be save, patch it out... 

Link to comment
Share on other sites

have fun... :lol: don't be upset when it b*tches you... When it looks like this one:

Spoiler

#define USB_BOOT_MENU 
#define SDcard_BOOT_MENU 
#define Browser_BOOT_MENU 


#define ENV_BOOT_CMD0 \
    "boot0=tftpboot; bootm\0"


#define ENV_BOOT_CMD1 \
    "boot1=tftpboot;run boot_wr_img;run boot_rd_img;bootm\0"




#define ENV_BOOT_CMD2 \
    "boot2=run boot_rd_img;run rescue;bootm\0"
//    "boot2=run boot_rd_img;bootm\0"


#define ENV_BOOT_CMD3 \
    "boot3=tftpboot ${loadaddr} u-boot-mtk.bin;run wr_uboot\0"


#define ENV_BOOT_CMD4 \
    "boot4=loadb;run boot_wr_img;run boot_rd_img;bootm\0"


#define ENV_BOOT_CMD5 \
    "boot5=loadb;run wr_uboot\0"


#define ENV_BOOT_CMD6 \
    "boot6=usb start;run boot_wr_img;bootm\0"


#define ENV_BOOT_CMD7 \
    "boot7=http_upgrade " __stringify(CONFIG_SERVERIP) ";run boot_wr_img;run boot_rd_img;bootm\0"


#define ENV_BOOT_CMD8 \
    "boot8=mmc init; fatload mmc 0:1 ${loadaddr} " __stringify(CONFIG_UPGFILE) ";run boot_wr_img; bootm\0"
#define ENV_BOOT_CMD9 \
    "boot9=mmc init; fatload mmc 0:1 ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm\0"
#define ENV_BOOT_CMD10 \
    "boot10=mmc init; run boot_normal; bootm\0"
#if defined(FW_UPGRADE_BY_USB)


#undef USB_BOOT_MENU
#define USB_BOOT_MENU \
   "bootmenu_6=7. System Load Linux Kernel then write to Flash via USB.=run boot6\0"
#define ENV_RESCUE_CMD \
    "rescue=serious_image_check; if test ${img_result} = bad; then usb start;run boot_wr_img; fi\0"


#elif defined(FW_UPGRADE_BY_SDXC)


#undef SDcard_BOOT_MENU
#define SDcard_BOOT_MENU \
   "bootmenu_6=7. System Load Linux Kernel then write to Flash via SDcard.=run boot8\0"
#define ENV_RESCUE_CMD \
    "rescue=serious_image_check; if test ${img_result} = bad; then mmc init; fatload mmc 0:1 ${loadaddr} " \
    __stringify(CONFIG_UPGFILE) ";run boot_wr_img; fi\0"

#elif defined(FW_UPGRADE_BY_WEBUI)

#undef Browser_BOOT_MENU
#define Browser_BOOT_MENU \
   "bootmenu_6=7. System Load Linux Kernel then write to Flash via Browser.=run boot7\0"
#define ENV_RESCUE_CMD \
    "rescue=serious_image_check; if test ${img_result} = bad; then http_upgrade " __stringify(CONFIG_SERVERIP) \
    ";run boot_wr_img;run boot_rd_img; fi\0"

#elif defined(DUAL_IMAGE_SUPPORT)

#define ENV_RESCUE_CMD \
    "rescue=serious_image_check; if test ${img_result} = bad; then run duimage_recovery;fi;run duimage_backup\0"
#else

#define ENV_RESCUE_CMD \
    "rescue=serious_image_check;\0"
#endif

#define ENV_BOOT_CMD \
    ENV_BOOT_WRITE_IMAGE \
    ENV_BOOT_READ_IMAGE \
    ENV_WRITE_UBOOT \
    ENV_DUIMAGE_RECOVERY \
    ENV_BOOT_READ_SEC_IMAGE \
    ENV_DUIMAGE_BACKUP \
    ENV_BOOT_WRITE_SEC_IMAGE \
    ENV_RESCUE_CMD \
    ENV_BOOT_CMD0 \
    ENV_BOOT_CMD1 \
    ENV_BOOT_CMD2 \
    ENV_BOOT_CMD3 \
    ENV_BOOT_CMD4 \
    ENV_BOOT_CMD5 \
    ENV_BOOT_CMD6 \
    ENV_BOOT_CMD7 \
    ENV_BOOT_CMD8 \
    ENV_BOOT_CMD9 \
    ENV_BOOT_CMD10 \
    USB_BOOT_MENU \
    Browser_BOOT_MENU \
    SDcard_BOOT_MENU


#define ENV_BOOT_MENU \
    "bootmenu_0=1. System Load Linux to SDRAM via TFTP.=run boot0\0" \
    "bootmenu_1=2. System Load Linux Kernel then write to Flash via TFTP.=run boot1\0" \
    "bootmenu_2=3. Boot Linux from SD.=run boot10\0" \
    "bootmenu_3=4. System Load Boot Loader then write to Flash via TFTP.=run boot3\0" \
    "bootmenu_4=5. System Load Linux Kernel then write to Flash via Serial.=run boot4\0" \
    "bootmenu_5=6. System Load Boot Loader then write to Flash via Serial.=run boot5\0" \
    "bootmenu_6=7. Boot system code via Flash.=run boot2\0" \
    "bootmenu_7=8. Boot Kernel 4.4.=run boot44\0" \
    "bootmenu_8=9. Boot Kernel 4.9.=run boot49\0" \
    "bootmenu_9=10. Boot Kernel 4.16.=run boot416\0" \
    "boot44=mmc init; fatload mmc 0:1 ${loadaddr} ${bpi}/${board}/${service}/${kernel44}; bootm\0" \
    "boot49=mmc init; fatload mmc 0:1 ${loadaddr} ${bpi}/${board}/${service}/${kernel49}; bootm\0" \
    "boot416=run newloadenv; setenv kernel ${kernel416}; printenv; run newboot\0" \
    "bpiver=1\0" \
    "bpi=bananapi\0" \
    "board=bpi-r2\0" \
    "chip=MT7623N\0" \
    "service=linux\0" \
    "scriptaddr=0x83000000\0" \
    "device=mmc\0" \
    "partition=1:1\0" \
    "kernel=uImage\0" \
    "kernel44=uImage_4.4\0" \
    "kernel49=uImage_4.9\0" \
    "kernel414=uImage_4.14\0" \
    "kernel416=uImage_4.16\0" \
    "root=/dev/mmcblk0p2\0" \
    "debug=7\0" \
    "bootenv=uEnv.txt\0" \
    "checksd=fatinfo ${device} 1:1\0" \
    "loadbootenv=fatload ${device} ${partition} ${scriptaddr} ${bpi}/${board}/${service}/${bootenv} || fatload ${device} ${partition} ${scriptaddr} ${bootenv}\0" \
    "boot_normal=if run checksd; then echo Boot from SD ; setenv partition 1:1; else echo Boot from eMMC ; mmc init 0 ; setenv partition 0:1 ; fi; if run loadbootenv; then echo Loaded environment from ${bootenv}; env import -t ${scriptaddr} ${filesize}; fi; run uenvcmd; fatload mmc 0:1 ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm\0" \
    "newloadenv=mmc init; run loadbootenv; env import -t ${scriptaddr} ${filesize};\0" \
    "newboot=fatload mmc ${partition} ${loadaddr} ${bpi}/${board}/${service}/${kernel}; bootm\0" \
    "bootmenu_delay=30\0" \
    ""

 

 

you might understand why I removed it fully... It could be fun, in case you're patient enough to test it.. I prefer bootscripts, they can be adjusted in case something goes wrong.. The bootmenu needs recompilation of u-boot... :rolleyes: The only usecase I can imagine is to load different bootscripts... :P (okay, maybe some 'fancy' stuff like boot over Ethernet, or recovery over *whatever is implemented* in u-boot might be useful)..

Link to comment
Share on other sites

2 hours ago, JNC said:

How do we start solving this?

Solved (in armbian) with armbianEnv.txt (or boot.cmd for the risky ones.. don't do it! :P)

 

IMO every board which has the SD-Card first in bootorder should'nt have a bootmenu in u-boot (you can interupt the boot by hitting every key... :P ) and if one of those 'bootscripts' has a saveenv in it.. better hope that it's a garbage variable you don't use.. :D 

Link to comment
Share on other sites

For the OP, if you can locate your kernel on the card, you can replace it with your new kernel.  Make a backup of the original kernel image so you can go back if things are ugly.

 

@chwe saveenv is a normal u-boot command, in my opinion if they manage it they're advanced enough to take responsibility for what they break.  ;-) I do it all the time.

9 hours ago, chwe said:

I prefer bootscripts, they can be adjusted in case something goes wrong..

 

I want to see if the boot menu can be implemented in the boot script, that would be key.

 

I'm currently reading through @umiddelb's "U-571" repo (excellent naming, by the way)

Link to comment
Share on other sites

IMHO there is no way to implement any kind of interaction when running a boot script. I've ended up defining a set of u-boot macros which I run on the interactive console, eg

  `run _t´ to boot a test kernel

  `run _2' to boot from the second partition of the (default) boot device

 

For the ODROID N1 we're discussing to potential use of petitboot due to the current u-boot limitations.

Link to comment
Share on other sites

Ok, it's been a week of self education. Every attempt at patching the firefly/rockchip kernel with rt preempt fails. It already has some patches in it and it is missing some  headers. My understanding is that the generic 4.4 kernel should work on the 3328, can anyone confirm this ? It took copying the 3328 deconfig to the config a file and building a new config, but it compiled and installed. Which brings me back to the boot mess.

     Aside from getting a Linux kernel building education, I spent some time in The uboot documents, and now I'm more confused then

ever.

     The sd card contains a fat32 partition and an ex4. Mounting the fat 32 ( I used my desktop with Debian) allows the root user to copy files to it, it presently has the image and .dtb file in it. The boot partition can also be seen in the Linux file manager as the boot folder. In both instances they contain the same

files. 

     If I copy the Image ( /realtime/Linux/arch/arm64/boot/) file from my newly compiles kernel into

the boot partition, both green and red leds lite up, won't boot. Delete it and reinstall original Image , board boots. So.....

     Is the kernel really in a uboot file or does uboot some how call it out of the / boot folder which happens to have the same contents as the boot partition on the sd card?  Any of this make any sense?

Link to comment
Share on other sites

1 hour ago, JNC said:

My understanding is that the generic 4.4 kernel should work on the 3328, can anyone confirm this ?

I would not think so, it didn't really make an appearance until 4.12.

 

I have not tried to apply the RT patch to the rockchip kernel.  It is highly unlikely it would work right out of the box, there's a lot of customization in there, years of patching, in fact.

Link to comment
Share on other sites

It seems as though a few folks have done it for the tinkerboard (the rt patch) which runs the rockchip kernel( as far as I know) , can anyone confirm this? 

Link to comment
Share on other sites

5 hours ago, JNC said:

It seems as though a few folks have done it for the tinkerboard (the rt patch) which runs the rockchip kernel( as far as I know)

Probably, then you should try to contact those people in case it's possible from the site where you assume that they tested it. I never saw someone playing with RT patches on the tinker here (I could have missed it due to 'not my field of interest', but I think @TonyMac32 follows tinker related stuff here serious enough so he wouldn't miss it... :P)

 

13 hours ago, JNC said:

The sd card contains a fat32 partition and an ex4. Mounting the fat 32 ( I used my desktop with Debian) allows the root user to copy files to it, it presently has the image and .dtb file in it. The boot partition can also be seen in the Linux file manager as the boot folder. In both instances they contain the same

files. 

Those FAT partitions for kernel is mostly a 'historical/RPi-Style' related way of solving it (e.g. if U-boot is not able to load from ext4, making it 'suitable' for widows users to change stuff in 'uEnv.txt'). Armbian (default) doesn't use FAT for the kernel and everything is in a single ext4 partition.

12 hours ago, TonyMac32 said:

I would not think so, it didn't really make an appearance until 4.12.

There's a guy started from a 4.4 vanilla with a huge 'packport session'...

https://tinkerboarding.co.uk/forum/archive/index.php/thread-612.html

https://github.com/arne48/armbian_build/tree/master/patch/kernel/rockchip-next

	next)
	KERNELSOURCE='https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable'
	KERNELBRANCH='tag:v4.4.79'
	KERNELDIR='linux-stable'

	KERNEL_USE_GCC='> 7.0'
	;;

Must be a patient one to pick out everything needed to get the tinker on a vanilla 4.4 working... :D He used armbians buildscript, but I don't think ever saw him presenting the work here... 

 

Edit: Maybe... this one could be of interest for armbian? 

https://github.com/arne48/armbian_build/blob/master/patch/kernel/rockchip-next/0039_clk_pll.patch

don't know, don't deal with HDMI on SBCs... But it's more or less recent and it 'looks' important.. :D 

Link to comment
Share on other sites

Quote

Those FAT partitions for kernel is mostly a 'historical/RPi-Style' related way of solving it (e.g. if U-boot is not able to load from ext4, making it 'suitable' for widows users to change stuff in 'uEnv.txt'). Armbian (default) doesn't use FAT for the kernel and everything is in a single ext4 partition.

 

    Simple question then, can a different kernel be loaded by changing the Image file in the fat32 boot partition? 

Link to comment
Share on other sites

18 minutes ago, JNC said:

Simple question then, can a different kernel be loaded by changing the Image file in the fat32 boot partition? 

when using default armbian, there should be no FAT partition.. 

 

But if the bootloader is 'in a good shape'  and I think the one we use for the RK3288 is, this shouldn't be a hard task, check armbianEnv.txt which kernel is loaded (if I'm correct https://github.com/armbian/build/blob/a50100eb1e21976af38c9a311d713660c6c07e27/config/bootscripts/boot-rockchip.cmd#L15-L17) armbian on the tinker gets the kernel-location from armbianEnv.txt, so adjusting this to the right kernel for your testing should be fine (DTB and uInitrd must also match)..  So place your custom Kernel in /boot/kernelname (same with dtb and uInitrd) and make sure that you have a UART-USB dongle to get some information what happens during boot (in case the custom kernel doesn't boot).. But I can't help you debugging a custom kernel, that's a way over my skills. I think you may then better contact the guy who baked the 4.4 RT kernel for any hints in case something doesn't work as expected.. 

Link to comment
Share on other sites

Im not using armbian, as of now there isnt a distro for the 3328 renegade. Im using the base firefly ubuntu 16.04. The Tinker board is next, just got it> They are not easy to get.....

Link to comment
Share on other sites

2 hours ago, JNC said:

Im not using armbian, as of now there isnt a distro for the 3328 renegade.

https://github.com/armbian/build/blob/master/config/boards/roc-rk3328-cc.csc

 

But I'm getting confused.. So for which one do you try do bring RT up? IMO for the Tinker it should be possible.. Doing it for a RK3328 based one.. you'll have a bunch of work to adjust rk3288 code to rk3328 code... So I would suggest you start with something which should easy to get familiar with the whole u-boot kernelboot thing.. :P as soon as you're familiar with an RT rk3288 kernel, you might start if you can reuse stuff for the 3328 and what adjustments are needed...  

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines