Merge lp:~berolinux/linaro-image-tools/android-iMX53 into lp:linaro-image-tools/11.11

Proposed by Bernhard Rosenkraenzer
Status: Merged
Approved by: James Westby
Approved revision: 388
Merge reported by: James Westby
Merged at revision: not available
Proposed branch: lp:~berolinux/linaro-image-tools/android-iMX53
Merge into: lp:linaro-image-tools/11.11
Diff against target: 102 lines (+30/-12)
3 files modified
linaro-android-media-create (+1/-0)
linaro_image_tools/media_create/android_boards.py (+21/-10)
linaro_image_tools/media_create/partitions.py (+8/-2)
To merge this branch: bzr merge lp:~berolinux/linaro-image-tools/android-iMX53
Reviewer Review Type Date Requested Status
James Westby (community) Approve
Review via email: mp+69018@code.launchpad.net

Description of the change

Better support for Android on iMX53 -- the boot loader needs its own place at 0x400, and should be installed there.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) :
review: Approve
Revision history for this message
James Westby (james-w) wrote :

I'll merge this, but I'll have to rebase on top of trunk to avoid the l-a-m-c fix change.

Thanks,

James

Revision history for this message
Guilherme Salgado (salgado) wrote :
Download full text (4.9 KiB)

Hi Bernhard,

I have a few questions about your changes below.

On Mon, 2011-07-25 at 00:21 +0000, Bernhard Rosenkraenzer wrote:
> Bernhard Rosenkraenzer has proposed merging lp:~berolinux/linaro-image-tools/android-iMX53 into lp:linaro-image-tools.
>
> Requested reviews:
> linaro-image-tools maintainers (linaro-image-tools)
>
> For more details, see:
> https://code.launchpad.net/~berolinux/linaro-image-tools/android-iMX53/+merge/69018
>
> Better support for Android on iMX53 -- the boot loader needs its own place at 0x400, and should be installed there.

> === modified file 'linaro_image_tools/media_create/android_boards.py'
> --- linaro_image_tools/media_create/android_boards.py 2011-07-18 18:25:30 +0000
> +++ linaro_image_tools/media_create/android_boards.py 2011-07-25 00:21:08 +0000
> @@ -34,7 +34,8 @@
> from linaro_image_tools.media_create.boards import (
> align_up,
> align_partition,
> - make_boot_script
> + make_boot_script,
> + install_mx5_boot_loader,
> )
>
> from linaro_image_tools import cmd_runner
> @@ -77,10 +78,6 @@
>
> @classmethod
> def populate_boot_script(cls, boot_partition, boot_disk, consoles):
> - cmd_runner.run(['mkdir', '-p', boot_disk]).wait()
> - cmd_runner.run(['mount', boot_partition, boot_disk],
> - as_root=True).wait()
> -
> boot_env = cls._get_boot_env(consoles)
> cmdline_filepath = os.path.join(boot_disk, "cmdline")
> cmdline_file = open(cmdline_filepath, 'r')
> @@ -94,10 +91,6 @@
> make_boot_script(boot_env, boot_script_path)
>
> cmd_runner.run(['sync']).wait()
> - try:
> - cmd_runner.run(['umount', boot_disk], as_root=True).wait()
> - except cmd_runner.SubcommandNonZeroReturnValue:
> - pass

This change is no longer necessary and will actually break l-a-m-c as of
r388. You might want to use the new partition_mounted() context manager
here although that can be done later.

>
> @classmethod
> def get_sfdisk_cmd(cls, should_align_boot_part=False,
> @@ -158,6 +151,9 @@
> def populate_raw_partition(cls, media, boot_dir):
> super(AndroidBoardConfig, cls).populate_raw_partition(boot_dir, media)
>
> + @classmethod
> + def install_boot_loader(cls, boot_partition, boot_device_or_file):
> + pass

Do we need a new classmethod for this? ISTM that
populate_raw_partition(), which is already called in l-a-m-c, should be
the one used to populate a raw partition with the board-specific
bootloader instead, no?

>
> class AndroidOmapConfig(AndroidBoardConfig):
> pass
> @@ -217,7 +213,22 @@
> Mx53LoCoConfig.serial_tty)
> android_specific_args = 'init=/init androidboot.console=%s' % (
> Mx53LoCoConfig.serial_tty)
> - mmc_part_offset = 0
> +
> + @classmethod
> + def get_sfdisk_cmd(cls, should_align_boot_part=False):
> + loader_start, loader_end, loader_len = align_partition(
> + 1, cls.LOADER_MIN_SIZE_S, 1, PART_ALIGN_S)
> +
> + command = super(AndroidMx53LoCoConfig, cls).get_sfdisk_cmd(
> + should_align_boot_part=True, start_addr=loader_end,
> + extra_pa...

Read more...

Revision history for this message
James Westby (james-w) wrote :

On Tue, 26 Jul 2011 15:22:38 -0000, Guilherme Salgado <email address hidden> wrote:
> > - try:
> > - cmd_runner.run(['umount', boot_disk], as_root=True).wait()
> > - except cmd_runner.SubcommandNonZeroReturnValue:
> > - pass
>
> This change is no longer necessary and will actually break l-a-m-c as of
> r388. You might want to use the new partition_mounted() context manager
> here although that can be done later.

This was because the branch was based on his fix for that problem, and
it wasn't set as a prerequisite.

I think that we should get answers for the other questions and decide:

  1) Is what I merged unsuitable for this release?
  2) Should anything be changed for next release to have a better
  codebase?

Thanks,

James

Revision history for this message
Bernhard Rosenkraenzer (berolinux) wrote :

Hi, here's the answers to your questions:

>> @@ -77,10 +78,6 @@
>>
>>      @classmethod
>>      def populate_boot_script(cls, boot_partition, boot_disk, consoles):
>> -        cmd_runner.run(['mkdir', '-p', boot_disk]).wait()
>> -        cmd_runner.run(['mount', boot_partition, boot_disk],
>> -            as_root=True).wait()
>> -
>>          boot_env = cls._get_boot_env(consoles)
>>          cmdline_filepath = os.path.join(boot_disk, "cmdline")
>>          cmdline_file = open(cmdline_filepath, 'r')
>> @@ -94,10 +91,6 @@
>>          make_boot_script(boot_env, boot_script_path)
>>
>>          cmd_runner.run(['sync']).wait()
>> -        try:
>> -            cmd_runner.run(['umount', boot_disk], as_root=True).wait()
>> -        except cmd_runner.SubcommandNonZeroReturnValue:
>> -            pass
>
> This change is no longer necessary and will actually break l-a-m-c as of
> r388. You might want to use the new partition_mounted() context manager
> here although that can be done later.

Yes, it was necessary in Saturday's build because the other changes
broke l-a-m-c completely. Probably obsoleted by the rebase, will check
if it's still needed w/ current trunk

>>      @classmethod
>>      def get_sfdisk_cmd(cls, should_align_boot_part=False,
>> @@ -158,6 +151,9 @@
>>      def populate_raw_partition(cls, media, boot_dir):
>>          super(AndroidBoardConfig, cls).populate_raw_partition(boot_dir, media)
>>
>> +    @classmethod
>> +    def install_boot_loader(cls, boot_partition, boot_device_or_file):
>> +        pass
>
> Do we need a new classmethod for this?  ISTM that
> populate_raw_partition(), which is already called in l-a-m-c, should be
> the one used to populate a raw partition with the board-specific
> bootloader instead, no?

Probably populate_raw_partition can be adapted to do the right thing instead.

>> --- linaro_image_tools/media_create/partitions.py     2011-06-29 09:16:39 +0000
>> +++ linaro_image_tools/media_create/partitions.py     2011-07-25 00:21:08 +0000
>> @@ -337,8 +337,14 @@
>>          media.path, 1 + board_config.mmc_part_offset)
>>      system_partition = _get_device_file_for_partition_number(
>>          media.path, 2 + board_config.mmc_part_offset)
>> -    cache_partition = _get_device_file_for_partition_number(
>> -        media.path, 3 + board_config.mmc_part_offset)
>> +    if board_config.mmc_part_offset != 1:
>> +        cache_partition = _get_device_file_for_partition_number(
>> +            media.path, 3 + board_config.mmc_part_offset)
>> +    else:
>> +        # In the current setup, partition 4 is always the
>> +        # extended partition container, so we need to skip 4
>> +        cache_partition = _get_device_file_for_partition_number(
>> +            media.path, 5)
>
> I'm slightly confused by this change as the mmc_part_offset of
> Mx53LoCoConfig is still 0, so it won't use the new code (in the else
> block). Maybe this is not related to the rest of the changes in this
> branch?

Actually it is related to the rest of the changes and is vital to avoid a crash.
The patch removes the mmc_part_offset=0 line, and mmc_part_offset is
set to 1 in Mx5Config (and in turn Mx53Config and Mx53LoCoConfig).

Revision history for this message
Guilherme Salgado (salgado) wrote :

On Tue, 2011-07-26 at 19:24 +0000, Bernhard Rosenkraenzer wrote:
[...]
> >> @@ -158,6 +151,9 @@
> >> def populate_raw_partition(cls, media, boot_dir):
> >> super(AndroidBoardConfig, cls).populate_raw_partition(boot_dir, media)
> >>
> >> + @classmethod
> >> + def install_boot_loader(cls, boot_partition, boot_device_or_file):
> >> + pass
> >
> > Do we need a new classmethod for this? ISTM that
> > populate_raw_partition(), which is already called in l-a-m-c, should be
> > the one used to populate a raw partition with the board-specific
> > bootloader instead, no?
>
> Probably populate_raw_partition can be adapted to do the right thing instead.

Cool, would you give that a try?

>
> >> --- linaro_image_tools/media_create/partitions.py 2011-06-29 09:16:39 +0000
> >> +++ linaro_image_tools/media_create/partitions.py 2011-07-25 00:21:08 +0000
> >> @@ -337,8 +337,14 @@
> >> media.path, 1 + board_config.mmc_part_offset)
> >> system_partition = _get_device_file_for_partition_number(
> >> media.path, 2 + board_config.mmc_part_offset)
> >> - cache_partition = _get_device_file_for_partition_number(
> >> - media.path, 3 + board_config.mmc_part_offset)
> >> + if board_config.mmc_part_offset != 1:
> >> + cache_partition = _get_device_file_for_partition_number(
> >> + media.path, 3 + board_config.mmc_part_offset)
> >> + else:
> >> + # In the current setup, partition 4 is always the
> >> + # extended partition container, so we need to skip 4
> >> + cache_partition = _get_device_file_for_partition_number(
> >> + media.path, 5)
> >
> > I'm slightly confused by this change as the mmc_part_offset of
> > Mx53LoCoConfig is still 0, so it won't use the new code (in the else
> > block). Maybe this is not related to the rest of the changes in this
> > branch?
>
> Actually it is related to the rest of the changes and is vital to avoid a crash.
> The patch removes the mmc_part_offset=0 line, and mmc_part_offset is
> set to 1 in Mx5Config (and in turn Mx53Config and Mx53LoCoConfig).

Oh, right, I didn't notice that Mx5Config sets mmc_part_offset to 1 so I
thought it'd have the default value from BoardConfig (which is 0) here.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'linaro-android-media-create'
2--- linaro-android-media-create 2011-06-30 12:09:46 +0000
3+++ linaro-android-media-create 2011-07-25 00:21:08 +0000
4@@ -142,6 +142,7 @@
5 board_config.populate_raw_partition(args.device, BOOT_DIR)
6 populate_partition(BOOT_DIR + "/boot", BOOT_DISK, boot_partition)
7 board_config.populate_boot_script(boot_partition, BOOT_DISK, args.consoles)
8+ board_config.install_boot_loader(args.device, BOOT_DISK)
9 populate_partition(SYSTEM_DIR + "/system", SYSTEM_DISK, system_partition)
10 populate_partition(DATA_DIR + "/data", DATA_DISK, data_partition)
11 print "Done creating Linaro Android image on %s" % args.device
12
13=== modified file 'linaro_image_tools/media_create/android_boards.py'
14--- linaro_image_tools/media_create/android_boards.py 2011-07-18 18:25:30 +0000
15+++ linaro_image_tools/media_create/android_boards.py 2011-07-25 00:21:08 +0000
16@@ -34,7 +34,8 @@
17 from linaro_image_tools.media_create.boards import (
18 align_up,
19 align_partition,
20- make_boot_script
21+ make_boot_script,
22+ install_mx5_boot_loader,
23 )
24
25 from linaro_image_tools import cmd_runner
26@@ -77,10 +78,6 @@
27
28 @classmethod
29 def populate_boot_script(cls, boot_partition, boot_disk, consoles):
30- cmd_runner.run(['mkdir', '-p', boot_disk]).wait()
31- cmd_runner.run(['mount', boot_partition, boot_disk],
32- as_root=True).wait()
33-
34 boot_env = cls._get_boot_env(consoles)
35 cmdline_filepath = os.path.join(boot_disk, "cmdline")
36 cmdline_file = open(cmdline_filepath, 'r')
37@@ -94,10 +91,6 @@
38 make_boot_script(boot_env, boot_script_path)
39
40 cmd_runner.run(['sync']).wait()
41- try:
42- cmd_runner.run(['umount', boot_disk], as_root=True).wait()
43- except cmd_runner.SubcommandNonZeroReturnValue:
44- pass
45
46 @classmethod
47 def get_sfdisk_cmd(cls, should_align_boot_part=False,
48@@ -158,6 +151,9 @@
49 def populate_raw_partition(cls, media, boot_dir):
50 super(AndroidBoardConfig, cls).populate_raw_partition(boot_dir, media)
51
52+ @classmethod
53+ def install_boot_loader(cls, boot_partition, boot_device_or_file):
54+ pass
55
56 class AndroidOmapConfig(AndroidBoardConfig):
57 pass
58@@ -217,7 +213,22 @@
59 Mx53LoCoConfig.serial_tty)
60 android_specific_args = 'init=/init androidboot.console=%s' % (
61 Mx53LoCoConfig.serial_tty)
62- mmc_part_offset = 0
63+
64+ @classmethod
65+ def get_sfdisk_cmd(cls, should_align_boot_part=False):
66+ loader_start, loader_end, loader_len = align_partition(
67+ 1, cls.LOADER_MIN_SIZE_S, 1, PART_ALIGN_S)
68+
69+ command = super(AndroidMx53LoCoConfig, cls).get_sfdisk_cmd(
70+ should_align_boot_part=True, start_addr=loader_end,
71+ extra_part=True)
72+
73+ return '%s,%s,0xDA\n%s' % (
74+ loader_start, loader_len, command)
75+
76+ @classmethod
77+ def install_boot_loader(cls, boot_partition, boot_device_or_file):
78+ install_mx5_boot_loader(os.path.join(boot_device_or_file, "u-boot.bin"), boot_partition, cls.LOADER_MIN_SIZE_S)
79
80 android_board_configs = {
81 'beagle': AndroidBeagleConfig,
82
83=== modified file 'linaro_image_tools/media_create/partitions.py'
84--- linaro_image_tools/media_create/partitions.py 2011-06-29 09:16:39 +0000
85+++ linaro_image_tools/media_create/partitions.py 2011-07-25 00:21:08 +0000
86@@ -337,8 +337,14 @@
87 media.path, 1 + board_config.mmc_part_offset)
88 system_partition = _get_device_file_for_partition_number(
89 media.path, 2 + board_config.mmc_part_offset)
90- cache_partition = _get_device_file_for_partition_number(
91- media.path, 3 + board_config.mmc_part_offset)
92+ if board_config.mmc_part_offset != 1:
93+ cache_partition = _get_device_file_for_partition_number(
94+ media.path, 3 + board_config.mmc_part_offset)
95+ else:
96+ # In the current setup, partition 4 is always the
97+ # extended partition container, so we need to skip 4
98+ cache_partition = _get_device_file_for_partition_number(
99+ media.path, 5)
100 data_partition = _get_device_file_for_partition_number(
101 media.path, 5 + board_config.mmc_part_offset)
102 sdcard_partition = _get_device_file_for_partition_number(

Subscribers

People subscribed via source and target branches