annotate system-image.sh @ 1839:c8293b3ab81f draft default tip

Teach chroot-splice to accept one or two arguments. (Control image now optional.)
author Rob Landley <rob@landley.net>
date Sun, 17 Jan 2016 21:18:52 -0600
parents c7b90f8d1b80
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
177
6b4844b708b9 dash->bash.
Rob Landley <rob@landley.net>
parents: 162
diff changeset
1 #!/bin/bash
109
d9dae1196ea7 Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
1817
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
3 # Combine filesystem images, kernel, and emulator launch scripts
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
4 # into something you can boot and run.
1728
b89324905ca2 Giant redo to put simple-root-filesystem in initmpfs.
Rob Landley <rob@landley.net>
parents: 1538
diff changeset
5
669
1cf41855bb85 More error checking.
Rob Landley <rob@landley.net>
parents: 664
diff changeset
6 source sources/include.sh || exit 1
109
d9dae1196ea7 Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff changeset
7
1817
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
8 # We do our own dependency checking (like host-tool.sh) so don't delete stage
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
9 # dir when parsing sources/targets/$1
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
10
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
11 KEEP_STAGEDIR=1 load_target "$1"
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
12
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
13 # Is $1 newer than cross compiler and all listed prerequisites ($2...)?
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
14
1817
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
15 is_newer()
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
16 {
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
17 X="$1"
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
18 shift
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
19 [ ! -e "$X" ] && return 0
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
20 [ "$(which "${CC_PREFIX}cc")" -nt "$X" ] && return 0
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
21 while [ ! -z "$1" ]
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
22 do
1818
78bdf7e5f5b3 Fix new dependency logic (checking wrong directory, permissions wrong on file).
Rob Landley <rob@landley.net>
parents: 1817
diff changeset
23 [ ! -z "$(find "$1" -newer "$X" 2>/dev/null)" ] && return 0
1817
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
24 shift
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
25 done
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
26
1818
78bdf7e5f5b3 Fix new dependency logic (checking wrong directory, permissions wrong on file).
Rob Landley <rob@landley.net>
parents: 1817
diff changeset
27 echo "Keeping $(basename "$X")"
1817
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
28 return 1
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
29 }
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
30
893
9ae3c9520bec Split out kernel_cmdline from qemu-defaults.
Rob Landley <rob@landley.net>
parents: 888
diff changeset
31 # 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
32
1081
e992bc65b048 Remove unnecessary "function" label from shell functions.
Rob Landley <rob@landley.net>
parents: 1074
diff changeset
33 qemu_defaults()
325
51bcd6de223d Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents: 317
diff changeset
34 {
1728
b89324905ca2 Giant redo to put simple-root-filesystem in initmpfs.
Rob Landley <rob@landley.net>
parents: 1538
diff changeset
35 echo -n "-nographic -no-reboot -kernel linux"
b89324905ca2 Giant redo to put simple-root-filesystem in initmpfs.
Rob Landley <rob@landley.net>
parents: 1538
diff changeset
36 [ "$SYSIMAGE_TYPE" != "rootfs" ] && echo -n " -initrd rootfs.cpio.gz"
1735
34f7ca02767c Fix distccd launch.
Rob Landley <rob@landley.net>
parents: 1730
diff changeset
37 echo -n " -append \"panic=1 console=$CONSOLE HOST=$ARCH \$KERNEL_EXTRA\""
1728
b89324905ca2 Giant redo to put simple-root-filesystem in initmpfs.
Rob Landley <rob@landley.net>
parents: 1538
diff changeset
38 echo -n " \$QEMU_EXTRA"
325
51bcd6de223d Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents: 317
diff changeset
39 }
51bcd6de223d Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents: 317
diff changeset
40
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
41 # 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
42 # 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
43 # 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
44
1005
ed8e33b81032 Make run-emulator.sh executable.
Rob Landley <rob@landley.net>
parents: 1000
diff changeset
45 cat > "$STAGE_DIR/run-emulator.sh" << EOF &&
1538
29109240fd6d Comment tweaks, and make run-emulator.sh use bash.
Rob Landley <rob@landley.net>
parents: 1437
diff changeset
46 #!/bin/bash
29109240fd6d Comment tweaks, and make run-emulator.sh use bash.
Rob Landley <rob@landley.net>
parents: 1437
diff changeset
47
29109240fd6d Comment tweaks, and make run-emulator.sh use bash.
Rob Landley <rob@landley.net>
parents: 1437
diff changeset
48 # Boot the emulated system to a shell prompt.
29109240fd6d Comment tweaks, and make run-emulator.sh use bash.
Rob Landley <rob@landley.net>
parents: 1437
diff changeset
49
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
50 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
51 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
52 {
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
53 [ ! -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
54 $(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
55 }
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
56
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
57 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
58 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
59 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
60 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
61 EOF
1005
ed8e33b81032 Make run-emulator.sh executable.
Rob Landley <rob@landley.net>
parents: 1000
diff changeset
62 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
63
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
64 # 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
65
1728
b89324905ca2 Giant redo to put simple-root-filesystem in initmpfs.
Rob Landley <rob@landley.net>
parents: 1538
diff changeset
66 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
67 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
68 (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
69 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
70 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
71 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
72 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
73 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
74 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
75 # 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
76 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
77 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
78 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
79 ) > "$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
80
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
81 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
82 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
83
1730
7f1b9fb1099e Move simple-root-filesystem.sh to root-filesystem.sh
Rob Landley <rob@landley.net>
parents: 1728
diff changeset
84 # Package root-filesystem into cpio file for initramfs
1728
b89324905ca2 Giant redo to put simple-root-filesystem in initmpfs.
Rob Landley <rob@landley.net>
parents: 1538
diff changeset
85
1817
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
86 if is_newer "$STAGE_DIR/rootfs.cpio.gz" "$BUILD/root-filesystem-$ARCH"
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
87 then
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
88 SYSIMAGE_TYPE=cpio image_filesystem "$BUILD/root-filesystem-$ARCH" \
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
89 "$STAGE_DIR/temp" &&
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
90 mv -f "$STAGE_DIR"/{temp,rootfs}.cpio.gz || dienow
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
91 [ "$SYSIMAGE_TYPE" == rootfs ] && rm -f "$STAGE_DIR/linux"
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
92 fi
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
93
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
94 # Package native-compiler into squashfs for /dev/hda mount
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
95
1824
893e70efe047 Don't try to repackage toolchain.sqf if root-filesystem-$ARCH doesn't exist.
Rob Landley <rob@landley.net>
parents: 1818
diff changeset
96 if [ -e "$BUILD/native-compiler-$ARCH" ] &&
893e70efe047 Don't try to repackage toolchain.sqf if root-filesystem-$ARCH doesn't exist.
Rob Landley <rob@landley.net>
parents: 1818
diff changeset
97 is_newer "$STAGE_DIR/toolchain.sqf" "$BUILD/native-compiler-$ARCH"
1785
74d6173e3390 Shouldn't need to build native-compiler to package system-image.
Rob Landley <rob@landley.net>
parents: 1743
diff changeset
98 then
74d6173e3390 Shouldn't need to build native-compiler to package system-image.
Rob Landley <rob@landley.net>
parents: 1743
diff changeset
99 SYSIMAGE_TYPE=squashfs image_filesystem "$BUILD/native-compiler-$ARCH" \
1817
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
100 "$STAGE_DIR/temp" &&
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
101 mv -f "$STAGE_DIR"/{temp,toolchain}.sqf || dienow
1785
74d6173e3390 Shouldn't need to build native-compiler to package system-image.
Rob Landley <rob@landley.net>
parents: 1743
diff changeset
102 fi
1728
b89324905ca2 Giant redo to put simple-root-filesystem in initmpfs.
Rob Landley <rob@landley.net>
parents: 1538
diff changeset
103
b89324905ca2 Giant redo to put simple-root-filesystem in initmpfs.
Rob Landley <rob@landley.net>
parents: 1538
diff changeset
104 # Build linux kernel for the target
b89324905ca2 Giant redo to put simple-root-filesystem in initmpfs.
Rob Landley <rob@landley.net>
parents: 1538
diff changeset
105
1817
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
106 if is_newer "$STAGE_DIR/linux" "$BUILD/root-filesystem-$ARCH" \
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
107 $(package_cache linux)
1743
10b64f52ad20 Make tweak.sh actually work, and do less unnecessary rebuilding.
Rob Landley <rob@landley.net>
parents: 1735
diff changeset
108 then
10b64f52ad20 Make tweak.sh actually work, and do less unnecessary rebuilding.
Rob Landley <rob@landley.net>
parents: 1735
diff changeset
109 setupfor linux
1827
c7b90f8d1b80 Save mini.config used to build kernel into system image tarball.
Rob Landley <rob@landley.net>
parents: 1824
diff changeset
110 echo "# make allnoconfig ARCH=${BOOT_KARCH:-$KARCH} KCONFIG_ALLCONFIG=mini.config" \
c7b90f8d1b80 Save mini.config used to build kernel into system image tarball.
Rob Landley <rob@landley.net>
parents: 1824
diff changeset
111 > $STAGE_DIR/mini.config
c7b90f8d1b80 Save mini.config used to build kernel into system image tarball.
Rob Landley <rob@landley.net>
parents: 1824
diff changeset
112 getconfig linux >> "$STAGE_DIR"/mini.config
1743
10b64f52ad20 Make tweak.sh actually work, and do less unnecessary rebuilding.
Rob Landley <rob@landley.net>
parents: 1735
diff changeset
113 [ "$SYSIMAGE_TYPE" == rootfs ] &&
1794
108f69f2c952 More sh2eb kernel build fixes.
Rob Landley <rob@landley.net>
parents: 1785
diff changeset
114 echo -e "CONFIG_INITRAMFS_SOURCE=\"$STAGE_DIR/rootfs.cpio.gz\"\n" \
1827
c7b90f8d1b80 Save mini.config used to build kernel into system image tarball.
Rob Landley <rob@landley.net>
parents: 1824
diff changeset
115 >> "$STAGE_DIR"/mini.config
c7b90f8d1b80 Save mini.config used to build kernel into system image tarball.
Rob Landley <rob@landley.net>
parents: 1824
diff changeset
116 make allnoconfig ARCH=${BOOT_KARCH:-$KARCH} $LINUX_FLAGS \
c7b90f8d1b80 Save mini.config used to build kernel into system image tarball.
Rob Landley <rob@landley.net>
parents: 1824
diff changeset
117 KCONFIG_ALLCONFIG="$STAGE_DIR"/mini.config >/dev/null &&
1743
10b64f52ad20 Make tweak.sh actually work, and do less unnecessary rebuilding.
Rob Landley <rob@landley.net>
parents: 1735
diff changeset
118 make -j $CPUS ARCH=${BOOT_KARCH:-$KARCH} $DO_CROSS $LINUX_FLAGS $VERBOSITY &&
10b64f52ad20 Make tweak.sh actually work, and do less unnecessary rebuilding.
Rob Landley <rob@landley.net>
parents: 1735
diff changeset
119 cp "$KERNEL_PATH" "$STAGE_DIR/linux"
10b64f52ad20 Make tweak.sh actually work, and do less unnecessary rebuilding.
Rob Landley <rob@landley.net>
parents: 1735
diff changeset
120 cleanup
10b64f52ad20 Make tweak.sh actually work, and do less unnecessary rebuilding.
Rob Landley <rob@landley.net>
parents: 1735
diff changeset
121 fi
1817
92d542aa6ceb Teach system-image.sh to handle its own dependencies, rebuilding kernel and
Rob Landley <rob@landley.net>
parents: 1794
diff changeset
122
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
123 # 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
124
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
125 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
126
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
127 announce "Packaging complete"