Mercurial > hg > aboriginal
annotate system-image.sh @ 1367:ec3435d0cbfe
Add alt-linux patch symlinks so building unstable linux snapshots is more likely to work.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 10 Jun 2011 21:07:18 -0500 |
parents | 9252453c40d0 |
children | b74d36876c0a |
rev | line source |
---|---|
177 | 1 #!/bin/bash |
109
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
1350
7eabfa815c90
Split up system-image.sh into root-image.sh, linux-kernel.sh, and system-image.sh. Rename CROSS_HOST_ARCH to CROSS_COMPILER_HOST.
Rob Landley <rob@landley.net>
parents:
1307
diff
changeset
|
3 # Combine a filesystem image and kernel with emulator launch scripts. |
109
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 |
669 | 5 source sources/include.sh || exit 1 |
109
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 |
744
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
728
diff
changeset
|
7 # Parse the sources/targets/$1 directory |
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
728
diff
changeset
|
8 |
1163
2b05860c6cf1
Update initramfs generation to deal with kernel changes, and rip out unnecessary complexity (backgrounding the kernel build, partial rebuild) that other stages don't do.
Rob Landley <rob@landley.net>
parents:
1152
diff
changeset
|
9 read_arch_dir "$1" |
744
759adf5a0fe9
Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
Rob Landley <rob@landley.net>
parents:
728
diff
changeset
|
10 |
1350
7eabfa815c90
Split up system-image.sh into root-image.sh, linux-kernel.sh, and system-image.sh. Rename CROSS_HOST_ARCH to CROSS_COMPILER_HOST.
Rob Landley <rob@landley.net>
parents:
1307
diff
changeset
|
11 cd "$BUILD/linux-kernel-$ARCH_NAME" && |
7eabfa815c90
Split up system-image.sh into root-image.sh, linux-kernel.sh, and system-image.sh. Rename CROSS_HOST_ARCH to CROSS_COMPILER_HOST.
Rob Landley <rob@landley.net>
parents:
1307
diff
changeset
|
12 KERNEL="$(ls)" && |
7eabfa815c90
Split up system-image.sh into root-image.sh, linux-kernel.sh, and system-image.sh. Rename CROSS_HOST_ARCH to CROSS_COMPILER_HOST.
Rob Landley <rob@landley.net>
parents:
1307
diff
changeset
|
13 ln "$KERNEL" "$STAGE_DIR" && |
7eabfa815c90
Split up system-image.sh into root-image.sh, linux-kernel.sh, and system-image.sh. Rename CROSS_HOST_ARCH to CROSS_COMPILER_HOST.
Rob Landley <rob@landley.net>
parents:
1307
diff
changeset
|
14 cd "$BUILD/root-image-$ARCH" && |
7eabfa815c90
Split up system-image.sh into root-image.sh, linux-kernel.sh, and system-image.sh. Rename CROSS_HOST_ARCH to CROSS_COMPILER_HOST.
Rob Landley <rob@landley.net>
parents:
1307
diff
changeset
|
15 IMAGE="$(ls)" && |
7eabfa815c90
Split up system-image.sh into root-image.sh, linux-kernel.sh, and system-image.sh. Rename CROSS_HOST_ARCH to CROSS_COMPILER_HOST.
Rob Landley <rob@landley.net>
parents:
1307
diff
changeset
|
16 ln "$IMAGE" "$STAGE_DIR" || dienow |
553
80f3356577fc
Move kernel building from mini-native to package-mini-native in preparation for initramfs packaging option.
Rob Landley <rob@landley.net>
parents:
537
diff
changeset
|
17 |
893
9ae3c9520bec
Split out kernel_cmdline from qemu-defaults.
Rob Landley <rob@landley.net>
parents:
888
diff
changeset
|
18 # Provide qemu's common command line options between architectures. |
9ae3c9520bec
Split out kernel_cmdline from qemu-defaults.
Rob Landley <rob@landley.net>
parents:
888
diff
changeset
|
19 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1074
diff
changeset
|
20 kernel_cmdline() |
893
9ae3c9520bec
Split out kernel_cmdline from qemu-defaults.
Rob Landley <rob@landley.net>
parents:
888
diff
changeset
|
21 { |
9ae3c9520bec
Split out kernel_cmdline from qemu-defaults.
Rob Landley <rob@landley.net>
parents:
888
diff
changeset
|
22 [ "$SYSIMAGE_TYPE" != "initramfs" ] && |
1163
2b05860c6cf1
Update initramfs generation to deal with kernel changes, and rip out unnecessary complexity (backgrounding the kernel build, partial rebuild) that other stages don't do.
Rob Landley <rob@landley.net>
parents:
1152
diff
changeset
|
23 echo -n "root=/dev/$ROOT rw init=/sbin/init.sh " |
893
9ae3c9520bec
Split out kernel_cmdline from qemu-defaults.
Rob Landley <rob@landley.net>
parents:
888
diff
changeset
|
24 |
1307
6ea4204209d0
Add /sbin to the $PATH in the system image. (Oops.)
Rob Landley <rob@landley.net>
parents:
1183
diff
changeset
|
25 echo -n "panic=1 PATH=\$DISTCC_PATH_PREFIX/bin:/sbin console=$CONSOLE" |
893
9ae3c9520bec
Split out kernel_cmdline from qemu-defaults.
Rob Landley <rob@landley.net>
parents:
888
diff
changeset
|
26 echo -n " HOST=$ARCH ${KERNEL_EXTRA}\$KERNEL_EXTRA" |
9ae3c9520bec
Split out kernel_cmdline from qemu-defaults.
Rob Landley <rob@landley.net>
parents:
888
diff
changeset
|
27 } |
9ae3c9520bec
Split out kernel_cmdline from qemu-defaults.
Rob Landley <rob@landley.net>
parents:
888
diff
changeset
|
28 |
1081
e992bc65b048
Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents:
1074
diff
changeset
|
29 qemu_defaults() |
325
51bcd6de223d
Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents:
317
diff
changeset
|
30 { |
1350
7eabfa815c90
Split up system-image.sh into root-image.sh, linux-kernel.sh, and system-image.sh. Rename CROSS_HOST_ARCH to CROSS_COMPILER_HOST.
Rob Landley <rob@landley.net>
parents:
1307
diff
changeset
|
31 echo -n "-nographic -no-reboot -kernel $KERNEL \$WITH_HDC \$WITH_HDB" |
7eabfa815c90
Split up system-image.sh into root-image.sh, linux-kernel.sh, and system-image.sh. Rename CROSS_HOST_ARCH to CROSS_COMPILER_HOST.
Rob Landley <rob@landley.net>
parents:
1307
diff
changeset
|
32 [ "$SYSIMAGE_TYPE" != "initramfs" ] && echo -n " -hda $IMAGE" |
893
9ae3c9520bec
Split out kernel_cmdline from qemu-defaults.
Rob Landley <rob@landley.net>
parents:
888
diff
changeset
|
33 echo -n " -append \"$(kernel_cmdline)\" \$QEMU_EXTRA" |
325
51bcd6de223d
Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents:
317
diff
changeset
|
34 } |
51bcd6de223d
Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents:
317
diff
changeset
|
35 |
490
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
36 # Write out a script to call the appropriate emulator. We split out the |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
37 # filesystem, kernel, and base kernel command line arguments in case you want |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
38 # to use an emulator other than qemu, but put the default case in qemu_defaults |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
39 |
1005
ed8e33b81032
Make run-emulator.sh executable.
Rob Landley <rob@landley.net>
parents:
1000
diff
changeset
|
40 cat > "$STAGE_DIR/run-emulator.sh" << EOF && |
1000
6a6a9e8de6ef
Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents:
999
diff
changeset
|
41 ARCH=$ARCH |
6a6a9e8de6ef
Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents:
999
diff
changeset
|
42 run_emulator() |
6a6a9e8de6ef
Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents:
999
diff
changeset
|
43 { |
6a6a9e8de6ef
Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents:
999
diff
changeset
|
44 [ ! -z "\$DEBUG" ] && set -x |
1350
7eabfa815c90
Split up system-image.sh into root-image.sh, linux-kernel.sh, and system-image.sh. Rename CROSS_HOST_ARCH to CROSS_COMPILER_HOST.
Rob Landley <rob@landley.net>
parents:
1307
diff
changeset
|
45 $(emulator_command) |
1000
6a6a9e8de6ef
Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents:
999
diff
changeset
|
46 } |
6a6a9e8de6ef
Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents:
999
diff
changeset
|
47 |
6a6a9e8de6ef
Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents:
999
diff
changeset
|
48 if [ "\$1" != "--norun" ] |
6a6a9e8de6ef
Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents:
999
diff
changeset
|
49 then |
6a6a9e8de6ef
Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents:
999
diff
changeset
|
50 run_emulator |
6a6a9e8de6ef
Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents:
999
diff
changeset
|
51 fi |
6a6a9e8de6ef
Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents:
999
diff
changeset
|
52 EOF |
1005
ed8e33b81032
Make run-emulator.sh executable.
Rob Landley <rob@landley.net>
parents:
1000
diff
changeset
|
53 chmod +x "$STAGE_DIR/run-emulator.sh" && |
864
5660a438421b
Make system-image.sh write out dev-environment.sh from a here document.
Rob Landley <rob@landley.net>
parents:
863
diff
changeset
|
54 |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
55 # Write out development wrapper scripts, substituting INCLUDE lines. |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
56 |
1169
d13ddec32cee
Only include the dev-environment.sh and native-build.sh scripts when the system image contains native development tools.
Rob Landley <rob@landley.net>
parents:
1163
diff
changeset
|
57 [ -z "$NO_NATIVE_COMPILER" ] && for FILE in dev-environment.sh native-build.sh |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
58 do |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
59 (export IFS="$(echo -e "\n")" |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
60 cat "$SOURCES/toys/$FILE" | while read -r i |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
61 do |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
62 if [ "${i:0:8}" == "INCLUDE " ] |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
63 then |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
64 cat "$SOURCES/toys/${i:8}" || dienow |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
65 else |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
66 # because echo doesn't support --, that's why. |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
67 echo "$i" || dienow |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
68 fi |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
69 done |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
70 ) > "$STAGE_DIR/$FILE" |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
71 |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
72 chmod +x "$STAGE_DIR/$FILE" || dienow |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1071
diff
changeset
|
73 done |
490
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
74 |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
75 # Tar it up. |
004f9509349b
Rip out User Mode Linux, switch to genext2fs instead. (Based on an old patch from James Davidson.)
Rob Landley <rob@landley.net>
parents:
486
diff
changeset
|
76 |
988
30e4bab11f9e
Rename SKIP_STAGE_TARBALLS to NO_STAGE_TARBALLS (for consistency), and make system-image.sh use it instead of doing it by hand.
Rob Landley <rob@landley.net>
parents:
972
diff
changeset
|
77 ARCH="$ARCH_NAME" create_stage_tarball |
267
98c1a2136322
Update package-mini-native.sh to create qemu-image-$ARCH.tar.bz2
Rob Landley <rob@landley.net>
parents:
264
diff
changeset
|
78 |
1358
9252453c40d0
Combine set_titlebar and "echo ===" stuff into announce() function. Consistently output target/stage info, and yank redundant instances.
Rob Landley <rob@landley.net>
parents:
1350
diff
changeset
|
79 announce "Packaging complete" |