Merge lp:~ogra/goget-ubuntu-touch/dragonboard into lp:goget-ubuntu-touch

Proposed by Oliver Grawert on 2015-12-11
Status: Merged
Merged at revision: 221
Proposed branch: lp:~ogra/goget-ubuntu-touch/dragonboard
Merge into: lp:goget-ubuntu-touch
Diff against target: 210 lines (+74/-5)
6 files modified
diskimage/bootloader.go (+42/-0)
diskimage/common.go (+13/-0)
diskimage/core_grub.go (+2/-1)
diskimage/core_uboot.go (+7/-2)
ubuntu-device-flash/channel_maps.go (+4/-0)
ubuntu-device-flash/snappy.go (+6/-2)
To merge this branch: bzr merge lp:~ogra/goget-ubuntu-touch/dragonboard
Reviewer Review Type Date Requested Status
Michael Vogt 2015-12-11 Approve on 2016-01-19
Ricardo Mendoza 2015-12-11 Pending
Review via email: mp+280320@code.launchpad.net

Commit Message

- adds general amd64 channel support
- adds support for "raw-partitions" to boot-assets of the oem snap so you can have android style "non-filesystem" boot partitions (see http://paste.ubuntu.com/13933298/ for the dragonboard package.yaml)
- set the default partition table for arm64 u-boot to GPT

Description of the Change

- adds general amd64 channel support
- adds support for "raw-partitions" to boot-assets of the oem snap so you can have android style "non-filesystem" boot partitions (see http://paste.ubuntu.com/13933298/ for the dragonboard package.yaml)
- set the default partition table for arm64 u-boot to GPT

To post a comment you must log in.
Oliver Grawert (ogra) wrote :

a binary ubuntu-device-flash_0.33-0ubuntu1_amd64.deb can be found at:
http://people.canonical.com/~ogra/snappy/ubuntu-device-flash_0.33-0ubuntu1_amd64.deb

an oem snap (with still a few issues regarding uboot.env) is at:
http://people.canonical.com/~ogra/snappy/dragonboard_0.1_all.snap

and there is a device tarball (sadly missing apparmor, since it is a linaro kernel, so snappy install wont work):
http://people.canonical.com/~ogra/snappy/device-dragonboard-0.1.tar.xz

to build an image do:
sudo ubuntu-device-flash -v core rolling --channel=edge --developer-mode --oem=dragonboard_0.1_all.snap --device-part=device-dragonboard-0.1.tar.xz -o dragonboard-sd.img

222. By Oliver Grawert on 2015-12-12

slightly clean up error reporting

Michael Vogt (mvo) wrote :

Thanks for this branch! This looks fine. I did some minor tweaks (really minor) at lp:~mvo/goget-ubuntu-touch/dragonboard that we should also merge.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'diskimage/bootloader.go'
2--- diskimage/bootloader.go 2015-10-26 18:30:45 +0000
3+++ diskimage/bootloader.go 2015-12-12 01:20:39 +0000
4@@ -22,8 +22,10 @@
5 import (
6 "io"
7 "os"
8+ "os/exec"
9 "path/filepath"
10 "strconv"
11+ "fmt"
12
13 "launchpad.net/goget-ubuntu-touch/sysutils"
14 )
15@@ -83,6 +85,46 @@
16 return nil
17 }
18
19+func setupBootAssetRawPartitions(imagePath string, partCount int, rawPartitions []BootAssetRawPartitions) error {
20+ printOut("Setting up raw boot asset partitions for", imagePath, "...")
21+ var part int = partCount
22+
23+ for _, asset := range rawPartitions{
24+ part += 1
25+
26+ size, err := strconv.Atoi(asset.Size)
27+ if err != nil {
28+ return err
29+ }
30+ size = size * 2
31+
32+ printOut("creating partition:", asset.Name)
33+
34+ opts := fmt.Sprintf("0:0:+%d", size)
35+ if err := exec.Command("sgdisk", "-a", "1", "-n", opts, imagePath).Run(); err != nil {
36+ return err
37+ }
38+
39+ opts = fmt.Sprintf("%d:%s", part, asset.Name)
40+ if err := exec.Command("sgdisk", "-c", opts, imagePath).Run(); err != nil {
41+ return err
42+ }
43+
44+ opts = fmt.Sprintf("%d:%s", part, asset.Type)
45+ if err := exec.Command("sgdisk", "-t", opts, imagePath).Run(); err != nil {
46+ return err
47+ }
48+
49+ }
50+
51+ printOut("sorting partitions")
52+ if err := exec.Command("sgdisk", "-s", imagePath).Run(); err != nil {
53+ return err
54+ }
55+
56+ return nil
57+}
58+
59 func offsetBytes(offset string) (int64, error) {
60 // TODO add support for units
61 return strconv.ParseInt(offset, 10, 64)
62
63=== modified file 'diskimage/common.go'
64--- diskimage/common.go 2015-10-26 18:30:45 +0000
65+++ diskimage/common.go 2015-12-12 01:20:39 +0000
66@@ -87,6 +87,12 @@
67 Offset string `yaml:"offset"`
68 }
69
70+type BootAssetRawPartitions struct {
71+ Name string `yaml:"name"`
72+ Size string `yaml:"size"`
73+ Type string `yaml:"type"`
74+}
75+
76 type BootAssetFiles struct {
77 Path string `yaml:"path"`
78 // Target is the deprecated target relative to $bootloader dir
79@@ -98,6 +104,7 @@
80 type BootAssets struct {
81 Files []BootAssetFiles `yaml:"files,omitempty"`
82 RawFiles []BootAssetRawFiles `yaml:"raw-files,omitempty"`
83+ RawPartitions []BootAssetRawPartitions `yaml:"raw-partitions,omitempty"`
84 }
85
86 type OemDescription struct {
87@@ -201,6 +208,7 @@
88 partCount int
89 size int64
90 rootSize int
91+ label string
92 }
93
94 // Mount mounts the image. This also maps the loop device.
95@@ -501,6 +509,11 @@
96 }
97
98 if bootAssets := img.oem.OEM.Hardware.BootAssets; bootAssets != nil {
99+ if bootAssets.RawPartitions != nil {
100+ if err := setupBootAssetRawPartitions(img.location, img.partCount, bootAssets.RawPartitions); err != nil {
101+ return err
102+ }
103+ }
104 return setupBootAssetRawFiles(img.location, oemRoot, bootAssets.RawFiles)
105 }
106
107
108=== modified file 'diskimage/core_grub.go'
109--- diskimage/core_grub.go 2015-09-25 10:12:33 +0000
110+++ diskimage/core_grub.go 2015-12-12 01:20:39 +0000
111@@ -37,7 +37,7 @@
112 legacyGrub bool
113 }
114
115-func NewCoreGrubImage(location string, size int64, rootSize int, hw HardwareDescription, oem OemDescription, updateGrub bool) *CoreGrubImage {
116+func NewCoreGrubImage(location string, size int64, rootSize int, hw HardwareDescription, oem OemDescription, updateGrub bool, label string) *CoreGrubImage {
117 return &CoreGrubImage{
118 BaseImage: BaseImage{
119 location: location,
120@@ -46,6 +46,7 @@
121 hardware: hw,
122 oem: oem,
123 partCount: 5,
124+ label: label,
125 },
126 legacyGrub: updateGrub,
127 }
128
129=== modified file 'diskimage/core_uboot.go'
130--- diskimage/core_uboot.go 2015-09-25 10:12:19 +0000
131+++ diskimage/core_uboot.go 2015-12-12 01:20:39 +0000
132@@ -66,7 +66,7 @@
133 Bootloader []string `yaml:"bootloader"`
134 }
135
136-func NewCoreUBootImage(location string, size int64, rootSize int, hw HardwareDescription, oem OemDescription) *CoreUBootImage {
137+func NewCoreUBootImage(location string, size int64, rootSize int, hw HardwareDescription, oem OemDescription, label string) *CoreUBootImage {
138 return &CoreUBootImage{
139 BaseImage{
140 hardware: hw,
141@@ -75,6 +75,7 @@
142 size: size,
143 rootSize: rootSize,
144 partCount: 4,
145+ label: label,
146 },
147 }
148 }
149@@ -84,8 +85,12 @@
150 if err := sysutils.CreateEmptyFile(img.location, img.size, sysutils.GB); err != nil {
151 return err
152 }
153+ table := mkLabelMsdos
154
155- parted, err := newParted(mkLabelMsdos)
156+ if img.label == "gpt" {
157+ table = mkLabelGpt
158+ }
159+ parted, err := newParted(table)
160 if err != nil {
161 return err
162 }
163
164=== modified file 'ubuntu-device-flash/channel_maps.go'
165--- ubuntu-device-flash/channel_maps.go 2015-04-19 02:53:21 +0000
166+++ ubuntu-device-flash/channel_maps.go 2015-12-12 01:20:39 +0000
167@@ -28,12 +28,14 @@
168
169 const (
170 archArmhf = "armhf"
171+ archArm64 = "arm64"
172 archAmd64 = "amd64"
173 archi386 = "i386"
174 )
175
176 const (
177 deviceArmhf = "generic_armhf"
178+ deviceArm64 = "generic_arm64"
179 deviceAmd64 = "generic_amd64"
180 devicei386 = "generic_i386"
181 )
182@@ -42,6 +44,8 @@
183 switch arch {
184 case archArmhf:
185 return deviceArmhf
186+ case archArm64:
187+ return deviceArm64
188 case archAmd64:
189 return deviceAmd64
190 case archi386:
191
192=== modified file 'ubuntu-device-flash/snappy.go'
193--- ubuntu-device-flash/snappy.go 2015-11-12 16:48:10 +0000
194+++ ubuntu-device-flash/snappy.go 2015-12-12 01:20:39 +0000
195@@ -523,9 +523,13 @@
196 printOut("Using legacy setup")
197 }
198
199- s.img = diskimage.NewCoreGrubImage(s.Output, s.size, s.flavor.rootSize(), s.hardware, s.oem, legacy)
200+ s.img = diskimage.NewCoreGrubImage(s.Output, s.size, s.flavor.rootSize(), s.hardware, s.oem, legacy, "gpt")
201 case "u-boot":
202- s.img = diskimage.NewCoreUBootImage(s.Output, s.size, s.flavor.rootSize(), s.hardware, s.oem)
203+ label := "msdos"
204+ if s.oem.Architecture() == archArm64 {
205+ label = "gpt"
206+ }
207+ s.img = diskimage.NewCoreUBootImage(s.Output, s.size, s.flavor.rootSize(), s.hardware, s.oem, label)
208 default:
209 return errors.New("no hardware description in OEM snap")
210 }

Subscribers

People subscribed via source and target branches