diff options
-rw-r--r-- | scripts/lib/bsp/kernel.py | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/scripts/lib/bsp/kernel.py b/scripts/lib/bsp/kernel.py index f2ec9fd64f..d2e4f403d6 100644 --- a/scripts/lib/bsp/kernel.py +++ b/scripts/lib/bsp/kernel.py | |||
@@ -295,11 +295,11 @@ def find_current_kernel(bsp_layer, machine): | |||
295 | 295 | ||
296 | def find_bsp_kernel_src_uri(scripts_path, machine, start_end_only = False): | 296 | def find_bsp_kernel_src_uri(scripts_path, machine, start_end_only = False): |
297 | """ | 297 | """ |
298 | Parse the SRC_URI append in the kernel .bbappend, returing a list | 298 | Parse the SRC_URI append in the kernel .bb or .bbappend, returing |
299 | of individual components, and the start/end positions of the | 299 | a list of individual components, and the start/end positions of |
300 | SRC_URI statement, so it can be regenerated in the same position. | 300 | the SRC_URI statement, so it can be regenerated in the same |
301 | If start_end_only is True, don't return the list of elements, only | 301 | position. If start_end_only is True, don't return the list of |
302 | the start and end positions. | 302 | elements, only the start and end positions. |
303 | 303 | ||
304 | Returns (SRC_URI start line, SRC_URI end_line, list of split | 304 | Returns (SRC_URI start line, SRC_URI end_line, list of split |
305 | SRC_URI items). | 305 | SRC_URI items). |
@@ -318,9 +318,17 @@ def find_bsp_kernel_src_uri(scripts_path, machine, start_end_only = False): | |||
318 | print "Couldn't determine the kernel for this BSP, exiting." | 318 | print "Couldn't determine the kernel for this BSP, exiting." |
319 | sys.exit(1) | 319 | sys.exit(1) |
320 | 320 | ||
321 | kernel_bbappend = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") | 321 | kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") |
322 | try: | ||
323 | f = open(kernel_bbfile, "r") | ||
324 | except IOError: | ||
325 | kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bb") | ||
326 | try: | ||
327 | f = open(kernel_bbfile, "r") | ||
328 | except IOError: | ||
329 | print "Couldn't find a .bb or .bbappend file for this BSP's kernel, exiting." | ||
330 | sys.exit(1) | ||
322 | 331 | ||
323 | f = open(kernel_bbappend, "r") | ||
324 | src_uri_line = "" | 332 | src_uri_line = "" |
325 | in_src_uri = False | 333 | in_src_uri = False |
326 | lines = f.readlines() | 334 | lines = f.readlines() |
@@ -561,12 +569,16 @@ def kernel_contents_changed(scripts_path, machine): | |||
561 | print "Couldn't determine the kernel for this BSP, exiting." | 569 | print "Couldn't determine the kernel for this BSP, exiting." |
562 | sys.exit(1) | 570 | sys.exit(1) |
563 | 571 | ||
564 | kernel_bbappend = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") | 572 | kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") |
565 | kernel_bbappend_prev = kernel_bbappend + ".prev" | 573 | if not os.path.isfile(kernel_bbfile): |
566 | shutil.copyfile(kernel_bbappend, kernel_bbappend_prev) | 574 | kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bb") |
575 | if not os.path.isfile(kernel_bbfile): | ||
576 | return | ||
577 | kernel_bbfile_prev = kernel_bbfile + ".prev" | ||
578 | shutil.copyfile(kernel_bbfile, kernel_bbfile_prev) | ||
567 | 579 | ||
568 | ifile = open(kernel_bbappend_prev, "r") | 580 | ifile = open(kernel_bbfile_prev, "r") |
569 | ofile = open(kernel_bbappend, "w") | 581 | ofile = open(kernel_bbfile, "w") |
570 | ifile_lines = ifile.readlines() | 582 | ifile_lines = ifile.readlines() |
571 | for ifile_line in ifile_lines: | 583 | for ifile_line in ifile_lines: |
572 | if ifile_line.strip().startswith("PR"): | 584 | if ifile_line.strip().startswith("PR"): |
@@ -588,14 +600,19 @@ def write_kernel_src_uri(scripts_path, machine, src_uri): | |||
588 | print "Couldn't determine the kernel for this BSP, exiting." | 600 | print "Couldn't determine the kernel for this BSP, exiting." |
589 | sys.exit(1) | 601 | sys.exit(1) |
590 | 602 | ||
591 | kernel_bbappend = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") | 603 | kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") |
604 | if not os.path.isfile(kernel_bbfile): | ||
605 | kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bb") | ||
606 | if not os.path.isfile(kernel_bbfile): | ||
607 | print "Couldn't find a .bb or .bbappend file for this BSP's kernel, exiting." | ||
608 | sys.exit(1) | ||
592 | 609 | ||
593 | (uri_start_line, uri_end_line, unused) = find_bsp_kernel_src_uri(scripts_path, machine, True) | 610 | (uri_start_line, uri_end_line, unused) = find_bsp_kernel_src_uri(scripts_path, machine, True) |
594 | 611 | ||
595 | kernel_bbappend_prev = kernel_bbappend + ".prev" | 612 | kernel_bbfile_prev = kernel_bbfile + ".prev" |
596 | shutil.copyfile(kernel_bbappend, kernel_bbappend_prev) | 613 | shutil.copyfile(kernel_bbfile, kernel_bbfile_prev) |
597 | ifile = open(kernel_bbappend_prev, "r") | 614 | ifile = open(kernel_bbfile_prev, "r") |
598 | ofile = open(kernel_bbappend, "w") | 615 | ofile = open(kernel_bbfile, "w") |
599 | 616 | ||
600 | ifile_lines = ifile.readlines() | 617 | ifile_lines = ifile.readlines() |
601 | if uri_start_line == -1: | 618 | if uri_start_line == -1: |