1 inherit rootfs_${IMAGE_PKGTYPE}
5 RDEPENDS += "${IMAGE_INSTALL}"
7 IMAGE_BASENAME[export] = "1"
8 export PACKAGE_INSTALL ?= "${IMAGE_INSTALL}"
10 # We need to recursively follow RDEPENDS and RRECOMMENDS for images
11 do_rootfs[recrdeptask] += "do_deploy do_populate_staging"
13 # Images are generally built explicitly, do not need to be part of world.
14 EXCLUDE_FROM_WORLD = "1"
18 PID = "${@os.getpid()}"
20 PACKAGE_ARCH = "${MACHINE_ARCH}"
22 do_rootfs[depends] += "makedevs-native:do_populate_staging fakeroot-native:do_populate_staging"
27 deps = bb.data.getVarFlag('do_rootfs', 'depends', d) or ""
28 for type in (bb.data.getVar('IMAGE_FSTYPES', d, True) or "").split():
29 for dep in ((bb.data.getVar('IMAGE_DEPENDS_%s' % type, d) or "").split() or []):
30 deps += " %s:do_populate_staging" % dep
31 for dep in (bb.data.getVar('EXTRA_IMAGEDEPENDS', d, True) or "").split():
32 deps += " %s:do_populate_staging" % dep
33 bb.data.setVarFlag('do_rootfs', 'depends', deps, d)
37 # Get a list of files containing device tables to create.
38 # * IMAGE_DEVICE_TABLE is the old name to an absolute path to a device table file
39 # * IMAGE_DEVICE_TABLES is a new name for a file, or list of files, seached
41 # If neither are specified then the default name of files/device_table-minimal.txt
42 # is searched for in the BBPATH (same as the old version.)
44 def get_devtable_list(d):
46 devtable = bb.data.getVar('IMAGE_DEVICE_TABLE', d, 1)
50 devtables = bb.data.getVar('IMAGE_DEVICE_TABLES', d, 1)
52 devtables = 'files/device_table-minimal.txt'
53 for devtable in devtables.split():
54 str += " %s" % bb.which(bb.data.getVar('BBPATH', d, 1), devtable)
57 IMAGE_POSTPROCESS_COMMAND ?= ""
58 MACHINE_POSTPROCESS_COMMAND ?= ""
59 ROOTFS_POSTPROCESS_COMMAND ?= ""
61 # some default locales
62 IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
64 LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVar('IMAGE_LINGUAS', d, 1).split()))}"
66 do_rootfs[nostamp] = "1"
67 do_rootfs[dirs] = "${TOPDIR}"
68 do_build[nostamp] = "1"
70 # Must call real_do_rootfs() from inside here, rather than as a separate
71 # task, so that we have a single fakeroot context for the whole process.
72 fakeroot do_rootfs () {
74 rm -rf ${IMAGE_ROOTFS}
75 mkdir -p ${IMAGE_ROOTFS}
77 if [ "${USE_DEVFS}" != "1" ]; then
78 for devtable in ${@get_devtable_list(d)}; do
79 makedevs -r ${IMAGE_ROOTFS} -D $devtable
83 rootfs_${IMAGE_PKGTYPE}_do_rootfs
87 rm -f ${IMAGE_ROOTFS}${libdir}/ipkg/lists/*
89 ${IMAGE_PREPROCESS_COMMAND}
91 export TOPDIR=${TOPDIR}
92 export MACHINE=${MACHINE}
94 for type in ${IMAGE_FSTYPES}; do
95 if test -z "$FAKEROOTKEY"; then
96 fakeroot -i ${TMPDIR}/fakedb.image ${PYTHON} `which bbimage` -t $type -e ${FILE}
98 ${PYTHON} `which bbimage` -n "${IMAGE_NAME}" -t "$type" -e "${FILE}"
101 cd ${DEPLOY_DIR_IMAGE}/
102 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type
103 ln -s ${IMAGE_NAME}.rootfs.$type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type
106 ${IMAGE_POSTPROCESS_COMMAND}
108 ${MACHINE_POSTPROCESS_COMMAND}
111 insert_feed_uris () {
113 echo "Building feeds for [${DISTRO}].."
115 for line in ${FEED_URIS}
117 # strip leading and trailing spaces/tabs, then split into name and uri
118 line_clean="`echo "$line"|sed 's/^[ \t]*//;s/[ \t]*$//'`"
119 feed_name="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\1/p'`"
120 feed_uri="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\2/p'`"
122 echo "Added $feed_name feed with URL $feed_uri"
124 # insert new feed-sources
125 echo "src/gz $feed_name $feed_uri" >> ${IMAGE_ROOTFS}/etc/ipkg/${feed_name}-feed.conf
133 lf_path="${WORKDIR}/temp/log.do_$target.${PID}"
135 echo "log_check: Using $lf_path as logfile"
137 if test -e "$lf_path"
139 rootfs_${IMAGE_PKGTYPE}_log_check $target $lf_path
141 echo "Cannot find logfile [$lf_path]"
143 echo "Logfile is clean"
149 # set '*' as the rootpassword so the images
150 # can decide if they want it or not
152 zap_root_password () {
153 sed 's%^root:[^:]*:%root:*:%' < ${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new
154 mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd
157 create_etc_timestamp() {
158 date +%2m%2d%2H%2M%Y >${IMAGE_ROOTFS}/etc/timestamp
161 # Turn any symbolic /sbin/init link into a file
162 remove_init_link () {
163 if [ -h ${IMAGE_ROOTFS}/sbin/init ]; then
164 LINKFILE=${IMAGE_ROOTFS}`readlink ${IMAGE_ROOTFS}/sbin/init`
165 rm ${IMAGE_ROOTFS}/sbin/init
166 cp $LINKFILE ${IMAGE_ROOTFS}/sbin/init
170 make_zimage_symlink_relative () {
171 if [ -L ${IMAGE_ROOTFS}/boot/zImage ]; then
172 (cd ${IMAGE_ROOTFS}/boot/ && for i in `ls zImage-* | sort`; do ln -sf $i zImage; done)
176 # Make login manager(s) enable automatic login.
177 # Useful for devices where we do not want to log in at all (e.g. phones)
178 set_image_autologin () {
179 sed -i 's%^AUTOLOGIN=\"false"%AUTOLOGIN="true"%g' ${IMAGE_ROOTFS}/etc/sysconfig/gpelogin
183 # export the zap_root_password, create_etc_timestamp and remote_init_link
184 EXPORT_FUNCTIONS zap_root_password create_etc_timestamp remove_init_link do_rootfs make_zimage_symlink_relative set_image_autologin
186 addtask rootfs before do_build after do_install