Mercurial > hg > aboriginal
annotate package-mini-native.sh @ 496:3cebbc0b0723
Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 24 Nov 2008 09:09:16 -0600 |
parents | 004f9509349b |
children | 9d5fd8e1467b |
rev | line source |
---|---|
177 | 1 #!/bin/bash |
109
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
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
|
3 # Create an ext2 root filesystem image from mini-native |
109
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 |
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 source include.sh |
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 |
485
b0438691e9e1
Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents:
483
diff
changeset
|
7 echo -e "$PACKAGE_COLOR" |
b0438691e9e1
Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents:
483
diff
changeset
|
8 echo "=== Packaging system image from mini-native" |
b0438691e9e1
Move color selection into ./config. (The default colors don't look great on a white background.)
Rob Landley <rob@landley.net>
parents:
483
diff
changeset
|
9 |
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
|
10 SYSIMAGE="${BUILD}/system-image-${ARCH}" |
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
|
11 IMAGE="${SYSIMAGE}/image-${ARCH}.ext2" |
462
3f3283fb5e1e
Running ./package-mini-native.sh as root can just loopback mount itself, without User Mode Linux.
Rob Landley <rob@landley.net>
parents:
451
diff
changeset
|
12 |
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
|
13 # If the host system hasn't got genext2fs, build it. We use it to build 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
|
14 # ext2 image to boot qemu with. |
462
3f3283fb5e1e
Running ./package-mini-native.sh as root can just loopback mount itself, without User Mode Linux.
Rob Landley <rob@landley.net>
parents:
451
diff
changeset
|
15 |
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
|
16 if [ -z "$(which genext2fs)" ] |
391
2a31ea4d91c7
Move User Mode Linux build to package-mini-native.sh, since that's the only
Rob Landley <rob@landley.net>
parents:
372
diff
changeset
|
17 then |
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
|
18 setupfor genext2fs && |
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
|
19 ./configure && |
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
|
20 make -j $CPUS && |
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
|
21 cp genext2fs "${HOSTTOOLS}" && |
391
2a31ea4d91c7
Move User Mode Linux build to package-mini-native.sh, since that's the only
Rob Landley <rob@landley.net>
parents:
372
diff
changeset
|
22 cd .. |
2a31ea4d91c7
Move User Mode Linux build to package-mini-native.sh, since that's the only
Rob Landley <rob@landley.net>
parents:
372
diff
changeset
|
23 |
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
|
24 cleanup genext2fs |
468
3d2996abb6ea
Moving the temp dir broke non-root packaging: fix it.
Rob Landley <rob@landley.net>
parents:
467
diff
changeset
|
25 fi |
3d2996abb6ea
Moving the temp dir broke non-root packaging: fix it.
Rob Landley <rob@landley.net>
parents:
467
diff
changeset
|
26 |
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
|
27 # Flush old system-image directory |
468
3d2996abb6ea
Moving the temp dir broke non-root packaging: fix it.
Rob Landley <rob@landley.net>
parents:
467
diff
changeset
|
28 |
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
|
29 rm -rf "${SYSIMAGE}" |
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
|
30 mkdir -p "${SYSIMAGE}" && |
354
d96741481221
User Mode Linux found a new way to break: now when it panics, it sends a kill
Rob Landley <rob@landley.net>
parents:
353
diff
changeset
|
31 |
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
|
32 # Create a 64 meg sparse image |
451
d7fe6ae2c9e9
User Mode Linux continues to suck.
Rob Landley <rob@landley.net>
parents:
395
diff
changeset
|
33 |
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
|
34 #dd if=/dev/zero of="$IMAGE" bs=1024 seek=$[64*1024-1] count=1 && |
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
|
35 #/sbin/mke2fs -b 1024 -F "$IMAGE" && |
109
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 |
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
|
37 cat > "$WORK/devlist" << EOF && |
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 /dev d 755 0 0 - - - - - |
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 /dev/console c 640 0 0 5 1 0 0 - |
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
|
40 EOF |
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 genext2fs -z -D "$WORK/devlist" -d "${NATIVE}" -i 1024 -b $[64*1024] "$IMAGE" && |
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 rm "$WORK/devlist" || dienow |
462
3f3283fb5e1e
Running ./package-mini-native.sh as root can just loopback mount itself, without User Mode Linux.
Rob Landley <rob@landley.net>
parents:
451
diff
changeset
|
43 |
330
f9ff71c71f9e
Tweak run-with-home.sh to have a chance of actually working.
Rob Landley <rob@landley.net>
parents:
325
diff
changeset
|
44 # Provide qemu's common command line options between architectures. The lack |
f9ff71c71f9e
Tweak run-with-home.sh to have a chance of actually working.
Rob Landley <rob@landley.net>
parents:
325
diff
changeset
|
45 # of ending quotes on -append is intentional, callers append more kernel |
f9ff71c71f9e
Tweak run-with-home.sh to have a chance of actually working.
Rob Landley <rob@landley.net>
parents:
325
diff
changeset
|
46 # command line arguments and provide their own ending quote. |
325
51bcd6de223d
Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents:
317
diff
changeset
|
47 function qemu_defaults() |
51bcd6de223d
Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents:
317
diff
changeset
|
48 { |
330
f9ff71c71f9e
Tweak run-with-home.sh to have a chance of actually working.
Rob Landley <rob@landley.net>
parents:
325
diff
changeset
|
49 echo "-nographic -no-reboot \$WITH_HDB" \ |
372
37c8a6c9a493
Teach qemu-setup.sh to use oneit so ctrl-c works under the emulator. Also
Rob Landley <rob@landley.net>
parents:
355
diff
changeset
|
50 "-hda \"$1\" -kernel \"$2\"" \ |
473
eac92c5b7424
Distinguish console setup (qemu vs chroot) based on whether we're running as pid 1, and grep for console= from kernel command line arguments in dmesg, so we don't have to pass CONSOLE= a second time on kernel command line.
Rob Landley <rob@landley.net>
parents:
472
diff
changeset
|
51 "-append \"root=/dev/$ROOT console=$CONSOLE" \ |
372
37c8a6c9a493
Teach qemu-setup.sh to use oneit so ctrl-c works under the emulator. Also
Rob Landley <rob@landley.net>
parents:
355
diff
changeset
|
52 "rw init=/tools/bin/qemu-setup.sh panic=1" \ |
482
3e9d715e4a11
Rename CROSS_BUILD_STATIC, NATIVE_NOTOOLSDIR, NATIVE_NOTOOLCHAIN and make them work properly.
Rob Landley <rob@landley.net>
parents:
473
diff
changeset
|
53 'PATH=$DISTCC_PATH_PREFIX/tools/bin $KERNEL_EXTRA"' |
325
51bcd6de223d
Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents:
317
diff
changeset
|
54 } |
51bcd6de223d
Redo plumbing that constructs run-emulator.sh. Group common qemu command
Rob Landley <rob@landley.net>
parents:
317
diff
changeset
|
55 |
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
|
56 # 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
|
57 # 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
|
58 # 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
|
59 |
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
|
60 emulator_command image-$ARCH.ext2 zImage-$ARCH > "$SYSIMAGE/run-emulator.sh" && |
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
|
61 chmod +x "$SYSIMAGE/run-emulator.sh" && |
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
|
62 ln "$WORK/zImage-$ARCH" "$SYSIMAGE" && |
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
|
63 cp "$SOURCES"/toys/run-with-{distcc,home}.sh "$SYSIMAGE" |
306
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
300
diff
changeset
|
64 |
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
|
65 [ $? -ne 0 ] && dienow |
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
|
66 |
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
|
67 # Adjust things before creating tarball. |
306
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
300
diff
changeset
|
68 |
496
3cebbc0b0723
Rename (invert) NATIVE_NOTOOLCHAIN and NATIVE_NOTOOLSDIR, and tweak colors again.
Rob Landley <rob@landley.net>
parents:
490
diff
changeset
|
69 if [ -z "$NATIVE_TOOLSDIR" ] |
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
|
70 then |
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
|
71 sed -i 's@/tools/@/usr/@g' "$SYSIMAGE"/*.sh || dienow |
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
|
72 fi |
306
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
300
diff
changeset
|
73 |
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 if [ "$ARCH" == powerpc ] |
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 then |
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 cp "$SOURCES"/toys/ppc_rom.bin "$SYSIMAGE" || dienow |
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
|
77 fi |
109
d9dae1196ea7
Package ext2 filesystem image using UML.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
78 |
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
|
79 # 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
|
80 |
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
|
81 tar -cvj -f "$BUILD"/system-image-$ARCH.tar.bz2 \ |
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
|
82 -C "$BUILD" system-image-$ARCH || dienow |
267
98c1a2136322
Update package-mini-native.sh to create qemu-image-$ARCH.tar.bz2
Rob Landley <rob@landley.net>
parents:
264
diff
changeset
|
83 |
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
|
84 echo -e "=== Packaging complete\e[0m" |
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
|
85 |
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
|
86 |
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
|
87 # We used to do this, but updating the squashfs patch for each new kernel |
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
|
88 # was just too much work. If it gets merged someday, we may care again... |
395
c2b290c1df40
Upgrade BUILD_SHORT to make a small busybox+uClibc system in /usr, with top level symlinks (/bin, /lib, etc) and adjustments to boot script and run-emulator.
Rob Landley <rob@landley.net>
parents:
392
diff
changeset
|
89 |
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
|
90 #echo -n "Creating tools.sqf" |
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
|
91 #("${WORK}/mksquashfs" "${NATIVE}/tools" "${WORK}/tools.sqf" \ |
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
|
92 # -noappend -all-root -info || dienow) | dotprogress |
267
98c1a2136322
Update package-mini-native.sh to create qemu-image-$ARCH.tar.bz2
Rob Landley <rob@landley.net>
parents:
264
diff
changeset
|
93 |
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
|
94 |