[Buildroot] What's up with the kernel names? (Again)

Ulf Samuelsson ulf.samuelsson at atmel.com
Wed Feb 11 20:03:31 UTC 2009


tis 2009-02-10 klockan 16:48 -0200 skrev Thiago A. Corrêa:
> Hi,
> 
> On Tue, Feb 10, 2009 at 3:42 PM, Ulf Samuelsson
> <ulf.samuelsson at atmel.com> wrote:
> > No you have totally misunderstood.
> > U-Boot will, with my patch use an initial default, but you can
> > update the linux kernel version and then automatically generate the kernel
> > name for tftp download without recompiling u-boot.
> >
> > That is why you have the os command.
> >
> > A better implementation would automatically
> > recompute the linux kernel name when any
> > part of it is changed.
> >
> 
> But you never update kernel-date env variable. That way it can't guess
> what to concatenate in there, or it will always generate the same
> name.


The user can do thinks like:

setenv kernel-date 20090123 ; os
setenv kernel-version 2.6.28.1; os

to tell u-boot that a new version is to be used.



--------------------------

Just for fun, I checked my OpenSuSE /boot directory

Guess what I found:

"vmlinuz" which happens to be a LINK to

vmlinuz-$(KERNEL_VERSION)-$(REV)-$PROJECT)

There was also a:
vmlinux-$(KERNEL_VERSION)-$(REV)-$PROJECT).gz file

Looks like the guys doing OpenSuSE are as "odd" as I am.

Would be interesting to know how the /boot directory
in Fedora, Ubuntu etc look like.

BR
Ulf Samuelsson



> 
> One possible way could be:
> +int do_os (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> +{
> +       char kname[512];
> +       char *curname;
> +       char *kdate;
> +       int datepos;
> +       curname = getenv("linux");
> +       kdate = getenv("kernel-date");
> +       datepos = strstr(curname, kdate);
> +       if (datepos) {
> +               //Replace the hardcoded date
> +               curname[datepos] = 0;
> +               sprintf(kname, "%s%s%s", curname, date??, curname +
> datepos + strlen(kdate));
> +       } else {
> +               strcpy(kname, "uImage");
> +       }
> +       setenv("linux", kname);
> +       return 0;
> +}
> 
> This searches the kernel-date inside the name, therefore it can be
> anywhere, and updates it. But as you can see from date??? I have no
> idea where the new value comes from.
> If it comes from some script or program, it could be modified so that
> it stores the older date in kernel-olddate variable, then you searcho
> for it and replace with the new date:
> 
> +int do_os (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> +{
> +       char kname[512];
> +       char *curname;
> +       char *kdate;
> +       int datepos;
> +       curname = getenv("linux");
> +       kdate = getenv("kernel-olddate");
> +       datepos = strstr(curname, kdate);
> +       if (datepos) {
> +               //Replace the hardcoded date
> +               curname[datepos] = 0;
> +               sprintf(kname, "%s%s%s", curname,
> getenv("kernel-date"), curname + datepos + strlen(kdate));
> +       } else {
> +               strcpy(kname, "uImage");
> +       }
> +       setenv("linux", kname);
> +       return 0;
> +}
> 
> 
> Regards,
>    Thiago A. Correa
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot


More information about the buildroot mailing list