[Buildroot] What's up with the kernel names? (Again)
Thiago A. Corrêa
thiago.correa at gmail.com
Tue Feb 10 18:48:56 UTC 2009
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.
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
More information about the buildroot
mailing list