1 inherit rootfs_${IMAGE_PKGTYPE}
5 RDEPENDS += "${IMAGE_INSTALL}"
7 # "export IMAGE_BASENAME" not supported at this time
8 IMAGE_BASENAME[export] = "1"
9 export PACKAGE_INSTALL ?= "${IMAGE_INSTALL}"
11 # We need to recursively follow RDEPENDS and RRECOMMENDS for images
12 do_rootfs[recrdeptask] += "do_deploy do_populate_staging"
14 # Images are generally built explicitly, do not need to be part of world.
15 EXCLUDE_FROM_WORLD = "1"
19 PID = "${@os.getpid()}"
21 PACKAGE_ARCH = "${MACHINE_ARCH}"
23 do_rootfs[depends] += "makedevs-native:do_populate_staging fakeroot-native:do_populate_staging"
28 deps = bb.data.getVarFlag('do_rootfs', 'depends', d) or ""
29 for type in (bb.data.getVar('IMAGE_FSTYPES', d, True) or "").split():
30 for dep in ((bb.data.getVar('IMAGE_DEPENDS_%s' % type, d) or "").split() or []):
31 deps += " %s:do_populate_staging" % dep
32 for dep in (bb.data.getVar('EXTRA_IMAGEDEPENDS', d, True) or "").split():
33 deps += " %s:do_populate_staging" % dep
34 bb.data.setVarFlag('do_rootfs', 'depends', deps, d)
38 # Get a list of files containing device tables to create.
39 # * IMAGE_DEVICE_TABLE is the old name to an absolute path to a device table file
40 # * IMAGE_DEVICE_TABLES is a new name for a file, or list of files, seached
42 # If neither are specified then the default name of files/device_table-minimal.txt
43 # is searched for in the BBPATH (same as the old version.)
45 def get_devtable_list(d):
47 devtable = bb.data.getVar('IMAGE_DEVICE_TABLE', d, 1)
51 devtables = bb.data.getVar('IMAGE_DEVICE_TABLES', d, 1)
53 devtables = 'files/device_table-minimal.txt'
54 for devtable in devtables.split():
55 str += " %s" % bb.which(bb.data.getVar('BBPATH', d, 1), devtable)
58 IMAGE_POSTPROCESS_COMMAND ?= ""
59 MACHINE_POSTPROCESS_COMMAND ?= ""
60 ROOTFS_POSTPROCESS_COMMAND ?= ""
62 # some default locales
63 IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
65 LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVar('IMAGE_LINGUAS', d, 1).split()))}"
67 do_rootfs[nostamp] = "1"
68 do_rootfs[dirs] = "${TOPDIR}"
69 do_build[nostamp] = "1"
71 # Must call real_do_rootfs() from inside here, rather than as a separate
72 # task, so that we have a single fakeroot context for the whole process.
73 fakeroot do_rootfs () {
75 rm -rf ${IMAGE_ROOTFS}
76 mkdir -p ${IMAGE_ROOTFS}
78 if [ "${USE_DEVFS}" != "1" ]; then
79 for devtable in ${@get_devtable_list(d)}; do
80 makedevs -r ${IMAGE_ROOTFS} -D $devtable
84 rootfs_${IMAGE_PKGTYPE}_do_rootfs
88 rm -f ${IMAGE_ROOTFS}${libdir}/ipkg/lists/*
90 ${IMAGE_PREPROCESS_COMMAND}
92 export TOPDIR=${TOPDIR}
93 export MACHINE=${MACHINE}
95 for type in ${IMAGE_FSTYPES}; do
96 if test -z "$FAKEROOTKEY"; then
97 fakeroot -i ${TMPDIR}/fakedb.image ${PYTHON} `which bbimage` -t $type -e ${FILE}
99 ${PYTHON} `which bbimage` -n "${IMAGE_NAME}" -t "$type" -e "${FILE}"
102 cd ${DEPLOY_DIR_IMAGE}/
103 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type
104 ln -s ${IMAGE_NAME}.rootfs.$type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type
107 ${IMAGE_POSTPROCESS_COMMAND}
109 ${MACHINE_POSTPROCESS_COMMAND}
112 insert_feed_uris () {
114 echo "Building feeds for [${DISTRO}].."
116 for line in ${FEED_URIS}
118 # strip leading and trailing spaces/tabs, then split into name and uri
119 line_clean="`echo "$line"|sed 's/^[ \t]*//;s/[ \t]*$//'`"
120 feed_name="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\1/p'`"
121 feed_uri="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\2/p'`"
123 echo "Added $feed_name feed with URL $feed_uri"
125 # insert new feed-sources
126 echo "src/gz $feed_name $feed_uri" >> ${IMAGE_ROOTFS}/etc/ipkg/${feed_name}-feed.conf
129 # Allow to use package deploy directory contents as quick devel-testing
130 # feed. This creates individual feed configs for each arch subdir of those
131 # specified as compatible for the current machine.
132 # NOTE: Development-helper feature, NOT a full-fledged feed.
133 if [ -n "${FEED_DEPLOYDIR_BASE_URI}" ]; then
134 for arch in ${PACKAGE_ARCHS}
136 echo "src/gz local-$arch ${FEED_DEPLOYDIR_BASE_URI}/$arch" >> ${IMAGE_ROOTFS}/etc/ipkg/local-$arch-feed.conf
145 lf_path="${WORKDIR}/temp/log.do_$target.${PID}"
147 echo "log_check: Using $lf_path as logfile"
149 if test -e "$lf_path"
151 rootfs_${IMAGE_PKGTYPE}_log_check $target $lf_path
153 echo "Cannot find logfile [$lf_path]"
155 echo "Logfile is clean"
161 # set '*' as the rootpassword so the images
162 # can decide if they want it or not
164 zap_root_password () {
165 sed 's%^root:[^:]*:%root:*:%' < ${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new
166 mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd
169 create_etc_timestamp() {
170 date +%2m%2d%2H%2M%Y >${IMAGE_ROOTFS}/etc/timestamp
173 # Turn any symbolic /sbin/init link into a file
174 remove_init_link () {
175 if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
176 LINKFILE=${IMAGE_ROOTFS}`readlink ${IMAGE_ROOTFS}/sbin/init`
177 rm ${IMAGE_ROOTFS}/sbin/init
178 cp $LINKFILE ${IMAGE_ROOTFS}/sbin/init
182 make_zimage_symlink_relative () {
183 if [ -L ${IMAGE_ROOTFS}/boot/zImage ]; then
184 (cd ${IMAGE_ROOTFS}/boot/ && for i in `ls zImage-* | sort`; do ln -sf $i zImage; done)
188 # Make login manager(s) enable automatic login.
189 # Useful for devices where we do not want to log in at all (e.g. phones)
190 set_image_autologin () {
191 sed -i 's%^AUTOLOGIN=\"false"%AUTOLOGIN="true"%g' ${IMAGE_ROOTFS}/etc/sysconfig/gpelogin
194 # Can be use to create /etc/timestamp during image construction to give a reasonably
195 # sane default time setting
196 rootfs_update_timestamp () {
197 date "+%m%d%H%M%Y" >${IMAGE_ROOTFS}/etc/timestamp
200 # export the zap_root_password, create_etc_timestamp and remote_init_link
201 EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin rootfs_update_timestamp
203 addtask rootfs before do_build after do_install